Class ExtendedDataLength<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<org.djunits.unit.LengthUnit,org.djunits.value.vfloat.scalar.FloatLength,org.djunits.value.vfloat.vector.FloatLengthVector,G>
org.opentrafficsim.kpi.sampling.data.ExtendedDataLength<G>
Type Parameters:
G - gtu data type
All Implemented Interfaces:
org.djutils.base.Identifiable

public abstract class ExtendedDataLength<G extends GtuData> extends ExtendedDataFloat<org.djunits.unit.LengthUnit,org.djunits.value.vfloat.scalar.FloatLength,org.djunits.value.vfloat.vector.FloatLengthVector,G>
Extended data type for length values.

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 Details

    • ExtendedDataLength

      public ExtendedDataLength(String id, String description)
      Constructor setting the id.
      Parameters:
      id - String; id
      description - String; description
  • Method Details

    • convertValue

      protected final org.djunits.value.vfloat.scalar.FloatLength convertValue(float value)
      Convert float to typed value.
      Specified by:
      convertValue in class ExtendedDataFloat<org.djunits.unit.LengthUnit,org.djunits.value.vfloat.scalar.FloatLength,org.djunits.value.vfloat.vector.FloatLengthVector,G extends GtuData>
      Parameters:
      value - float; float value
      Returns:
      typed value
    • convert

      protected final org.djunits.value.vfloat.vector.FloatLengthVector convert(float[] storage) throws org.djunits.value.ValueRuntimeException
      Convert float array to typed array.
      Specified by:
      convert in class ExtendedDataFloat<org.djunits.unit.LengthUnit,org.djunits.value.vfloat.scalar.FloatLength,org.djunits.value.vfloat.vector.FloatLengthVector,G extends GtuData>
      Parameters:
      storage - float[]; float array storage
      Returns:
      typed array
      Throws:
      org.djunits.value.ValueRuntimeException - when float array cannot be converted
    • interpolate

      public org.djunits.value.vfloat.scalar.FloatLength interpolate(org.djunits.value.vfloat.scalar.FloatLength value0, org.djunits.value.vfloat.scalar.FloatLength value1, double f)
      Interpolate value between two measured values. The default implementation takes a linear interpolation over time for DoubleScalar, FloatScalar, Double and Float, or the closest value in time otherwise.
      Overrides:
      interpolate in class ExtendedDataType<org.djunits.value.vfloat.scalar.FloatLength,org.djunits.value.vfloat.vector.FloatLengthVector,float[],G extends GtuData>
      Parameters:
      value0 - T; first value
      value1 - T; second value
      f - double; interpolation fraction
      Returns:
      interpolated value
    • parseValue

      public org.djunits.value.vfloat.scalar.FloatLength parseValue(String string)
      Parses a stored string representation to original type.
      Specified by:
      parseValue in class ExtendedDataType<org.djunits.value.vfloat.scalar.FloatLength,org.djunits.value.vfloat.vector.FloatLengthVector,float[],G extends GtuData>
      Parameters:
      string - String; stored string representation
      Returns:
      T; value in original type