Class ExtendedDataTypeList<T,​G extends GtuDataInterface>

  • Type Parameters:
    T - type of value
    G - gtu data type
    All Implemented Interfaces:
    Identifiable
    Direct Known Subclasses:
    ExtendedDataTypeString

    public abstract class ExtendedDataTypeList<T,​G extends GtuDataInterface>
    extends ExtendedDataType<T,​java.util.List<T>,​java.util.List<T>,​G>
    Extended data type for anything that can be captured in a list. Typically, these are non-numeric objects.

    Copyright (c) 2013-2020 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 21 mrt. 2017
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Summary

      Constructors 
      Constructor Description
      ExtendedDataTypeList​(java.lang.String id, java.lang.Class<T> type)
      Constructor setting the id.
    • Constructor Detail

      • ExtendedDataTypeList

        public ExtendedDataTypeList​(java.lang.String id,
                                    java.lang.Class<T> type)
        Constructor setting the id.
        Parameters:
        id - String; id
        type - Class<T>; type class
    • Method Detail

      • getOutputValue

        public T getOutputValue​(java.util.List<T> output,
                                int i)
                         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<T,​java.util.List<T>,​java.util.List<T>,​G extends GtuDataInterface>
        Parameters:
        output - O; output
        i - int; index of value to return
        Returns:
        the i'th output value
        Throws:
        SamplingException - when i is out of bounds.
      • getStorageValue

        public T getStorageValue​(java.util.List<T> output,
                                 int i)
                          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<T,​java.util.List<T>,​java.util.List<T>,​G extends GtuDataInterface>
        Parameters:
        output - S; storage
        i - int; index of value to return
        Returns:
        the i'th output value
        Throws:
        SamplingException - when i is out of bounds.
      • setValue

        public java.util.List<T> setValue​(java.util.List<T> storage,
                                          int index,
                                          T value)
        Returns an updated list/array/vector of the storage type, including a new value at given index.
        Specified by:
        setValue in class ExtendedDataType<T,​java.util.List<T>,​java.util.List<T>,​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
      • convert

        public java.util.List<T> convert​(java.util.List<T> storage,
                                         int size)
        Convert storage type to output type.
        Specified by:
        convert in class ExtendedDataType<T,​java.util.List<T>,​java.util.List<T>,​G extends GtuDataInterface>
        Parameters:
        storage - S; stored data
        size - int; size of trajectory
        Returns:
        converted output