Class DirectNeighborsPerception

    • Constructor Detail

      • DirectNeighborsPerception

        public DirectNeighborsPerception​(LanePerception perception,
                                         HeadwayGtuType headwayGtuType)
        Parameters:
        perception - LanePerception; perception
        headwayGtuType - HeadwayGtuType; type of headway gtu to generate
      • DirectNeighborsPerception

        public DirectNeighborsPerception​(LanePerception perception,
                                         HeadwayGtuType headwayGtuType,
                                         HeadwayGtuType headwayGtuTypeGap)
        Parameters:
        perception - LanePerception; perception
        headwayGtuType - HeadwayGtuType; type of headway gtu to generate
        headwayGtuTypeGap - HeadwayGtuType; type of headway gtu to assess gaps
    • Method Detail

      • getFirstLeaders

        public final java.util.SortedSet<HeadwayGTU> getFirstLeaders​(LateralDirectionality lat)
                                                              throws ParameterException,
                                                                     java.lang.NullPointerException,
                                                                     java.lang.IllegalArgumentException
        Set of leaders on a lane, which is usually 0 or 1, but possibly more in case of a downstream split with no intermediate GTU. This is shown below. Suppose A needs to go straight. If A considers a lane change to the left, both GTUs B (who's tail ~ is still on the straight lane) and C need to be considered for whether it's safe to do so. In case of multiple splits close to one another, the returned set may contain even more than 2 leaders. Leaders are sorted by headway value.
                  | |
         _________/B/_____
         _ _?_ _ _~_ _C_ _
         _ _A_ _ _ _ _ _ _
         _________________
         
        Only vehicles who's rear is beyond the own front are considered, no alongside vehicles.

        Specified by:
        getFirstLeaders in interface NeighborsPerception
        Parameters:
        lat - LateralDirectionality; LEFT or RIGHT
        Returns:
        list of followers on a lane
        Throws:
        ParameterException - if parameter is not defined
        java.lang.NullPointerException - if lat is null
        java.lang.IllegalArgumentException - if lat is NONE
      • getFirstFollowers

        public final java.util.SortedSet<HeadwayGTU> getFirstFollowers​(LateralDirectionality lat)
                                                                throws ParameterException,
                                                                       java.lang.NullPointerException,
                                                                       java.lang.IllegalArgumentException
        Set of followers on a lane, which is usually 0 or 1, but possibly more in case of an upstream merge with no intermediate GTU. This is shown below. If A considers a lane change to the left, both GTUs B and C need to be considered for whether it's safe to do so. In case of multiple merges close to one another, the returned set may contain even more than 2 followers. Followers are sorted by tailway value.
                | |
                |C| 
         ________\ \______
         _ _B_|_ _ _ _ _?_
         _ _ _|_ _ _ _ _A_ 
         _____|___________
         
        Only vehicles who's front is before the own rear are considered, no alongside vehicles.

        Specified by:
        getFirstFollowers in interface NeighborsPerception
        Parameters:
        lat - LateralDirectionality; LEFT or RIGHT
        Returns:
        list of followers on a lane
        Throws:
        ParameterException - if parameter is not defined
        java.lang.NullPointerException - if lat is null
        java.lang.IllegalArgumentException - if lat is NONE
      • isGtuAlongside

        public final boolean isGtuAlongside​(LateralDirectionality lat)
                                     throws ParameterException,
                                            java.lang.NullPointerException,
                                            java.lang.IllegalArgumentException
        Whether there is a GTU alongside, i.e. with overlap, in an adjacent lane.
        Specified by:
        isGtuAlongside in interface NeighborsPerception
        Parameters:
        lat - LateralDirectionality; LEFT or RIGHT
        Returns:
        whether there is a GTU alongside, i.e. with overlap, in an adjacent lane
        Throws:
        ParameterException - if parameter is not defined
        java.lang.NullPointerException - if lat is null
        java.lang.IllegalArgumentException - if lat is NONE
      • computeGtuAlongside

        public boolean computeGtuAlongside​(LateralDirectionality lat)
        Computes whether there is a GTU alongside.
        Parameters:
        lat - LateralDirectionality; lateral directionality
        Returns:
        boolean; whether there is a GTU alongside
      • getLeaders

        public final PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> getLeaders​(RelativeLane lane)
        Set of leaders on a lane, including adjacent GTU's who's FRONT is ahead of the own vehicle FRONT. Leaders are sorted by headway value.
        Specified by:
        getLeaders in interface NeighborsPerception
        Parameters:
        lane - RelativeLane; relative lateral lane
        Returns:
        set of leaders on a lane, including adjacent GTU's who's FRONT is ahead of the own vehicle FRONT
      • getFollowers

        public final PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> getFollowers​(RelativeLane lane)
        Set of followers on a lane, including adjacent GTU's who's FRONT is back of the own vehicle FRONT. Follower are are sorted by distance.
        Specified by:
        getFollowers in interface NeighborsPerception
        Parameters:
        lane - RelativeLane; relative lateral lane
        Returns:
        set of followers on a lane, including adjacent GTU's who's FRONT is back of the own vehicle FRONT
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object