Package org.opentrafficsim.kpi.sampling
Class TrajectoryAcceptList
- java.lang.Object
-
- org.opentrafficsim.kpi.sampling.TrajectoryAcceptList
-
public class TrajectoryAcceptList extends java.lang.ObjectSet of trajectories to be accepted or rejected for a query.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 30 sep. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description TrajectoryAcceptList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptAll()Accept all trajectories.voidacceptTrajectory(Trajectory<?> trajectory)Accept given trajectory.voidacceptTrajectory(Trajectory<?> trajectory, boolean accept)Accept or reject given trajectory.voidaddTrajectory(Trajectory<?> trajectory, TrajectoryGroup trajectoryGroup)Adds aTrajectorywith theTrajectoryGroupit is from to the accept list.Trajectory<?>getTrajectory(int i)TrajectoryGroupgetTrajectoryGroup(int i)java.util.Iterator<TrajectoryGroup>getTrajectoryGroupIterator()java.util.Iterator<Trajectory<?>>getTrajectoryIterator()booleanisAccepted(Trajectory<?> trajectory)Returns whether the given trajectory is accepted or not.voidrejectAll()Reject all trajectories.voidrejectTrajectory(Trajectory<?> trajectory)Reject given trajectory.intsize()java.lang.StringtoString()
-
-
-
Method Detail
-
addTrajectory
public final void addTrajectory(Trajectory<?> trajectory, TrajectoryGroup trajectoryGroup)
Adds aTrajectorywith theTrajectoryGroupit is from to the accept list.- Parameters:
trajectory- Trajectory<?>;TrajectorytrajectorytrajectoryGroup- TrajectoryGroup;TrajectoryGrouptrajectories- Throws:
java.lang.IllegalArgumentException- if theTrajectoryis not within theTrajectoryGroupjava.lang.IllegalArgumentException- if theTrajectorybelongs to a different GTU than an earlier providedTrajectory
-
size
public final int size()
- Returns:
- number of trajectories
-
getTrajectory
public final Trajectory<?> getTrajectory(int i)
- Parameters:
i- int; number oftrajectoryto get- Returns:
- i'th
trajectory - Throws:
java.lang.IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())
-
getTrajectoryGroup
public final TrajectoryGroup getTrajectoryGroup(int i)
- Parameters:
i- int; number ofTrajectoryGroupto get- Returns:
- i'th
TrajectoryGroup - Throws:
java.lang.IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())
-
getTrajectoryIterator
public final java.util.Iterator<Trajectory<?>> getTrajectoryIterator()
- Returns:
- iterator over
trajectory's, does not allow removal
-
getTrajectoryGroupIterator
public final java.util.Iterator<TrajectoryGroup> getTrajectoryGroupIterator()
- Returns:
- iterator over
TrajectoryGroup's, does not allow removal
-
acceptTrajectory
public final void acceptTrajectory(Trajectory<?> trajectory)
Accept given trajectory.- Parameters:
trajectory- Trajectory<?>; trajectory to accept- Throws:
java.lang.IllegalArgumentException- if the trajectory is not part of the trajectory accept list
-
rejectTrajectory
public final void rejectTrajectory(Trajectory<?> trajectory)
Reject given trajectory.- Parameters:
trajectory- Trajectory<?>; trajectory to reject- Throws:
java.lang.IllegalArgumentException- if the trajectory is not part of the trajectory accept list
-
acceptTrajectory
public final void acceptTrajectory(Trajectory<?> trajectory, boolean accept)
Accept or reject given trajectory.- Parameters:
trajectory- Trajectory<?>; trajectory to accept or rejectaccept- boolean; whether to accept the trajectory- Throws:
java.lang.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
public final boolean isAccepted(Trajectory<?> trajectory)
Returns whether the given trajectory is accepted or not. If this was not determined, it isfalseby default.- Parameters:
trajectory- Trajectory<?>; trajectory- Returns:
- whether the given trajectory is accepted or not
- Throws:
java.lang.IllegalArgumentException- if the trajectory is not part of the trajectory accept list
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-