Class AbstractHeadway

    • Constructor Detail

      • AbstractHeadway

        protected AbstractHeadway​(Length distance,
                                  Length overlapFront,
                                  Length overlap,
                                  Length overlapRear)
                           throws GTUException
        Construct a new Headway information object, for an object in front, behind, or in parallel with us.
        Parameters:
        distance - Length; the distance to the other object
        overlapFront - Length; the front-front distance to the other object
        overlap - Length; the 'center' overlap with the other object
        overlapRear - Length; the rear-rear distance to the other object
        Throws:
        GTUException - when id is null, or parameters are inconsistent
      • AbstractHeadway

        public AbstractHeadway​(Length distance)
                        throws GTUException
        Construct a new Headway information object, for an object ahead of us or behind us.
        Parameters:
        distance - the distance to the other object; if this constructor is used, distance cannot be null.
        Throws:
        GTUException - when id is null, or parameters are inconsistent
      • AbstractHeadway

        public AbstractHeadway​(Length overlapFront,
                               Length overlap,
                               Length overlapRear)
                        throws GTUException
        Construct a new Headway information object, for an object parallel with us.
        Parameters:
        overlapFront - the front-front distance to the other object; if this constructor is used, this value cannot be null.
        overlap - the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
        overlapRear - the rear-rear distance to the other object; if this constructor is used, this value cannot be null.
        Throws:
        GTUException - when id is null, or parameters are inconsistent
    • Method Detail

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

        public int hashCode()
        Overrides:
        hashCode in class Object