Class HistoricalHashMap<K,​V>

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

    public class HistoricalHashMap<K,​V>
    extends AbstractHistoricalMap<K,​V,​LinkedHashMap<K,​V>>
    LinkedHashMap-valued historical state. The current hash map is always maintained, and past states of the hash 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 3 feb. 2018
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • HistoricalHashMap

        public HistoricalHashMap​(HistoryManager historyManager)
        Construct a new, empty HistoricalHashMap.
        Parameters:
        historyManager - HistoryManager; history manager
      • HistoricalHashMap

        public HistoricalHashMap​(HistoryManager historyManager,
                                 Map<? extends K,​? extends V> m)
        Construct a new HistoricalHashMap and all elements of the given map to it.
        Parameters:
        historyManager - HistoryManager; history manager
        m - Map<? extends K, ? extends V>; initial map
    • Method Detail

      • get

        public LinkedHashMap<K,​V> get()
        Retrieve the current, internal map. TODO document what the caller may do with the result.
        Returns:
        Map; current map
      • get

        public LinkedHashMap<K,​V> get​(Time time)
        Retrieve a past map.
        Parameters:
        time - Time; time to obtain the map at
        Returns:
        Map<K, V>; past map