Class AnticipationSpeed
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.perception.categories.AnticipationSpeed
-
- All Implemented Interfaces:
PerceptionCollectable.PerceptionCollector<AnticipationSpeed.SpeedSet,LaneBasedGTU,AnticipationSpeed.SpeedSet>
public class AnticipationSpeed extends Object implements PerceptionCollectable.PerceptionCollector<AnticipationSpeed.SpeedSet,LaneBasedGTU,AnticipationSpeed.SpeedSet>
Collector of leaders which derives an set of anticipation speeds from a lane. This includes all GTUs on the lane (current), all GTUs indicating left (left) and all GTUs indicating right (right).Copyright (c) 2013-2022 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 2 mrt. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AnticipationSpeed.SpeedSet
Class to contain info from 1 lane, regarding 3 lanes.
-
Constructor Summary
Constructors Constructor Description AnticipationSpeed(Speed desiredSpeed, Length lookAhead, RelativeLane lane)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) double
anticipateSingle(GTU gtu, Length distance)
Anticipate a single leader by possibly lowering the anticipation speed.PerceptionCollectable.PerceptionAccumulator<LaneBasedGTU,AnticipationSpeed.SpeedSet>
getAccumulator()
Returns the accumulator.PerceptionCollectable.PerceptionFinalizer<AnticipationSpeed.SpeedSet,AnticipationSpeed.SpeedSet>
getFinalizer()
Returns the finalizer.Supplier<AnticipationSpeed.SpeedSet>
getIdentity()
Returns the identity value, the initial intermediate value.
-
-
-
Constructor Detail
-
AnticipationSpeed
public AnticipationSpeed(Speed desiredSpeed, Length lookAhead, RelativeLane lane)
Constructor.- Parameters:
desiredSpeed
- Speed; desired speedlookAhead
- Length; look-ahead distancelane
- RelativeLane; lane
-
-
Method Detail
-
getIdentity
public Supplier<AnticipationSpeed.SpeedSet> getIdentity()
Returns the identity value, the initial intermediate value.- Specified by:
getIdentity
in interfacePerceptionCollectable.PerceptionCollector<AnticipationSpeed.SpeedSet,LaneBasedGTU,AnticipationSpeed.SpeedSet>
- Returns:
- I; identity value, the initial intermediate value
-
getAccumulator
public PerceptionCollectable.PerceptionAccumulator<LaneBasedGTU,AnticipationSpeed.SpeedSet> getAccumulator()
Returns the accumulator.- Specified by:
getAccumulator
in interfacePerceptionCollectable.PerceptionCollector<AnticipationSpeed.SpeedSet,LaneBasedGTU,AnticipationSpeed.SpeedSet>
- Returns:
- PerceptionAccumulator; accumulator
-
anticipateSingle
final double anticipateSingle(GTU gtu, Length distance)
Anticipate a single leader by possibly lowering the anticipation speed.- Parameters:
gtu
- GTU; GTUdistance
- Length; distance to GTU- Returns:
- possibly lowered anticipation speed
-
getFinalizer
public PerceptionCollectable.PerceptionFinalizer<AnticipationSpeed.SpeedSet,AnticipationSpeed.SpeedSet> getFinalizer()
Returns the finalizer.- Specified by:
getFinalizer
in interfacePerceptionCollectable.PerceptionCollector<AnticipationSpeed.SpeedSet,LaneBasedGTU,AnticipationSpeed.SpeedSet>
- Returns:
- PerceptionFinalizer; finalizer
-
-