Package org.opentrafficsim.kpi.sampling
Class TrajectoryAcceptList
java.lang.Object
org.opentrafficsim.kpi.sampling.TrajectoryAcceptList
Set of trajectories to be accepted or rejected for a query. All the trajectories pertain to one GTU. A
Query
may
reject or accept all, or a specific subset, based on the specific needs of different FilterDataType
s.
Copyright (c) 2013-2024 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
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Accept all trajectories.final void
acceptTrajectory
(Trajectory<?> trajectory) Accept given trajectory.final void
acceptTrajectory
(Trajectory<?> trajectory, boolean accept) Accept or reject given trajectory.final void
addTrajectory
(Trajectory<?> trajectory, TrajectoryGroup<?> trajectoryGroup) Adds aTrajectory
with theTrajectoryGroup
it is from to the accept list.final Trajectory<?>
getTrajectory
(int i) Returns trajectory by index.final TrajectoryGroup<?>
getTrajectoryGroup
(int i) Returns a trajectory group by index.final Iterator<TrajectoryGroup<?>>
Returns an iterator over the trajectory groups.final Iterator<Trajectory<?>>
Returns an iterator over the trajectories.final boolean
isAccepted
(Trajectory<?> trajectory) Returns whether the given trajectory is accepted or not.final void
Reject all trajectories.final void
rejectTrajectory
(Trajectory<?> trajectory) Reject given trajectory.final int
size()
Returns the number of trajectories.final String
toString()
-
Constructor Details
-
TrajectoryAcceptList
public TrajectoryAcceptList()
-
-
Method Details
-
addTrajectory
Adds aTrajectory
with theTrajectoryGroup
it is from to the accept list. By default it is registered to be not accepted for a query.- Parameters:
trajectory
- Trajectory<?>;Trajectory
trajectorytrajectoryGroup
- <TrajectoryGroup>;TrajectoryGroup
trajectories- Throws:
IllegalArgumentException
- if theTrajectory
is not within theTrajectoryGroup
IllegalArgumentException
- if theTrajectory
belongs to a different GTU than an earlier providedTrajectory
-
size
public final int size()Returns the number of trajectories.- Returns:
- number of trajectories
-
getTrajectory
Returns trajectory by index.- Parameters:
i
- int; number oftrajectory
to get- Returns:
- i'th
trajectory
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)
-
getTrajectoryGroup
Returns a trajectory group by index.- Parameters:
i
- int; number ofTrajectoryGroup
to get- Returns:
- i'th
TrajectoryGroup
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)
-
getTrajectoryIterator
Returns an iterator over the trajectories.- Returns:
- iterator over
trajectory
's, does not allow removal
-
getTrajectoryGroupIterator
Returns an iterator over the trajectory groups.- Returns:
- iterator over
TrajectoryGroup
's, does not allow removal
-
acceptTrajectory
Accept given trajectory.- Parameters:
trajectory
- Trajectory<?>; trajectory to accept- Throws:
IllegalArgumentException
- if the trajectory is not part of the trajectory accept list
-
rejectTrajectory
Reject given trajectory.- Parameters:
trajectory
- Trajectory<?>; trajectory to reject- Throws:
IllegalArgumentException
- if the trajectory is not part of the trajectory accept list
-
acceptTrajectory
Accept or reject given trajectory.- Parameters:
trajectory
- Trajectory<?>; trajectory to accept or rejectaccept
- boolean; whether to accept the trajectory- Throws:
IllegalArgumentException
- if the trajectory is not part of the trajectory accept list
-
acceptAll
public final void acceptAll()Accept all trajectories. -
rejectAll
public final void rejectAll()Reject all trajectories. -
isAccepted
Returns whether the given trajectory is accepted or not.- Parameters:
trajectory
- Trajectory<?>; trajectory- Returns:
- whether the given trajectory is accepted or not
- Throws:
IllegalArgumentException
- if the trajectory is not part of the trajectory accept list
-
toString
-