Class NullHistorical<T>

  • Type Parameters:
    T - value type
    All Implemented Interfaces:
    Historical<T>

    public class NullHistorical<T>
    extends Object
    implements Historical<T>
    Simple implementation without history that can be used inside a generic context where also implementations with history can be used.

    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 1 feb. 2018
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • NullHistorical

        public NullHistorical​(T value)
        Construct a new NullHistorical.
        Parameters:
        value - T; value that is (always) returned by the get methods
    • Method Detail

      • set

        public void set​(T value)
        Set value at the current simulation time. If a value is already stored for this time, it is replaced.
        Specified by:
        set in interface Historical<T>
        Parameters:
        value - T; value
      • get

        public T get()
        Get value at current simulation time. TODO specify what happens when no value was set for the current simulation time
        Specified by:
        get in interface Historical<T>
        Returns:
        T; value at current simulation time
      • get

        public T get​(Time time)
        Get value at a specific time. TODO specify what happens when no value has ever been set, or the value for the specified time can not be determined.
        Specified by:
        get in interface Historical<T>
        Parameters:
        time - Time; time to get the value
        Returns:
        T; value at current time