Class Desire
java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.Desire
- All Implemented Interfaces:
Serializable
Reflects the level of lane change desire a driver experiences in both the left and right direction. This may be either total
desire, or only for a single lane change incentive. Desire is defined as ranging from 0 to 1, where 0 means no desire and 1
means full desire. Values above 1 are not valid and should be limited to 1. Values below 0 are allowed and reflect that a
lane change is undesired (which is different from not desired).
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDesire
(double left, double right) Constructor which sets the supplied desire.Desire
(Dimensionless left, Dimensionless right) Constructor which sets the supplied desire. -
Method Summary
Modifier and TypeMethodDescriptionfinal double
get
(LateralDirectionality dir) Returns desire in the given direction.final double
getLeft()
Returns lane change desire to left.final double
getRight()
Returns lane change desire to right.final boolean
Returns whether the left desire is larger than (or equal to) the right.final String
toString()
-
Field Details
-
ZERO
Easy access and efficient zero desired.
-
-
Constructor Details
-
Desire
public Desire(double left, double right) Constructor which sets the supplied desire. Desire is limited to a maximum of 1.- Parameters:
left
- double; Left desire.right
- double; Right desire.
-
Desire
Constructor which sets the supplied desire. Desire is limited to a maximum of 1.- Parameters:
left
- Dimensionless; Left desire.right
- Dimensionless; Right desire.
-
-
Method Details
-
get
Returns desire in the given direction.- Parameters:
dir
- LateralDirectionality; Direction for the desire to return.- Returns:
- Desire in the given direction.
-
getLeft
public final double getLeft()Returns lane change desire to left.- Returns:
- Lane change desire to left.
-
getRight
public final double getRight()Returns lane change desire to right.- Returns:
- Lane change desire to right.
-
leftIsLargerOrEqual
public final boolean leftIsLargerOrEqual()Returns whether the left desire is larger than (or equal to) the right.- Returns:
- Returns whether the left desire is larger than (or equal to) the right.
-
toString
-