Class ExtendedDataFloat<U extends org.djunits.unit.Unit<U>,T extends org.djunits.value.vfloat.scalar.base.FloatScalar<U,T>,O extends org.djunits.value.vfloat.vector.base.FloatVector<U,T,O>,G extends GtuData>
java.lang.Object
org.opentrafficsim.kpi.sampling.DataType<T,G>
org.opentrafficsim.kpi.sampling.data.ExtendedDataType<T,O,float[],G>
org.opentrafficsim.kpi.sampling.data.ExtendedDataFloat<U,T,O,G>
- Type Parameters:
U
- unitT
- type in vectorO
- output vector typeG
- GTU data type
- All Implemented Interfaces:
org.djutils.base.Identifiable
- Direct Known Subclasses:
ExtendedDataDuration
,ExtendedDataLength
,ExtendedDataSpeed
public abstract class ExtendedDataFloat<U extends org.djunits.unit.Unit<U>,T extends org.djunits.value.vfloat.scalar.base.FloatScalar<U,T>,O extends org.djunits.value.vfloat.vector.base.FloatVector<U,T,O>,G extends GtuData>
extends ExtendedDataType<T,O,float[],G>
Class to facilitate JUNITS types in extended data.
Copyright (c) 2013-2024 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
ConstructorsConstructorDescriptionExtendedDataFloat
(String id, String description, Class<T> type) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract O
convert
(float[] storage) Convert float array to typed array.convert
(float[] storage, int size) Convert storage type to output type.protected abstract T
convertValue
(float value) Convert float to typed value.final T
getOutputValue
(O output, int i) Returns a specific output value.getStorageValue
(float[] storage, int i) Returns a specific storage value.final float[]
Returns an initial storage object.abstract T
parseValue
(String string) Parses a stored string representation to original type.final float[]
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
getValue, interpolate, toString
-
Constructor Details
-
ExtendedDataFloat
Constructor.- Parameters:
id
- iddescription
- descriptiontype
- type class
-
-
Method Details
-
setValue
Description copied from class:ExtendedDataType
Returns an updated list/array/vector of the storage type, including a new value at given index.- Specified by:
setValue
in classExtendedDataType<T extends org.djunits.value.vfloat.scalar.base.FloatScalar<U,
T>, O extends org.djunits.value.vfloat.vector.base.FloatVector<U, T, O>, float[], G extends GtuData> - Parameters:
storage
- storagei
- index to store next valuevalue
- value to add- Returns:
- updated list/array/vector of the storage type, including a new value at given index
-
initializeStorage
public final float[] initializeStorage()Description copied from class:ExtendedDataType
Returns an initial storage object. -
getOutputValue
Description copied from class:ExtendedDataType
Returns a specific output value. This is used to store extended data types as generic file, i.e. text file.- Specified by:
getOutputValue
in classExtendedDataType<T extends org.djunits.value.vfloat.scalar.base.FloatScalar<U,
T>, O extends org.djunits.value.vfloat.vector.base.FloatVector<U, T, O>, float[], G extends GtuData> - Parameters:
output
- outputi
- index of value to return- Returns:
- the i'th output value o
-
getStorageValue
Description copied from class:ExtendedDataType
Returns a specific storage value. This is used to bypass conversion to the output type when trajectories are cut.- Specified by:
getStorageValue
in classExtendedDataType<T extends org.djunits.value.vfloat.scalar.base.FloatScalar<U,
T>, O extends org.djunits.value.vfloat.vector.base.FloatVector<U, T, O>, float[], G extends GtuData> - Parameters:
storage
- storagei
- index of value to return- Returns:
- the i'th output value
-
convertValue
Convert float to typed value.- Parameters:
value
- float value- Returns:
- typed value
-
convert
Description copied from class:ExtendedDataType
Convert storage type to output type. -
parseValue
Parses a stored string representation to original type.- Specified by:
parseValue
in classExtendedDataType<T extends org.djunits.value.vfloat.scalar.base.FloatScalar<U,
T>, O extends org.djunits.value.vfloat.vector.base.FloatVector<U, T, O>, float[], G extends GtuData> - Parameters:
string
- stored string representation without unit- Returns:
- value in original type
-
convert
Convert float array to typed array.- Parameters:
storage
- float array storage- Returns:
- typed array
-