Record Class Desire
java.lang.Object
java.lang.Record
org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.Desire
- Record Components:
left
- double; Left desire.right
- double; Right 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-2024 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final double
get
(LateralDirectionality dir) Returns desire in the given direction.final int
hashCode()
Returns a hash code value for this object.double
left()
Returns the value of theleft
record component.final boolean
Returns whether the left desire is larger than (or equal to) the right.double
right()
Returns the value of theright
record component.final String
toString()
Returns a string representation of this record class.
-
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
public Desire(org.djunits.value.vdouble.scalar.Dimensionless left, org.djunits.value.vdouble.scalar.Dimensionless right) 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.
-
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
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
left
public double left()Returns the value of theleft
record component.- Returns:
- the value of the
left
record component
-
right
public double right()Returns the value of theright
record component.- Returns:
- the value of the
right
record component
-