Package org.jgrapht.traverse
Class AbstractGraphIterator<V,E>
java.lang.Object
org.jgrapht.traverse.AbstractGraphIterator<V,E>
- All Implemented Interfaces:
Iterator<V>
,GraphIterator<V,
E>
- Direct Known Subclasses:
CrossComponentIterator
An empty implementation of a graph iterator to minimize the effort required
to implement graph iterators.
- Since:
- Jul 19, 2003
- Author:
- Barak Naveh
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified traversal listener to this iterator.protected void
Informs all listeners that the traversal of the current connected component finished.protected void
Informs all listeners that a traversal of a new connected component has started.protected void
Informs all listeners that a the specified edge was visited.protected void
Informs all listeners that a the specified vertex was finished.protected void
Informs all listeners that a the specified vertex was visited.boolean
Test whether this iterator is set to traverse the graph across connected components.boolean
Tests whether thereuseEvents
flag is set.void
remove()
Unsupported.void
Removes the specified traversal listener from this iterator.void
setCrossComponentTraversal
(boolean crossComponentTraversal) Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.void
setReuseEvents
(boolean reuseEvents) Sets a value thereuseEvents
flag.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
Field Details
-
nListeners
protected int nListeners
-
-
Constructor Details
-
AbstractGraphIterator
public AbstractGraphIterator()
-
-
Method Details
-
setCrossComponentTraversal
public void setCrossComponentTraversal(boolean crossComponentTraversal) Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.- Parameters:
crossComponentTraversal
- iftrue
traverses across connected components.
-
isCrossComponentTraversal
public boolean isCrossComponentTraversal()Test whether this iterator is set to traverse the graph across connected components.- Specified by:
isCrossComponentTraversal
in interfaceGraphIterator<V,
E> - Returns:
true
if traverses across connected components, otherwisefalse
.
-
setReuseEvents
public void setReuseEvents(boolean reuseEvents) Description copied from interface:GraphIterator
Sets a value thereuseEvents
flag. If thereuseEvents
flag is set totrue
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 interfaceGraphIterator<V,
E> - Parameters:
reuseEvents
- whether to reuse previously fired event objects instead of creating a new event object for each event.- See Also:
-
isReuseEvents
public boolean isReuseEvents()Description copied from interface:GraphIterator
Tests whether thereuseEvents
flag is set. If the flag is set totrue
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 interfaceGraphIterator<V,
E> - Returns:
- the value of the
reuseEvents
flag. - See Also:
-
addTraversalListener
Adds the specified traversal listener to this iterator.- Specified by:
addTraversalListener
in interfaceGraphIterator<V,
E> - Parameters:
l
- the traversal listener to be added.
-
remove
public void remove()Unsupported.- Specified by:
remove
in interfaceGraphIterator<V,
E> - Specified by:
remove
in interfaceIterator<V>
- Throws:
UnsupportedOperationException
-
removeTraversalListener
Removes the specified traversal listener from this iterator.- Specified by:
removeTraversalListener
in interfaceGraphIterator<V,
E> - Parameters:
l
- the traversal listener to be removed.
-
fireConnectedComponentFinished
Informs all listeners that the traversal of the current connected component finished.- Parameters:
e
- the connected component finished event.
-
fireConnectedComponentStarted
Informs all listeners that a traversal of a new connected component has started.- Parameters:
e
- the connected component started event.
-
fireEdgeTraversed
Informs all listeners that a the specified edge was visited.- Parameters:
e
- the edge traversal event.
-
fireVertexTraversed
Informs all listeners that a the specified vertex was visited.- Parameters:
e
- the vertex traversal event.
-
fireVertexFinished
Informs all listeners that a the specified vertex was finished.- Parameters:
e
- the vertex traversal event.
-