Class AbstractPerceptionIterable<H extends Headway,​U,​C>

    • Constructor Detail

      • AbstractPerceptionIterable

        public AbstractPerceptionIterable​(LaneBasedGTU perceivingGtu,
                                          LaneRecord<?> root,
                                          Length initialPosition,
                                          boolean downstream,
                                          Length maxDistance,
                                          RelativePosition relativePosition,
                                          Route route)
        Constructor.
        Parameters:
        perceivingGtu - LaneBasedGTU; perceiving GTU
        root - LaneRecord<?>; root record
        initialPosition - Length; initial position
        downstream - boolean; search downstream (or upstream)
        maxDistance - Length; max distance to search
        relativePosition - RelativePosition; position to which distance are calculated by subclasses
        route - Route; route of the GTU, may be null
    • Method Detail

      • isDownstream

        public boolean isDownstream()
        Whether the iterable searches downstream.
        Returns:
        boolean; whether the iterable searches downstream
      • getNext

        protected abstract AbstractPerceptionIterable.Entry getNext​(LaneRecord<?> record,
                                                                    Length position,
                                                                    C counter)
                                                             throws GTUException
        Returns the next object(s) on the lane represented by the record. This should only consider objects on the given lane. This method should not check the distance towards objects with the maximum distance. The counter will be null for the first object(s). For following object(s) it is whatever value is given with the previous output Entry. Hence, this method maintains its own counting system.
        Parameters:
        record - LaneRecord<?>; record representing the lane and direction
        position - Length; position to look beyond
        counter - C; counter
        Returns:
        next object(s) on the lane or null if none
        Throws:
        GTUException - on any exception in the process
      • getDistance

        protected abstract Length getDistance​(U object,
                                              LaneRecord<?> record,
                                              Length position)
        Returns the distance to the object. The position fed in to this method is directly taken from an Entry returned by getNext. The two methods need to be consistent with each other.
        Parameters:
        object - U; underlying object
        record - LaneRecord<?>; record representing the lane and direction
        position - Length; position of the object on the lane
        Returns:
        Length; distance to the object
      • getDx

        protected Length getDx()
        Returns the longitudinal length of the relevant relative position such that distances to this points can be calculated.
        Returns:
        Length; the longitudinal length of the relevant relative position such that distances to this points can be calculated