Class HistoricalEnumMap<K extends Enum<K>,V>
- java.lang.Object
-
- org.opentrafficsim.core.perception.AbstractHistorical<K,AbstractHistoricalMap.EventMap<K,V,M>>
-
- org.opentrafficsim.core.perception.collections.AbstractHistoricalMap<K,V,EnumMap<K,V>>
-
- org.opentrafficsim.core.perception.collections.HistoricalEnumMap<K,V>
-
- Type Parameters:
K- key typeV- value type
- All Implemented Interfaces:
Map<K,V>,HistoricalMap<K,V>,HistoryManager.HistoricalElement
public class HistoricalEnumMap<K extends Enum<K>,V> extends AbstractHistoricalMap<K,V,EnumMap<K,V>>
EnumMap-valued historical state. The current enum map is always maintained, and past states of the enum map are obtained by applying the events between now and the requested time in reverse.
The set views returned by this class are unmodifiable.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 4 feb. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.collections.AbstractHistoricalMap
AbstractHistoricalMap.EventMap<K,V,M extends Map<K,V>>
-
Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.AbstractHistorical
AbstractHistorical.EventValue<T>
-
-
Constructor Summary
Constructors Constructor Description HistoricalEnumMap(HistoryManager historyManager, Class<K> clazz)Construct a new, empty HistoricalEnumMap.HistoricalEnumMap(HistoryManager historyManager, EnumMap<K,? extends V> m, Class<K> clazz)Construct a new HistoricalEnumMap and add all elements of the given initial map to it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EnumMap<K,V>get()Retrieve the current, internal map.EnumMap<K,V>get(Time time)Retrieve a past map.StringtoString()-
Methods inherited from class org.opentrafficsim.core.perception.collections.AbstractHistoricalMap
clear, containsKey, containsValue, entrySet, fill, fill, get, getMap, isEmpty, keySet, put, putAll, remove, size, values
-
Methods inherited from class org.opentrafficsim.core.perception.AbstractHistorical
addEvent, cleanUpHistory, getEvent, getEvents, getLastEvent, isLastState, now, removeEvent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.core.perception.collections.HistoricalMap
replaceAll
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace
-
-
-
-
Constructor Detail
-
HistoricalEnumMap
public HistoricalEnumMap(HistoryManager historyManager, Class<K> clazz)
Construct a new, empty HistoricalEnumMap.- Parameters:
historyManager- HistoryManager; history managerclazz- Class<K>; enum class
-
HistoricalEnumMap
public HistoricalEnumMap(HistoryManager historyManager, EnumMap<K,? extends V> m, Class<K> clazz)
Construct a new HistoricalEnumMap and add all elements of the given initial map to it.- Parameters:
historyManager- HistoryManager; history managerm- EnumMap<K, ? extends V>; initial mapclazz- Class<K>; enum class
-
-
Method Detail
-
get
public EnumMap<K,V> get()
Retrieve the current, internal map. TODO document what the caller may do with the result.- Returns:
- Map; current map
-
get
public EnumMap<K,V> get(Time time)
Retrieve a past map.- Parameters:
time- Time; time to obtain the map at- Returns:
- Map<K, V>; past map
-
-