Class ExtendedDataTypeNumber<G extends GtuDataInterface>

java.lang.Object
org.opentrafficsim.kpi.sampling.data.ExtendedDataType<Float,​float[],​float[],​G>
org.opentrafficsim.kpi.sampling.data.ExtendedDataTypeNumber<G>
Type Parameters:
G - gtu data type
All Implemented Interfaces:
Identifiable

public abstract class ExtendedDataTypeNumber<G extends GtuDataInterface>
extends ExtendedDataType<Float,​float[],​float[],​G>
Class for unitless values.

Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Version:
$Revision$, $LastChangedDate$, by $Author$, initial version 23 mei 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

  • Method Details

    • 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:
      setValue in class ExtendedDataType<Float,​float[],​float[],​G extends GtuDataInterface>
      Parameters:
      storage - S; storage
      index - int; index to store next value
      value - 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:
      getOutputValue in class ExtendedDataType<Float,​float[],​float[],​G extends GtuDataInterface>
      Parameters:
      output - O; output
      index - int; index of value to return
      Returns:
      the i'th output value
      Throws:
      SamplingException - when i is 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:
      getStorageValue in class ExtendedDataType<Float,​float[],​float[],​G extends GtuDataInterface>
      Parameters:
      storage - S; storage
      index - int; index of value to return
      Returns:
      the i'th output value
      Throws:
      SamplingException - when i is out of bounds.
    • initializeStorage

      public float[] initializeStorage()
      Returns an initial storage object.
      Specified by:
      initializeStorage in class ExtendedDataType<Float,​float[],​float[],​G extends GtuDataInterface>
      Returns:
      initial storage object.
    • convert

      public float[] convert​(float[] storage, int size)
      Convert storage type to output type.
      Specified by:
      convert in class ExtendedDataType<Float,​float[],​float[],​G extends GtuDataInterface>
      Parameters:
      storage - S; stored data
      size - int; size of trajectory
      Returns:
      converted output
    • formatValue

      public String formatValue​(String format, Float value)
      Formats the value into a string. If the value is numeric, the default implementation is:
       String.format(format, value.si);
       
      Specified by:
      formatValue in class ExtendedDataType<Float,​float[],​float[],​G extends GtuDataInterface>
      Parameters:
      format - String; format
      value - T; value
      Returns:
      formatted value