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

public record Desire(double left, double right) extends Record implements 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

    Fields
    Modifier and Type
    Field
    Description
    static final Desire
    Easy access and efficient zero desired.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Desire(double left, double right)
    Constructor which sets the supplied desire.
    Desire(org.djunits.value.vdouble.scalar.Dimensionless left, org.djunits.value.vdouble.scalar.Dimensionless right)
    Constructor which sets the supplied desire.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final double
    Returns desire in the given direction.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the left record component.
    final boolean
    Returns whether the left desire is larger than (or equal to) the right.
    double
    Returns the value of the right record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ZERO

      public static final Desire 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

      public final double get(LateralDirectionality dir)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • left

      public double left()
      Returns the value of the left record component.
      Returns:
      the value of the left record component
    • right

      public double right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component