Class ExtendedDataTypeList<T,G extends GtuDataInterface>
- java.lang.Object
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataType<T,List<T>,List<T>,G>
-
- org.opentrafficsim.kpi.sampling.data.ExtendedDataTypeList<T,G>
-
- Type Parameters:
T- type of valueG- gtu data type
- All Implemented Interfaces:
Identifiable
- Direct Known Subclasses:
ExtendedDataTypeString
public abstract class ExtendedDataTypeList<T,G extends GtuDataInterface> extends ExtendedDataType<T,List<T>,List<T>,G>
Extended data type for anything that can be captured in a list. Typically, these are non-numeric objects.Copyright (c) 2013-2022 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(String id, Class<T> type)Constructor setting the id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<T>convert(List<T> storage, int size)Convert storage type to output type.TgetOutputValue(List<T> output, int i)Returns a specific output value.TgetStorageValue(List<T> output, int i)Returns a specific storage value.List<T>initializeStorage()Returns an initial storage object.List<T>setValue(List<T> storage, int index, T value)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
equals, formatValue, getId, getType, getValue, hashCode, interpolate, parseValue
-
-
-
-
Method Detail
-
getOutputValue
public T getOutputValue(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:
getOutputValuein classExtendedDataType<T,List<T>,List<T>,G extends GtuDataInterface>- Parameters:
output- O; outputi- int; index of value to return- Returns:
- the i'th output value
- Throws:
SamplingException- wheniis out of bounds.
-
getStorageValue
public T getStorageValue(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:
getStorageValuein classExtendedDataType<T,List<T>,List<T>,G extends GtuDataInterface>- Parameters:
output- S; storagei- int; index of value to return- Returns:
- the i'th output value
- Throws:
SamplingException- wheniis out of bounds.
-
setValue
public List<T> setValue(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:
setValuein classExtendedDataType<T,List<T>,List<T>,G extends GtuDataInterface>- Parameters:
storage- S; storageindex- int; index to store next valuevalue- T; value to add- Returns:
- updated list/array/vector of the storage type, including a new value at given index
-
initializeStorage
public List<T> initializeStorage()
Returns an initial storage object.- Specified by:
initializeStoragein classExtendedDataType<T,List<T>,List<T>,G extends GtuDataInterface>- Returns:
- initial storage object.
-
-