Class SGraph

    • Constructor Detail

      • SGraph

        public SGraph()
        Construct a simple empty graph.
    • Method Detail

      • iterator

        @Pure
        public GraphIterator<SGraphSegment,​SGraphPoint> iterator​(SGraphSegment startingSegment,
                                                                       SGraphPoint startingPoint,
                                                                       boolean allowManyReplies,
                                                                       boolean assumeOrientedSegments)
        Description copied from interface: Graph
        Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point.
        Specified by:
        iterator in interface Graph<SGraphSegment,​SGraphPoint>
        Parameters:
        startingSegment - is the first segment to iterate.
        startingPoint - is the starting point of the iterations.
        allowManyReplies - may be true to allow to reply many times the same segment, otherwhise false.
        assumeOrientedSegments - may be true to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter is false to assume that the end points of a segment are not distinguished.
        Returns:
        the iterator.
      • getSegmentCount

        @Pure
        public int getSegmentCount()
        Description copied from interface: Graph
        Replies the count of segments in this graph.
        Specified by:
        getSegmentCount in interface Graph<SGraphSegment,​SGraphPoint>
        Returns:
        the count of segments in this graph.
      • getPointCount

        @Pure
        public int getPointCount()
        Description copied from interface: Graph
        Replies the count of points in this graph.
        Specified by:
        getPointCount in interface Graph<SGraphSegment,​SGraphPoint>
        Returns:
        the count of points in this graph.
      • isEmpty

        @Pure
        public boolean isEmpty()
        Description copied from interface: Graph
        Replies if this graph is empty or not.
        Specified by:
        isEmpty in interface Graph<SGraphSegment,​SGraphPoint>
        Returns:
        true if the graph is empty, otherwise false.
      • contains

        @Pure
        public boolean contains​(Object obj)
        Description copied from interface: Graph
        Replies is this graph contains the given segment. The test is based on Object.equals(Object).
        Specified by:
        contains in interface Graph<SGraphSegment,​SGraphPoint>
        Parameters:
        obj - the object to search for.
        Returns:
        true if the graph contains the segment, otherwise false.
      • depthIterator

        @Pure
        public GraphIterator<SGraphSegment,​SGraphPoint> depthIterator​(SGraphSegment startingSegment,
                                                                            double depth,
                                                                            double positionFromStartingPoint,
                                                                            SGraphPoint startingPoint,
                                                                            boolean allowManyReplies,
                                                                            boolean assumeOrientedSegments,
                                                                            DynamicDepthUpdater<SGraphSegment,​SGraphPoint> dynamicDepthUpdater)
        Description copied from interface: Graph
        Replies an iterator that permits to move along the segment's graph starting from the specified segment and from the specified starting point. If the specified starting point is not one of the ends of the segment, this function assumes to start from the point replied by GraphSegment.getBeginPoint().

        This function does not allow the cycles during the iterations.

        Specified by:
        depthIterator in interface Graph<SGraphSegment,​SGraphPoint>
        Parameters:
        startingSegment - is the first segment to iterate.
        depth - is the maximal depth to reach.
        positionFromStartingPoint - is the starting position from the startingPoint.
        startingPoint - is the starting point of the iterations.
        allowManyReplies - may be true to allow to reply many times the same segment, otherwhise false.
        assumeOrientedSegments - may be true to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter is false to assume that the end points of a segment are not distinguished.
        dynamicDepthUpdater - if not null, it is a lambda that is used for dynamically updating the maximal depth.
        Returns:
        the iterator.
        See Also:
        Graph.depthIterator(GraphSegment, double, double, GraphPoint, boolean, boolean)
      • add

        void add​(SGraphSegment segment)
        Add the given segment. The number of points is incremented by 2.
        Parameters:
        segment - the segment to add.
        Throws:
        IllegalStateException - if the graph is not empty.
      • updatePointCount

        void updatePointCount​(int amount)
        Update the number of points in this graph with the given amount.
        Parameters:
        amount - the nbumber of points to add.