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.Copyright (c) 2013-2022 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
All Methods Instance Methods Concrete Methods 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, removeEvent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opentrafficsim.core.perception.collections.HistoricalMap
get, get, replaceAll
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace
-
-
-
-
Constructor Detail
-
AbstractHistoricalMap
protected AbstractHistoricalMap(HistoryManager historyManager, M map)
Constructor.- Parameters:
historyManager- HistoryManager; history managermap- M; initial map
-
-
Method Detail
-
getMap
protected M getMap()
Returns the internal map.- Returns:
- M; internal map
-
fill
protected M fill(M map)
Fill map with the current map.- Parameters:
map- M; map to fill- Returns:
- M; input map filled
-
fill
protected M fill(Time time, M map)
Fill map with the map at the given simulation time.- Parameters:
time- Time; timemap- M; map to fill- Returns:
- M; input map filled
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
-