G - gtu data typepublic final class Trajectory<G extends GtuDataInterface> extends Object
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
| Constructor and Description |
|---|
Trajectory(GtuDataInterface gtu,
MetaData metaData,
Set<ExtendedDataType<?,?,?,G>> extendedData,
KpiLaneDirection kpiLaneDirection) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Length position,
Speed speed,
Acceleration acceleration,
Time time)
Adds values of position, speed, acceleration and time.
|
void |
add(Length position,
Speed speed,
Acceleration acceleration,
Time time,
G gtu)
Adds values of position, speed, acceleration and time.
|
boolean |
contains(ExtendedDataType<?,?,?,?> extendedDataType) |
boolean |
contains(MetaDataType<?> metaDataType) |
boolean |
equals(Object obj) |
float[] |
getA() |
float |
getA(int index)
Returns
a value of a single sample. |
FloatAccelerationVector |
getAcceleration() |
<O,S> O |
getExtendedData(ExtendedDataType<?,O,S,?> extendedDataType) |
<T,S> T |
getExtendedData(ExtendedDataType<T,?,S,?> extendedDataType,
int index)
Returns extended data type value of a single sample.
|
Set<ExtendedDataType<?,?,?,G>> |
getExtendedDataTypes()
Returns the included extended data types.
|
String |
getGtuId() |
<T> T |
getMetaData(MetaDataType<T> metaDataType) |
Set<MetaDataType<?>> |
getMetaDataTypes()
Returns the included meta data types.
|
FloatLengthVector |
getPosition() |
FloatSpeedVector |
getSpeed() |
float[] |
getT() |
float |
getT(int index)
Returns
t value of a single sample. |
FloatTimeVector |
getTime() |
Duration |
getTotalDuration() |
Length |
getTotalLength() |
float[] |
getV() |
float |
getV(int index)
Returns
v value of a single sample. |
float[] |
getX() |
float |
getX(int index)
Returns
x value of a single sample. |
int |
hashCode() |
int |
size() |
Trajectory<G> |
subSet(Length startPosition,
Length endPosition)
Copies the trajectory but with a subset of the data.
|
Trajectory<G> |
subSet(Length startPosition,
Length endPosition,
Time startTime,
Time endTime)
Copies the trajectory but with a subset of the data.
|
Trajectory<G> |
subSet(Time startTime,
Time endTime)
Copies the trajectory but with a subset of the data.
|
String |
toString() |
public Trajectory(GtuDataInterface gtu, MetaData metaData, Set<ExtendedDataType<?,?,?,G>> extendedData, KpiLaneDirection kpiLaneDirection)
gtu - GTU of this trajectory, only the id is stored.metaData - meta dataextendedData - types of extended datakpiLaneDirection - direction of travelpublic void add(Length position, Speed speed, Acceleration acceleration, Time time)
position - position is relative to the start of the lane in the direction of the design line, i.e. irrespective of
the travel direction, also when trajectories have been truncated at a position x > 0speed - speedacceleration - accelerationtime - timepublic void add(Length position, Speed speed, Acceleration acceleration, Time time, G gtu)
position - position is relative to the start of the lane in the direction of the design line, i.e. irrespective of
the travel direction, also when trajectories have been truncated at a position x > 0speed - speedacceleration - accelerationtime - timegtu - gtu to add extended data forpublic int size()
public String getGtuId()
public float[] getX()
public float[] getV()
public float[] getA()
public float[] getT()
public float getX(int index)
throws SamplingException
x value of a single sample.index - indexx value of a single sampleSamplingException - if the index is out of boundspublic float getV(int index)
throws SamplingException
v value of a single sample.index - indexv value of a single sampleSamplingException - if the index is out of boundspublic float getA(int index)
throws SamplingException
a value of a single sample.index - indexa value of a single sampleSamplingException - if the index is out of boundspublic float getT(int index)
throws SamplingException
t value of a single sample.index - indext value of a single sampleSamplingException - if the index is out of boundspublic <T,S> T getExtendedData(ExtendedDataType<T,?,S,?> extendedDataType, int index) throws SamplingException
T - scalar type of extended data typeS - storage type of extended data typeextendedDataType - data type from which to retrieve the dataindex - index for which to retrieve the dataSamplingException - if the index is out of boundspublic FloatLengthVector getPosition()
public FloatSpeedVector getSpeed()
public FloatAccelerationVector getAcceleration()
public FloatTimeVector getTime()
public Length getTotalLength()
IllegalStateException - if trajectory is emptypublic Duration getTotalDuration()
IllegalStateException - if trajectory is emptypublic boolean contains(MetaDataType<?> metaDataType)
metaDataType - meta data typepublic <T> T getMetaData(MetaDataType<T> metaDataType)
T - class of meta datametaDataType - meta data typepublic Set<MetaDataType<?>> getMetaDataTypes()
public boolean contains(ExtendedDataType<?,?,?,?> extendedDataType)
extendedDataType - extended data typepublic <O,S> O getExtendedData(ExtendedDataType<?,O,S,?> extendedDataType) throws SamplingException
O - output typeS - storage typeextendedDataType - extended data type to returnSamplingException - if the extended data type is not in the trajectorypublic Set<ExtendedDataType<?,?,?,G>> getExtendedDataTypes()
public Trajectory<G> subSet(Length startPosition, Length endPosition)
startPosition - start positionendPosition - end positionNullPointerException - if an input is nullIllegalArgumentException - of minLength is smaller than maxLengthpublic Trajectory<G> subSet(Time startTime, Time endTime)
startTime - start timeendTime - end timeNullPointerException - if an input is nullIllegalArgumentException - of minTime is smaller than maxTimepublic Trajectory<G> subSet(Length startPosition, Length endPosition, Time startTime, Time endTime)
startPosition - start positionendPosition - end positionstartTime - start timeendTime - end timeNullPointerException - if an input is nullIllegalArgumentException - of minLength/Time is smaller than maxLength/TimeCopyright © 2014–2018 Delft University of Technology. All rights reserved.