V
- the graph vertex typeE
- the graph edge typepublic abstract class AbstractGraphIterator<V,E> extends Object implements GraphIterator<V,E>
Modifier and Type | Field and Description |
---|---|
protected boolean |
crossComponentTraversal |
protected Graph<V,E> |
graph |
protected int |
nListeners |
protected org.jgrapht.traverse.AbstractGraphIterator.FlyweightEdgeEvent<V,E> |
reusableEdgeEvent |
protected org.jgrapht.traverse.AbstractGraphIterator.FlyweightVertexEvent<V> |
reusableVertexEvent |
protected boolean |
reuseEvents |
Constructor and Description |
---|
AbstractGraphIterator(Graph<V,E> graph)
Create a new iterator
|
Modifier and Type | Method and Description |
---|---|
void |
addTraversalListener(TraversalListener<V,E> l)
Adds the specified traversal listener to this iterator.
|
protected EdgeTraversalEvent<E> |
createEdgeTraversalEvent(E edge)
Create an edge traversal event.
|
protected VertexTraversalEvent<V> |
createVertexTraversalEvent(V vertex)
Create a vertex traversal event.
|
protected void |
fireConnectedComponentFinished(ConnectedComponentTraversalEvent e)
Informs all listeners that the traversal of the current connected component finished.
|
protected void |
fireConnectedComponentStarted(ConnectedComponentTraversalEvent e)
Informs all listeners that a traversal of a new connected component has started.
|
protected void |
fireEdgeTraversed(EdgeTraversalEvent<E> e)
Informs all listeners that a the specified edge was visited.
|
protected void |
fireVertexFinished(VertexTraversalEvent<V> e)
Informs all listeners that a the specified vertex was finished.
|
protected void |
fireVertexTraversed(VertexTraversalEvent<V> e)
Informs all listeners that a the specified vertex was visited.
|
Graph<V,E> |
getGraph()
Get the graph being traversed.
|
boolean |
isCrossComponentTraversal()
Test whether this iterator is set to traverse the graph across connected components.
|
boolean |
isReuseEvents()
Tests whether the
reuseEvents flag is set. |
void |
remove()
Unsupported.
|
void |
removeTraversalListener(TraversalListener<V,E> l)
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 the
reuseEvents flag. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining, hasNext, next
protected int nListeners
protected final org.jgrapht.traverse.AbstractGraphIterator.FlyweightEdgeEvent<V,E> reusableEdgeEvent
protected final org.jgrapht.traverse.AbstractGraphIterator.FlyweightVertexEvent<V> reusableVertexEvent
protected boolean crossComponentTraversal
protected boolean reuseEvents
public Graph<V,E> getGraph()
public void setCrossComponentTraversal(boolean crossComponentTraversal)
crossComponentTraversal
- if true
traverses across connected components.public boolean isCrossComponentTraversal()
isCrossComponentTraversal
in interface GraphIterator<V,E>
true
if traverses across connected components, otherwise
false
.public void setReuseEvents(boolean reuseEvents)
GraphIterator
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.setReuseEvents
in interface GraphIterator<V,E>
reuseEvents
- whether to reuse previously fired event objects instead of creating a new
event object for each event.public boolean isReuseEvents()
GraphIterator
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.isReuseEvents
in interface GraphIterator<V,E>
reuseEvents
flag.public void addTraversalListener(TraversalListener<V,E> l)
GraphIterator
addTraversalListener
in interface GraphIterator<V,E>
l
- the traversal listener to be added.public void remove()
GraphIterator
public void removeTraversalListener(TraversalListener<V,E> l)
GraphIterator
removeTraversalListener
in interface GraphIterator<V,E>
l
- the traversal listener to be removed.protected void fireConnectedComponentFinished(ConnectedComponentTraversalEvent e)
e
- the connected component finished event.protected void fireConnectedComponentStarted(ConnectedComponentTraversalEvent e)
e
- the connected component started event.protected void fireEdgeTraversed(EdgeTraversalEvent<E> e)
e
- the edge traversal event.protected void fireVertexTraversed(VertexTraversalEvent<V> e)
e
- the vertex traversal event.protected void fireVertexFinished(VertexTraversalEvent<V> e)
e
- the vertex traversal event.protected VertexTraversalEvent<V> createVertexTraversalEvent(V vertex)
vertex
- the vertexprotected EdgeTraversalEvent<E> createEdgeTraversalEvent(E edge)
edge
- the edgeCopyright © 2019. All rights reserved.