Class LmrsData
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.LmrsData
-
- All Implemented Interfaces:
DesireBased
,Synchronizable
public final class LmrsData extends Object implements DesireBased, Synchronizable
Keeps data for LMRS for a specific GTU.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 8 nov. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.tactical.Synchronizable
Synchronizable.State
-
-
Constructor Summary
Constructors Constructor Description LmrsData(Synchronization synchronization, Cooperation cooperation, GapAcceptance gapAcceptance, Tailgating tailgating)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
finalizeStep()
Remembers the leaders of the current time step (those forwarded to isNewLeader()) for the next time step.(package private) Cooperation
getCooperation()
Returns the cooperation.(package private) Map<Class<? extends Incentive>,Desire>
getDesireMap()
Returns the desire map.(package private) GapAcceptance
getGapAcceptance()
Return the gap-acceptance.Desire
getLatestDesire(Class<? extends Incentive> incentiveClass)
Returns the latest desire from the specified incentive.(package private) Synchronization
getSynchronization()
Returns the synchronization.Synchronizable.State
getSynchronizationState()
Returns the synchronization state.(package private) HeadwayGTU
getSyncVehicle(PerceptionCollectable<HeadwayGTU,LaneBasedGTU> adjLeaders)
Returns the gtu from the set that is the current sync vehicle, ornull
of there is no sync vehicle or it is not in the set.(package private) Tailgating
getTailgating()
Return the tail gating.(package private) boolean
isHumanLongitudinalControl()
(package private) boolean
isNewLeader(HeadwayGTU gtu)
Checks if the given leader is a new leader.(package private) boolean
isSyncVehicle(HeadwayGTU gtu)
Returns whether the provided gtu is the gtu that is synchronized to.void
setHumanLongitudinalControl(boolean humanLongitudinalControl)
(package private) void
setSynchronizationState(Synchronizable.State synchronizationState)
Sets the synchronization state.(package private) void
setSyncVehicle(HeadwayGTU gtu)
Remembers the gtu that is synchronized to.String
toString()
-
-
-
Constructor Detail
-
LmrsData
public LmrsData(Synchronization synchronization, Cooperation cooperation, GapAcceptance gapAcceptance, Tailgating tailgating)
- Parameters:
synchronization
- Synchronization; synchronizationcooperation
- Cooperation; cooperationgapAcceptance
- GapAcceptance; gap-acceptancetailgating
- Tailgating; tail gating
-
-
Method Detail
-
isNewLeader
boolean isNewLeader(HeadwayGTU gtu)
Checks if the given leader is a new leader.- Parameters:
gtu
- HeadwayGTU; gtu to check- Returns:
- whether the gtu is a new leader
-
finalizeStep
void finalizeStep()
Remembers the leaders of the current time step (those forwarded to isNewLeader()) for the next time step.
-
setSyncVehicle
void setSyncVehicle(HeadwayGTU gtu)
Remembers the gtu that is synchronized to.- Parameters:
gtu
- HeadwayGTU; gtu that is synchronized to
-
isSyncVehicle
boolean isSyncVehicle(HeadwayGTU gtu)
Returns whether the provided gtu is the gtu that is synchronized to.- Parameters:
gtu
- HeadwayGTU; gtu to inquiry- Returns:
- whether the provided gtu is the gtu that is synchronized to
-
getSyncVehicle
HeadwayGTU getSyncVehicle(PerceptionCollectable<HeadwayGTU,LaneBasedGTU> adjLeaders)
Returns the gtu from the set that is the current sync vehicle, ornull
of there is no sync vehicle or it is not in the set.- Parameters:
adjLeaders
- PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; leaders in adjacent lane- Returns:
- gtu from the set that is the current sync vehicle
-
getSynchronization
Synchronization getSynchronization()
Returns the synchronization.- Returns:
- synchronization
-
getCooperation
Cooperation getCooperation()
Returns the cooperation.- Returns:
- cooperation
-
getGapAcceptance
GapAcceptance getGapAcceptance()
Return the gap-acceptance.- Returns:
- gap-acceptance
-
getTailgating
Tailgating getTailgating()
Return the tail gating.- Returns:
- gap-acceptance
-
getLatestDesire
public Desire getLatestDesire(Class<? extends Incentive> incentiveClass)
Returns the latest desire from the specified incentive.- Specified by:
getLatestDesire
in interfaceDesireBased
- Parameters:
incentiveClass
- Class<? extends Incentive>; incentive class- Returns:
- latest desire from the specified incentive
-
getDesireMap
Map<Class<? extends Incentive>,Desire> getDesireMap()
Returns the desire map.- Returns:
- Map<Class<? extends Incentive>, Desire>; desire map
-
setSynchronizationState
void setSynchronizationState(Synchronizable.State synchronizationState)
Sets the synchronization state.- Parameters:
synchronizationState
- Synchronizable.State; synchronization step
-
getSynchronizationState
public Synchronizable.State getSynchronizationState()
Returns the synchronization state.- Specified by:
getSynchronizationState
in interfaceSynchronizable
- Returns:
- State; synchronization state
-
isHumanLongitudinalControl
boolean isHumanLongitudinalControl()
- Returns:
- humanLongitudinalControl.
-
setHumanLongitudinalControl
public void setHumanLongitudinalControl(boolean humanLongitudinalControl)
- Parameters:
humanLongitudinalControl
- boolean; set humanLongitudinalControl.
-
-