class TrajectoryPlot.FixedSampleRateTrajectory extends Object implements TrajectoryPlot.Trajectory, Serializable
Constructor and Description |
---|
FixedSampleRateTrajectory(String id)
Construct a FixedSampleRateTrajectory.
|
Modifier and Type | Method and Description |
---|---|
void |
addSample(LaneBasedGTU gtu,
Lane lane,
double position)
Add a trajectory segment sample and update the currentEndTime and currentEndPosition.
|
org.djunits.value.vdouble.scalar.Time |
getCurrentEndTime()
Retrieve the time of the last stored event.
|
double |
getDistance(int item)
Return the distance of the Nth stored sample.
|
String |
getId()
Retrieve the id of this Trajectory.
|
Double |
getLastPosition()
Retrieve the last recorded non-null position, or null if no non-null positions have been recorded yet.
|
double |
getTime(int item)
Return the time of the Nth stored sample.
|
int |
size()
Retrieve the number of stored samples in this Trajectory.
|
String |
toString() |
FixedSampleRateTrajectory(String id)
id
- String; id of the new Trajectory (id of the GTU)public final org.djunits.value.vdouble.scalar.Time getCurrentEndTime()
getCurrentEndTime
in interface TrajectoryPlot.Trajectory
public final Double getLastPosition()
getLastPosition
in interface TrajectoryPlot.Trajectory
public final String getId()
getId
in interface TrajectoryPlot.Trajectory
public final void addSample(LaneBasedGTU gtu, Lane lane, double position) throws org.opentrafficsim.core.network.NetworkException, org.opentrafficsim.core.gtu.GTUException
addSample
in interface TrajectoryPlot.Trajectory
gtu
- AbstractLaneBasedGTU; the GTU whose currently committed trajectory segment must be addedlane
- Lane; the Lane that the positionOffset is valid forposition
- Double; distance in meters from the start of the trajectoryorg.opentrafficsim.core.network.NetworkException
- when car is not on lane anymoreorg.opentrafficsim.core.gtu.GTUException
- on problems obtaining data from the GTUpublic int size()
size
in interface TrajectoryPlot.Trajectory
public double getTime(int item)
getTime
in interface TrajectoryPlot.Trajectory
item
- int; the index of the samplepublic double getDistance(int item)
TrajectoryPlot.Trajectory
getDistance
in interface TrajectoryPlot.Trajectory
item
- Integer; the sample numberCopyright © 2014–2016 Delft University of Technology. All rights reserved.