Class Desire

  • All Implemented Interfaces:
    Serializable

    public class Desire
    extends Object
    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-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 Apr 13, 2016
    Author:
    Wouter Schakel
    See Also:
    Serialized Form
    • Field Detail

      • ZERO

        public static final Desire ZERO
        Easy access and efficient zero desired.
    • Constructor Detail

      • 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​(Dimensionless left,
                      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 Detail

      • 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.
      • 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.