Class ExtendedDataNumber<G extends GtuData>
- java.lang.Object
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataType<Float,float[],float[],G>
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataNumber<G>
-
- Type Parameters:
G- gtu data type
- All Implemented Interfaces:
Identifiable
public abstract class ExtendedDataNumber<G extends GtuData> extends ExtendedDataType<Float,float[],float[],G>
Class for unitless values.Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description ExtendedDataNumber(String id, String description)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float[]convert(float[] storage, int size)Convert storage type to output type.FloatgetOutputValue(float[] output, int index)Returns a specific output value.FloatgetStorageValue(float[] storage, int index)Returns a specific storage value.float[]initializeStorage()Returns an initial storage object.FloatparseValue(String string)Parses a stored string representation to original type.float[]setValue(float[] storage, int index, Float value)Returns an updated list/array/vector of the storage type, including a new value at given index.-
Methods inherited from class org.opentrafficsim.kpi.sampling.data.ExtendedDataType
equals, getDescription, getId, getType, getValue, hashCode, interpolate, toString
-
-
-
-
Method Detail
-
setValue
public float[] setValue(float[] storage, int index, Float value)Returns an updated list/array/vector of the storage type, including a new value at given index.- Specified by:
setValuein classExtendedDataType<Float,float[],float[],G extends GtuData>- Parameters:
storage- S; storageindex- int; index to store next valuevalue- T; value to add- Returns:
- updated list/array/vector of the storage type, including a new value at given index
-
getOutputValue
public Float getOutputValue(float[] output, int index) throws SamplingException
Returns a specific output value. This is used to store extended data types as generic file, i.e. text file.- Specified by:
getOutputValuein classExtendedDataType<Float,float[],float[],G extends GtuData>- Parameters:
output- O; outputindex- int; index of value to return- Returns:
- the i'th output value
- Throws:
SamplingException- wheniis out of bounds.
-
getStorageValue
public Float getStorageValue(float[] storage, int index) throws SamplingException
Returns a specific storage value. This is used to bypass conversion to the output type when trajectories are cut.- Specified by:
getStorageValuein classExtendedDataType<Float,float[],float[],G extends GtuData>- Parameters:
storage- S; storageindex- int; index of value to return- Returns:
- the i'th output value
- Throws:
SamplingException- wheniis out of bounds.
-
initializeStorage
public float[] initializeStorage()
Returns an initial storage object.- Specified by:
initializeStoragein classExtendedDataType<Float,float[],float[],G extends GtuData>- Returns:
- initial storage object.
-
convert
public float[] convert(float[] storage, int size)Convert storage type to output type.- Specified by:
convertin classExtendedDataType<Float,float[],float[],G extends GtuData>- Parameters:
storage- S; stored datasize- int; size of trajectory- Returns:
- converted output
-
parseValue
public Float parseValue(String string)
Parses a stored string representation to original type.- Specified by:
parseValuein classExtendedDataType<Float,float[],float[],G extends GtuData>- Parameters:
string- String; stored string representation- Returns:
- T; value in original type
-
-