Class AbstractHistoricalMap<K,V,M extends Map<K,V>>
java.lang.Object
org.opentrafficsim.core.perception.AbstractHistorical<K,AbstractHistoricalMap.EventMap<K,V,M>>
org.opentrafficsim.core.perception.collections.AbstractHistoricalMap<K,V,M>
- Type Parameters:
K- key typeV- value typeM- map type
- All Implemented Interfaces:
Map<K,V>,HistoricalMap<K,V>,HistoryManager.HistoricalElement
- Direct Known Subclasses:
AbstractHistoricalSortedMap,HistoricalEnumMap,HistoricalHashMap,HistoricalLinkedHashMap
public abstract class AbstractHistoricalMap<K,V,M extends Map<K,V>> extends AbstractHistorical<K,AbstractHistoricalMap.EventMap<K,V,M>> implements HistoricalMap<K,V>
Map-valued historical state. The current map is always maintained, and past states of the map are obtained by applying the
events between now and the requested time in reverse.
The set views returned by this class are unmodifiable.
The set views returned by this class are unmodifiable.
Copyright (c) 2013-2019 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 1 feb. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractHistoricalMap.EventMap<K,V,M extends Map<K,V>>Abstract super class for events that add or remove a value from the map.Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.AbstractHistorical
AbstractHistorical.EventValue<T> -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractHistoricalMap(HistoryManager historyManager, M map)Constructor. -
Method Summary
Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()protected Mfill(M map)Fill map with the current map.protected Mfill(Time time, M map)Fill map with the map at the given simulation time.Vget(Object key)protected MgetMap()Returns the internal map.booleanisEmpty()Set<K>keySet()Vput(K key, V value)voidputAll(Map<? extends K,? extends V> m)Vremove(Object key)intsize()Collection<V>values()Methods inherited from class org.opentrafficsim.core.perception.AbstractHistorical
addEvent, cleanUpHistory, getEvent, getEvents, getLastEvent, isLastState, now, removeEventMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opentrafficsim.core.perception.collections.HistoricalMap
get, get, replaceAllMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace
-
Constructor Details
-
AbstractHistoricalMap
Constructor.- Parameters:
historyManager- HistoryManager; history managermap- M; initial map
-
-
Method Details
-
getMap
Returns the internal map.- Returns:
- M; internal map
-
fill
Fill map with the current map.- Parameters:
map- M; map to fill- Returns:
- M; input map filled
-
fill
Fill map with the map at the given simulation time.- Parameters:
time- Time; timemap- M; map to fill- Returns:
- M; input map filled
-
clear
public void clear() -
put
-
putAll
-
remove
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
keySet
-
values
-
entrySet
-