Class HeadwayDistance

  • All Implemented Interfaces:
    Serializable, Comparable<Headway>, Identifiable, PerceivedObject, Headway

    public class HeadwayDistance
    extends Object
    implements Headway
    Container for a reference to information about a headway with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop. The reason for storing a speed of zero at the end of a maximum headway is that we did not check the conditions beyond that point. A GTU or lane drop could be right behind the last point we checked.

    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: 1368 $, $LastChangedDate: 2015-09-02 00:20:20 +0200 (Wed, 02 Sep 2015) $, by $Author: averbraeck $, initial version 11 feb. 2015
    Author:
    Alexander Verbraeck, Peter Knoppers
    See Also:
    Serialized Form
    • Constructor Detail

      • HeadwayDistance

        public HeadwayDistance​(double distance)
        Construct a new Headway information object with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop.
        Parameters:
        distance - double; the distance that needs to be stored.
      • HeadwayDistance

        public HeadwayDistance​(Length distance)
        Construct a new Headway information object with just a distance, without any further information about the object; it assumes a speed of 0 at the headway, so it also good to store information about a lane drop.
        Parameters:
        distance - Length; the distance that needs to be stored.
    • Method Detail

      • getId

        public final String getId()
        Specified by:
        getId in interface Headway
        Specified by:
        getId in interface Identifiable
        Returns:
        String; the id of the other object for comparison purposes, cannot be null.
      • getLength

        public final Length getLength()
        Specified by:
        getLength in interface Headway
        Returns:
        Length; the length of the other object; can be null if unknown.
      • getSpeed

        public final Speed getSpeed()
        Specified by:
        getSpeed in interface Headway
        Returns:
        Speed; the (perceived) speed of the other object; can be null if unknown.
      • getDistance

        public final Length getDistance()
        Retrieve the strongly typed distance to the other object.
        Specified by:
        getDistance in interface Headway
        Returns:
        Length; the distance to the object, return value null indicates that the other object is parallel to the reference object
      • getObjectType

        public final Headway.ObjectType getObjectType()
        Specified by:
        getObjectType in interface Headway
        Returns:
        Length; the (perceived) object Type, can be null if no object type unknown.
      • getAcceleration

        public final Acceleration getAcceleration()
        Specified by:
        getAcceleration in interface Headway
        Returns:
        Acceleration; acceleration the (perceived) acceleration of the other object; can be null if unknown.
      • getOverlapFront

        public final Length getOverlapFront()
        Return the (perceived) front overlap to the other object. This value should be null if there is no overlap. In the figure for two GTUs below, it is distance c, positive for GTU1, negative for GTU2.
         ----------
         |  GTU 1 |          ----->
         ----------
              ---------------
              |    GTU 2    |          ----->
              ---------------
         | a  | b |     c   |
         
        Specified by:
        getOverlapFront in interface Headway
        Returns:
        Length; the (perceived) front overlap to the other object or null if there is no overlap.
      • getOverlapRear

        public final Length getOverlapRear()
        Return the (perceived) rear overlap to the other object. This value should be null if there is no overlap.In the figure below for two GTUs, it is distance a, positive for GTU1, negative for GTU2.
         ----------
         |  GTU 1 |          ----->
         ----------
              ---------------
              |    GTU 2    |          ----->
              ---------------
         | a  | b |     c   |
         
        Specified by:
        getOverlapRear in interface Headway
        Returns:
        Length; the (perceived) rear overlap to the other object or null if there is no overlap.
      • getOverlap

        public final Length getOverlap()
        Return the (perceived) overlap with the other object. This value should be null if there is no overlap. In the figure below for two GTUs, it is distance b, positive for GTU1 and GTU2.
         ----------
         |  GTU 1 |          ----->
         ----------
              ---------------
              |    GTU 2    |          ----->
              ---------------
         | a  | b |     c   |
         
        Specified by:
        getOverlap in interface Headway
        Returns:
        Length, the (perceived) overlap with the other object or null if there is no overlap.
      • isAhead

        public final boolean isAhead()
        Specified by:
        isAhead in interface Headway
        Returns:
        whether the other object is in front of the reference object.
      • isBehind

        public final boolean isBehind()
        Specified by:
        isBehind in interface Headway
        Returns:
        whether the other object is behind the reference object.
      • isParallel

        public final boolean isParallel()
        Specified by:
        isParallel in interface Headway
        Returns:
        whether the other object is parallel the reference object.