Package org._3pq.jgrapht.traverse
Class AbstractGraphIterator
- java.lang.Object
-
- org._3pq.jgrapht.traverse.AbstractGraphIterator
-
- All Implemented Interfaces:
java.util.Iterator,GraphIterator
- Direct Known Subclasses:
CrossComponentIterator
public abstract class AbstractGraphIterator extends java.lang.Object implements GraphIterator
An empty implementation of a graph iterator to minimize the effort required to implement graph iterators.- Since:
- Jul 19, 2003
- Author:
- Barak Naveh
-
-
Constructor Summary
Constructors Constructor Description AbstractGraphIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTraversalListener(TraversalListener l)Adds the specified traversal listener to this iterator.protected voidfireConnectedComponentFinished(ConnectedComponentTraversalEvent e)Informs all listeners that the traversal of the current connected component finished.protected voidfireConnectedComponentStarted(ConnectedComponentTraversalEvent e)Informs all listeners that a traversal of a new connected component has started.protected voidfireEdgeTraversed(EdgeTraversalEvent e)Informs all listeners that a the specified edge was visited.protected voidfireVertexTraversed(VertexTraversalEvent e)Informs all listeners that a the specified vertex was visited.booleanisCrossComponentTraversal()Test whether this iterator is set to traverse the graph across connected components.booleanisReuseEvents()Tests whether thereuseEventsflag is set.voidremove()Unsupported.voidremoveTraversalListener(TraversalListener l)Removes the specified traversal listener from this iterator.voidsetCrossComponentTraversal(boolean crossComponentTraversal)Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.voidsetReuseEvents(boolean reuseEvents)Sets a value thereuseEventsflag.
-
-
-
Method Detail
-
setCrossComponentTraversal
public void setCrossComponentTraversal(boolean crossComponentTraversal)
Sets the cross component traversal flag - indicates whether to traverse the graph across connected components.- Parameters:
crossComponentTraversal- iftruetraverses across connected components.
-
isCrossComponentTraversal
public boolean isCrossComponentTraversal()
Test whether this iterator is set to traverse the graph across connected components.- Specified by:
isCrossComponentTraversalin interfaceGraphIterator- Returns:
trueif traverses across connected components, otherwisefalse.
-
setReuseEvents
public void setReuseEvents(boolean reuseEvents)
Description copied from interface:GraphIteratorSets a value thereuseEventsflag. If thereuseEventsflag is set totruethis 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:
setReuseEventsin interfaceGraphIterator- Parameters:
reuseEvents- whether to reuse previously fired event objects instead of creating a new event object for each event.- See Also:
GraphIterator.setReuseEvents(boolean)
-
isReuseEvents
public boolean isReuseEvents()
Description copied from interface:GraphIteratorTests whether thereuseEventsflag is set. If the flag is set totruethis 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:
isReuseEventsin interfaceGraphIterator- Returns:
- the value of the
reuseEventsflag. - See Also:
GraphIterator.isReuseEvents()
-
addTraversalListener
public void addTraversalListener(TraversalListener l)
Adds the specified traversal listener to this iterator.- Specified by:
addTraversalListenerin interfaceGraphIterator- Parameters:
l- the traversal listener to be added.
-
remove
public void remove()
Unsupported.- Specified by:
removein interfaceGraphIterator- Specified by:
removein interfacejava.util.Iterator- Throws:
java.lang.UnsupportedOperationException
-
removeTraversalListener
public void removeTraversalListener(TraversalListener l)
Removes the specified traversal listener from this iterator.- Specified by:
removeTraversalListenerin interfaceGraphIterator- Parameters:
l- the traversal listener to be removed.
-
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)
Informs all listeners that a the specified edge was visited.- Parameters:
e- the edge traversal event.
-
fireVertexTraversed
protected void fireVertexTraversed(VertexTraversalEvent e)
Informs all listeners that a the specified vertex was visited.- Parameters:
e- the vertex traversal event.
-
-