G - gtu data typepublic final class Trajectory<G extends GtuDataInterface> extends Object
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.
| Modifier and Type | Class and Description |
|---|---|
class |
Trajectory.Boundary
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.
|
static class |
Trajectory.SpaceTimeView
Space-time view of a trajectory.
|
| 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.
|
int |
binarySearchT(float time)
Returns the last index with a time smaller than or equal to the given time.
|
int |
binarySearchX(float position)
Returns the last index with a position smaller than or equal to the given position.
|
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() |
Acceleration |
getAccelerationAtPosition(Length position)
Returns an interpolated acceleration at the given position.
|
Acceleration |
getAccelerationAtTime(Time time)
Returns an interpolated acceleration at the given time.
|
<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() |
Length |
getPositionAtTime(Time time)
Returns an interpolated position at the given time.
|
Trajectory.SpaceTimeView |
getSpaceTimeView(Length startPosition,
Length endPosition,
Time startTime,
Time endTime)
Returns a space-time view of this trajectory.
|
FloatSpeedVector |
getSpeed() |
Speed |
getSpeedAtPosition(Length position)
Returns an interpolated speed at the given position.
|
Speed |
getSpeedAtTime(Time time)
Returns an interpolated speed at the given time.
|
float[] |
getT() |
float |
getT(int index)
Returns
t value of a single sample. |
FloatTimeVector |
getTime() |
Time |
getTimeAtPosition(Length position)
Returns an interpolated time at the given position.
|
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 - GtuDataInterface; GTU of this trajectory, only the id is stored.metaData - MetaData; meta dataextendedData - Set<ExtendedDataType<?,?,?,G>>; types of extended datakpiLaneDirection - KpiLaneDirection; direction of travelpublic void add(Length position, Speed speed, Acceleration acceleration, Time time)
position - Length; 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 - Speed; speedacceleration - Acceleration; accelerationtime - Time; timepublic void add(Length position, Speed speed, Acceleration acceleration, Time time, G gtu)
position - Length; 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 - Speed; speedacceleration - Acceleration; accelerationtime - Time; timegtu - G; gtu to add extended data forpublic int size()
public String getGtuId()
public float[] getX()
public float[] getV()
public float[] getA()
public float[] getT()
public int binarySearchX(float position)
position - float; positionpublic int binarySearchT(float time)
time - float; timepublic float getX(int index)
throws SamplingException
x value of a single sample.index - int; 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 - int; 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 - int; 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 - int; 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 - ExtendedDataType<T,?,S,?>; data type from which to retrieve the dataindex - int; 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 - MetaDataType<?>; meta data typepublic <T> T getMetaData(MetaDataType<T> metaDataType)
T - class of meta datametaDataType - MetaDataType<T>; meta data typepublic Set<MetaDataType<?>> getMetaDataTypes()
public boolean contains(ExtendedDataType<?,?,?,?> extendedDataType)
extendedDataType - ExtendedDataType<?,?,?,?>; extended data typepublic <O,S> O getExtendedData(ExtendedDataType<?,O,S,?> extendedDataType) throws SamplingException
O - output typeS - storage typeextendedDataType - ExtendedDataType<?,O,S,?>; extended data type to returnSamplingException - if the extended data type is not in the trajectorypublic Set<ExtendedDataType<?,?,?,G>> getExtendedDataTypes()
public Trajectory.SpaceTimeView getSpaceTimeView(Length startPosition, Length endPosition, Time startTime, Time endTime)
subSet() as no trajectory is
copied. The limitation is that only distance and time (and mean speed) in the space-time view can be obtained.startPosition - Length; start positionendPosition - Length; end positionstartTime - Time; start timeendTime - Time; end timepublic Trajectory<G> subSet(Length startPosition, Length endPosition)
startPosition - Length; start positionendPosition - Length; end positionNullPointerException - if an input is nullIllegalArgumentException - of minLength is smaller than maxLengthpublic Trajectory<G> subSet(Time startTime, Time endTime)
startTime - Time; start timeendTime - Time; 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 - Length; start positionendPosition - Length; end positionstartTime - Time; start timeendTime - Time; end timeNullPointerException - if an input is nullIllegalArgumentException - of minLength/Time is smaller than maxLength/Timepublic Time getTimeAtPosition(Length position)
position - Length; positionpublic Speed getSpeedAtPosition(Length position)
position - Length; positionpublic Acceleration getAccelerationAtPosition(Length position)
position - Length; positionpublic Length getPositionAtTime(Time time)
time - Time; timepublic Speed getSpeedAtTime(Time time)
time - Time; timepublic Acceleration getAccelerationAtTime(Time time)
time - Time; timeCopyright © 2014–2019 Delft University of Technology. All rights reserved.