Class HistoricalValue<T>
- java.lang.Object
-
- org.opentrafficsim.core.perception.AbstractHistorical<T,AbstractHistorical.EventValue<T>>
-
- org.opentrafficsim.core.perception.HistoricalValue<T>
-
- Type Parameters:
T
- value type
- All Implemented Interfaces:
Historical<T>
,HistoryManager.HistoricalElement
public class HistoricalValue<T> extends AbstractHistorical<T,AbstractHistorical.EventValue<T>> implements Historical<T>
Single-valued historical state.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 jan. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.AbstractHistorical
AbstractHistorical.Event, AbstractHistorical.EventValue<T>
-
-
Constructor Summary
Constructors Constructor Description HistoricalValue(HistoryManager historyManager)
Constructor.HistoricalValue(HistoryManager historyManager, T initialValue)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
Get value at current simulation time.T
get(Time time)
Get value at given time.void
set(T value)
Set value at the current simulation time.String
toString()
-
Methods inherited from class org.opentrafficsim.core.perception.AbstractHistorical
addEvent, cleanUpHistory, getEvent, getEvents, getLastEvent, isLastState, now, removeEvent
-
-
-
-
Constructor Detail
-
HistoricalValue
public HistoricalValue(HistoryManager historyManager)
Constructor.- Parameters:
historyManager
- HistoryManager; history manager
-
HistoricalValue
public HistoricalValue(HistoryManager historyManager, T initialValue)
Constructor.- Parameters:
historyManager
- HistoryManager; history managerinitialValue
- T; initial value
-
-
Method Detail
-
set
public final void set(T value)
Set value at the current simulation time. If a value is already given at this time, it is overwritten. Values should be set in chronological order.- Specified by:
set
in interfaceHistorical<T>
- Parameters:
value
- T; value
-
get
public final T get()
Get value at current simulation time.- Specified by:
get
in interfaceHistorical<T>
- Returns:
- T; value at current simulation time
-
get
public final T get(Time time)
Get value at given time.- Specified by:
get
in interfaceHistorical<T>
- Parameters:
time
- Time; time to get the value- Returns:
- T; value at current time
-
-