Package org.opentrafficsim.kpi.sampling
Class TrajectoryGroup<G extends GtuDataInterface>
java.lang.Object
org.opentrafficsim.kpi.sampling.TrajectoryGroup<G>
- Type Parameters:
G
- gtu data type
- All Implemented Interfaces:
java.lang.Iterable<Trajectory<G>>
public class TrajectoryGroup<G extends GtuDataInterface> extends java.lang.Object implements java.lang.Iterable<Trajectory<G>>
Contains all trajectories pertaining to a certain space-time region.
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.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors Constructor Description TrajectoryGroup(Time startTime, Length startPosition, Length endPosition, KpiLaneDirection laneDirection)
TrajectoryGroup(Time startTime, KpiLaneDirection laneDirection)
Constructor without length specification. -
Method Summary
Modifier and Type Method Description void
addTrajectory(Trajectory<G> trajectory)
Add trajectory.boolean
contains(Trajectory<?> trajectory)
Whether thisTrajectoryGroup
holds the given trajectory.boolean
equals(java.lang.Object obj)
KpiLaneDirection
getLaneDirection()
Returns the lane direction.Length
getLength()
Time
getStartTime()
java.util.List<Trajectory<G>>
getTrajectories()
Returns a list of trajectories.TrajectoryGroup<G>
getTrajectoryGroup(Length x0, Length x1)
Returns trajectory group between two locations.TrajectoryGroup<G>
getTrajectoryGroup(Length x0, Length x1, Time t0, Time t1)
Returns trajectory group between two locations and between two times.TrajectoryGroup<G>
getTrajectoryGroup(Time t0, Time t1)
Returns trajectory group between two times.int
hashCode()
java.util.Iterator<Trajectory<G>>
iterator()
int
size()
Returns the number of trajectories in this group.java.lang.String
toString()
-
Constructor Details
-
TrajectoryGroup
Constructor without length specification. The complete lane will be used.- Parameters:
startTime
- Time; start time of trajectorieslaneDirection
- KpiLaneDirection; lane direction
-
TrajectoryGroup
public TrajectoryGroup(Time startTime, Length startPosition, Length endPosition, KpiLaneDirection laneDirection)- Parameters:
startTime
- Time; start time of trajectory groupstartPosition
- Length; start positionendPosition
- Length; end positionlaneDirection
- KpiLaneDirection; lane direction
-
-
Method Details
-
addTrajectory
Add trajectory.- Parameters:
trajectory
- Trajectory<G>; trajectory to add
-
getStartTime
- Returns:
- startTime.
-
getLength
- Returns:
- length.
-
contains
Whether thisTrajectoryGroup
holds the given trajectory. Note that this is false if the given trajectory is derived from a trajectory in thisTrajectoryGroup
.- Parameters:
trajectory
- Trajectory<?>; trajectory- Returns:
- whether this
TrajectoryGroup
holds the given trajectory.
-
size
public final int size()Returns the number of trajectories in this group.- Returns:
- number of trajectories in this group
-
getTrajectories
Returns a list of trajectories.- Returns:
- list of trajectories
-
getTrajectoryGroup
Returns trajectory group between two locations.- Parameters:
x0
- Length; start lengthx1
- Length; end length- Returns:
- list of trajectories
-
getTrajectoryGroup
Returns trajectory group between two times.- Parameters:
t0
- Time; start timet1
- Time; end time- Returns:
- list of trajectories
-
getTrajectoryGroup
Returns trajectory group between two locations and between two times.- Parameters:
x0
- Length; start lengthx1
- Length; end lengtht0
- Time; start timet1
- Time; end time- Returns:
- list of trajectories
-
getLaneDirection
Returns the lane direction.- Returns:
- lane direction
-
hashCode
public final int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
toString
public final java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
iterator
- Specified by:
iterator
in interfacejava.lang.Iterable<G extends GtuDataInterface>
-