Class AbstractGraphIterator<V,​E>

    • Field Detail

      • nListeners

        protected int nListeners
      • reusableEdgeEvent

        protected final org.jgrapht.traverse.AbstractGraphIterator.FlyweightEdgeEvent<E> reusableEdgeEvent
      • reusableVertexEvent

        protected final org.jgrapht.traverse.AbstractGraphIterator.FlyweightVertexEvent<V> reusableVertexEvent
      • graph

        protected final Graph<V,​E> graph
      • crossComponentTraversal

        protected boolean crossComponentTraversal
      • reuseEvents

        protected boolean reuseEvents
    • Constructor Detail

      • AbstractGraphIterator

        public AbstractGraphIterator​(Graph<V,​E> graph)
        Create a new iterator
        Parameters:
        graph - the graph
        Throws:
        NullPointerException - if argument is null
    • Method Detail

      • getGraph

        public Graph<V,​E> getGraph()
        Get the graph being traversed.
        Returns:
        the graph being traversed
      • setCrossComponentTraversal

        public void setCrossComponentTraversal​(boolean crossComponentTraversal)
        Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.
        Parameters:
        crossComponentTraversal - if true traverses across connected components.
        Throws:
        IllegalArgumentException - if the argument is invalid for this iterator
      • isCrossComponentTraversal

        public boolean isCrossComponentTraversal()
        Test whether this iterator is set to traverse the graph across connected components.
        Specified by:
        isCrossComponentTraversal in interface GraphIterator<V,​E>
        Returns:
        true if traverses across connected components, otherwise false.
      • setReuseEvents

        public void setReuseEvents​(boolean reuseEvents)
        Description copied from interface: GraphIterator
        Sets a value the reuseEvents flag. If the reuseEvents flag is set to true this class will reuse previously fired events and will not create a new object for each event. This option increases performance but should be used with care, especially in multithreaded environment.
        Specified by:
        setReuseEvents in interface GraphIterator<V,​E>
        Parameters:
        reuseEvents - whether to reuse previously fired event objects instead of creating a new event object for each event.
      • isReuseEvents

        public boolean isReuseEvents()
        Description copied from interface: GraphIterator
        Tests whether the reuseEvents flag is set. If the flag is set to true this class will reuse previously fired events and will not create a new object for each event. This option increases performance but should be used with care, especially in multithreaded environment.
        Specified by:
        isReuseEvents in interface GraphIterator<V,​E>
        Returns:
        the value of the reuseEvents flag.
      • fireConnectedComponentFinished

        protected void fireConnectedComponentFinished​(ConnectedComponentTraversalEvent e)
        Informs all listeners that the traversal of the current connected component finished.
        Parameters:
        e - the connected component finished event.
      • fireConnectedComponentStarted

        protected void fireConnectedComponentStarted​(ConnectedComponentTraversalEvent e)
        Informs all listeners that a traversal of a new connected component has started.
        Parameters:
        e - the connected component started event.
      • fireEdgeTraversed

        protected void fireEdgeTraversed​(EdgeTraversalEvent<E> e)
        Informs all listeners that a the specified edge was visited.
        Parameters:
        e - the edge traversal event.
      • fireVertexTraversed

        protected void fireVertexTraversed​(VertexTraversalEvent<V> e)
        Informs all listeners that a the specified vertex was visited.
        Parameters:
        e - the vertex traversal event.
      • fireVertexFinished

        protected void fireVertexFinished​(VertexTraversalEvent<V> e)
        Informs all listeners that a the specified vertex was finished.
        Parameters:
        e - the vertex traversal event.
      • createVertexTraversalEvent

        protected VertexTraversalEvent<V> createVertexTraversalEvent​(V vertex)
        Create a vertex traversal event.
        Parameters:
        vertex - the vertex
        Returns:
        the event
      • createEdgeTraversalEvent

        protected EdgeTraversalEvent<E> createEdgeTraversalEvent​(E edge)
        Create an edge traversal event.
        Parameters:
        edge - the edge
        Returns:
        the event