Class GraphIterationElement<ST extends GraphSegment<ST,​PT>,​PT extends GraphPoint<PT,​ST>>

    • Field Detail

      • previousSegment

        ST extends GraphSegment<ST,​PT> previousSegment
        Previous element in the iteration.
      • currentSegment

        final ST extends GraphSegment<ST,​PT> currentSegment
        Current segment in the iteration.
      • connectionPoint

        final PT extends GraphPoint<PT,​ST> connectionPoint
        Connection point between the previous segment and the current segment.
      • fromStartPoint

        final boolean fromStartPoint
        Previous element in the iteration.
      • distanceToReach

        double distanceToReach
        Distance that was consumed for reaching the connection point.
      • culDeSac

        boolean culDeSac
        Indicates if the current segment is a cul-de-sac.
      • lastReachableSegment

        boolean lastReachableSegment
        Indicates if the segment is the last segment to be reachable in the current exploration branch. This may indicates that the iteration algorithm is not allowed to go deeper in exploration from the current segment.
      • replied

        boolean replied
        Indicates if this element was replied by the iterator.
    • Constructor Detail

      • GraphIterationElement

        GraphIterationElement​(ST previousSegment1,
                              ST segment,
                              PT point,
                              boolean fromStartPoint,
                              double distanceToReach1,
                              double distanceToConsume1)
        Constructor.
        Parameters:
        previousSegment1 - is the previous element that permits to reach this object during an iteration
        segment - is the current segment
        point - is the point on which the iteration arrived on the current segment.
        fromStartPoint - indicates if the current search is reached from its start point. This parameter is useful when the current segment is connected to the same road connected with its start point and its end point.
        distanceToReach1 - is the distance that is already consumed to reach the segment.
        distanceToConsume1 - is the distance to consume including this segment length.
    • Method Detail

      • getPreviousSegment

        @Pure
        public ST getPreviousSegment()
        Replies the segment from which the iterator arrived on the current segment.
        Returns:
        the segment from which the iterator arrived on the current segment.
      • getSegment

        @Pure
        public ST getSegment()
        Replies the segment.
        Returns:
        the segment.
      • getPoint

        @Pure
        public PT getPoint()
        Replies the entry point on the segment.
        Returns:
        the entry point on the segment.
      • getDistanceToReachSegment

        @Pure
        public final double getDistanceToReachSegment()
        Replies the distance needed to reach the segment.
        Returns:
        the distance to reach the starting point of the segment. The value could be negative in case the iterations start from inside the segment.
      • getDistanceToConsume

        @Pure
        public final double getDistanceToConsume()
        Replies the distance that is not yet consumed.
        Returns:
        the distance that could be consumed.
        Since:
        16.0
      • toJson

        @Pure
        public void toJson​(JsonBuffer buffer)
        Description copied from interface: JsonableObject
        Replies the Json representation of this node.
        Specified by:
        toJson in interface JsonableObject
        Parameters:
        buffer - the Json buffer.
      • equals

        @Pure
        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        @Pure
        public int hashCode()
        Overrides:
        hashCode in class Object
      • compareSegments

        @Pure
        protected int compareSegments​(GraphSegment<?,​?> firstSegment,
                                      GraphSegment<?,​?> secondSegment)
        Compare the two given segments.
        Parameters:
        firstSegment - the first segment to compare to the second segment.
        secondSegment - the second segment to compare to the first segment.
        Returns:
        -1 if firstSegment is lower than secondSegment, 1 if firstSegment is greater than secondSegment, or 0 if firstSegment is equal to secondSegment.
      • isCulDeSac

        @Pure
        public final boolean isCulDeSac()
        Replies if this segment is a cul-de-sac ie if the next connection point is only connected to this segment.
        Returns:
        true if this segment is a cul-de-sac, otherwise false
      • isTerminalSegment

        @Pure
        public final boolean isTerminalSegment()
        Replies if this segment is the last which will be reached by the iterator. It means that the iterator will not pass this segment and continue the iterations on the following graph branches.

        Of course a segment with a cul-de-sac end is always assumed as a terminal segment.

        Returns:
        true if this segment is terminal, otherwise false
      • setTerminalSegment

        final void setTerminalSegment​(boolean isTerminal)
        Set the flag that indicating if this segment is the last which will be reached by the iterator. It means that the iterator will not pass this segment and continue the iterations on the following graph branches.
        Parameters:
        isTerminal - indicates if the current segment is terminal.