Class Desire
java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.Desire
- All Implemented Interfaces:
java.io.Serializable
public class Desire
extends java.lang.Object
implements java.io.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-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 Apr 13, 2016
- Author:
- Wouter Schakel
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Desire(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 Type Method Description double
get(LateralDirectionality dir)
Returns desire in the given direction.double
getLeft()
Returns lane change desire to left.double
getRight()
Returns lane change desire to right.boolean
leftIsLargerOrEqual()
Returns whether the left desire is larger than (or equal to) the right.java.lang.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
public final java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-