Class ExtendedDataLength<G extends GtuData>
- java.lang.Object
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataType<T,O,float[],G>
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataFloat<LengthUnit,FloatLength,FloatLengthVector,G>
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataLength<G>
-
- Type Parameters:
G- gtu data type
- All Implemented Interfaces:
Identifiable
public abstract class ExtendedDataLength<G extends GtuData> extends ExtendedDataFloat<LengthUnit,FloatLength,FloatLengthVector,G>
Extended data type for length 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 ExtendedDataLength(String id, String description)Constructor setting the id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FloatLengthVectorconvert(float[] storage)Convert float array to typed array.protected FloatLengthconvertValue(float value)Convert float to typed value.FloatLengthinterpolate(FloatLength value0, FloatLength value1, double f)Interpolate value between two measured values.FloatLengthparseValue(String string)Parses a stored string representation to original type.-
Methods inherited from class org.opentrafficsim.kpi.sampling.data.ExtendedDataFloat
convert, getOutputValue, getStorageValue, initializeStorage, setValue
-
Methods inherited from class org.opentrafficsim.kpi.sampling.data.ExtendedDataType
equals, getDescription, getId, getType, getValue, hashCode, toString
-
-
-
-
Method Detail
-
convertValue
protected final FloatLength convertValue(float value)
Convert float to typed value.- Specified by:
convertValuein classExtendedDataFloat<LengthUnit,FloatLength,FloatLengthVector,G extends GtuData>- Parameters:
value- float; float value- Returns:
- typed value
-
convert
protected final FloatLengthVector convert(float[] storage) throws ValueRuntimeException
Convert float array to typed array.- Specified by:
convertin classExtendedDataFloat<LengthUnit,FloatLength,FloatLengthVector,G extends GtuData>- Parameters:
storage- float[]; float array storage- Returns:
- typed array
- Throws:
ValueRuntimeException- when float array cannot be converted
-
interpolate
public FloatLength interpolate(FloatLength value0, FloatLength value1, double f)
Interpolate value between two measured values. The default implementation takes a linear interpolation over time forDoubleScalar,FloatScalar,DoubleandFloat, or the closest value in time otherwise.- Overrides:
interpolatein classExtendedDataType<FloatLength,FloatLengthVector,float[],G extends GtuData>- Parameters:
value0- T; first valuevalue1- T; second valuef- double; interpolation fraction- Returns:
- interpolated value
-
parseValue
public FloatLength parseValue(String string)
Parses a stored string representation to original type.- Specified by:
parseValuein classExtendedDataType<FloatLength,FloatLengthVector,float[],G extends GtuData>- Parameters:
string- String; stored string representation- Returns:
- T; value in original type
-
-