T - type of valueO - output typeS - storage typeG - gtu data typepublic abstract class ExtendedDataType<T,O,S,G extends GtuDataInterface> extends Object implements org.opentrafficsim.base.Identifiable
<T> is the type of a single
scalar value, <O> is the output type of the whole trajectory, e.g. List<Double> or FloatLengthVector,
and <S> is the storage type by which the data is gathered, e.g. List<Double> or float[].
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
| Constructor and Description |
|---|
ExtendedDataType(String id)
Constructor setting the id.
|
| Modifier and Type | Method and Description |
|---|---|
abstract O |
convert(S storage,
int size)
Convert storage type to output type.
|
boolean |
equals(Object obj) |
abstract String |
formatValue(String format,
T value)
Formats the value into a string.
|
String |
getId() |
abstract T |
getOutputValue(O output,
int index)
Returns a specific output value.
|
abstract T |
getStorageValue(S storage,
int index)
Returns a specific storage value.
|
abstract T |
getValue(G gtu)
Returns the current value of the gtu.
|
int |
hashCode() |
abstract S |
initializeStorage()
Returns an initial storage object.
|
<AU extends org.djunits.unit.AbsoluteLinearUnit<AU,RU>,RU extends org.djunits.unit.Unit<RU>> |
interpolate(T value0,
T value1,
double f)
Interpolate value between two measured values.
|
abstract S |
setValue(S storage,
int index,
T value)
Returns an updated list/array/vector of the storage type, including a new value at given index.
|
public ExtendedDataType(String id)
id - idpublic final String getId()
getId in interface org.opentrafficsim.base.Identifiablepublic abstract T getValue(G gtu)
gtu - gtupublic abstract S setValue(S storage, int index, T value)
storage - storageindex - index to store next valuevalue - value to addpublic abstract T getOutputValue(O output, int index) throws SamplingException
output - outputindex - index of value to returnSamplingException - when i is out of bounds.public abstract T getStorageValue(S storage, int index) throws SamplingException
storage - storageindex - index of value to returnSamplingException - when i is out of bounds.public abstract S initializeStorage()
public abstract O convert(S storage, int size)
storage - stored datasize - size of trajectorypublic abstract String formatValue(String format, T value)
String.format(format, value.si);
format - formatvalue - valuepublic <AU extends org.djunits.unit.AbsoluteLinearUnit<AU,RU>,RU extends org.djunits.unit.Unit<RU>> T interpolate(T value0, T value1, double f)
DoubleScalar, FloatScalar, Double and Float, or the closest value in time otherwise.AU - unit of value, if values are DoubleScalarRU - the corresponding relative unitvalue0 - first valuevalue1 - second valuef - interpolation fractionCopyright © 2014–2018 Delft University of Technology. All rights reserved.