Class HistoricalEnumMap<K extends java.lang.Enum<K>,​V>

  • Type Parameters:
    K - key type
    V - value type
    All Implemented Interfaces:
    java.util.Map<K,​V>, HistoricalMap<K,​V>, HistoryManager.HistoricalElement

    public class HistoricalEnumMap<K extends java.lang.Enum<K>,​V>
    extends AbstractHistoricalMap<K,​V,​java.util.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
    • Constructor Detail

      • HistoricalEnumMap

        public HistoricalEnumMap​(HistoryManager historyManager,
                                 java.lang.Class<K> clazz)
        Constructor.
        Parameters:
        historyManager - HistoryManager; history manager
        clazz - Class<K>; enum class
      • HistoricalEnumMap

        public HistoricalEnumMap​(HistoryManager historyManager,
                                 java.util.EnumMap<K,​? extends V> m,
                                 java.lang.Class<K> clazz)
        Constructor.
        Parameters:
        historyManager - HistoryManager; history manager
        m - EnumMap<K, ? extends V>; initial map
        clazz - Class<K>; enum class
    • Method Detail

      • get

        public java.util.EnumMap<K,​V> get()
        Returns the current map.
        Returns:
        Map; current map
      • get

        public java.util.EnumMap<K,​V> get​(Time time)
        Returns a past map.
        Parameters:
        time - Time; time to obtain the map at
        Returns:
        Map; past map
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object