|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgrapht.traverse.AbstractGraphIterator<V,E>
org.jgrapht.traverse.CrossComponentIterator<V,E,D>
V
- vertex typeE
- edge typeD
- type of data associated to seen verticespublic abstract class CrossComponentIterator<V,E,D>
Provides a cross-connected-component traversal functionality for iterator subclasses.
Nested Class Summary | |
---|---|
protected static class |
CrossComponentIterator.VisitColor
Standard vertex visit state enumeration. |
Field Summary |
---|
Fields inherited from class org.jgrapht.traverse.AbstractGraphIterator |
---|
nListeners |
Constructor Summary | |
---|---|
CrossComponentIterator(Graph<V,E> g,
V startVertex)
Creates a new iterator for the specified graph. |
Method Summary | |
---|---|
protected abstract void |
encounterVertex(V vertex,
E edge)
Update data structures the first time we see a vertex. |
protected abstract void |
encounterVertexAgain(V vertex,
E edge)
Called whenever we re-encounter a vertex. |
protected void |
finishVertex(V vertex)
Called when a vertex has been finished (meaning is dependent on traversal represented by subclass). |
Graph<V,E> |
getGraph()
|
protected D |
getSeenData(V vertex)
Access the data stored for a seen vertex. |
boolean |
hasNext()
|
protected abstract boolean |
isConnectedComponentExhausted()
Returns true if there are no more uniterated vertices in the currently iterated connected component; false otherwise. |
protected boolean |
isSeenVertex(java.lang.Object vertex)
Determines whether a vertex has been seen yet by this traversal. |
V |
next()
|
protected abstract V |
provideNextVertex()
Returns the vertex to be returned in the following call to the iterator next method. |
protected D |
putSeenData(V vertex,
D data)
Stores iterator-dependent data for a vertex that has been seen. |
Methods inherited from class org.jgrapht.traverse.AbstractGraphIterator |
---|
addTraversalListener, fireConnectedComponentFinished, fireConnectedComponentStarted, fireEdgeTraversed, fireVertexFinished, fireVertexTraversed, isCrossComponentTraversal, isReuseEvents, remove, removeTraversalListener, setCrossComponentTraversal, setReuseEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CrossComponentIterator(Graph<V,E> g, V startVertex)
null
, Iteration will start at an arbitrary graph vertex.
g
- the graph to be iterated.startVertex
- the vertex iteration to be started.
java.lang.IllegalArgumentException
- if g==null
or does not
contain startVertex
Method Detail |
---|
public Graph<V,E> getGraph()
public boolean hasNext()
Iterator.hasNext()
public V next()
Iterator.next()
protected abstract boolean isConnectedComponentExhausted()
protected abstract void encounterVertex(V vertex, E edge)
vertex
- the vertex encounterededge
- the edge via which the vertex was encountered, or null if the
vertex is a starting pointprotected abstract V provideNextVertex()
next
method.
protected D getSeenData(V vertex)
vertex
- a vertex which has already been seen.
null
if no
data was associated with the vertex. A null
return can also
indicate that the vertex was explicitly associated with
null
.protected boolean isSeenVertex(java.lang.Object vertex)
vertex
- vertex in question
protected abstract void encounterVertexAgain(V vertex, E edge)
vertex
- the vertex re-encounterededge
- the edge via which the vertex was re-encounteredprotected D putSeenData(V vertex, D data)
vertex
- a vertex which has been seen.data
- data to be associated with the seen vertex.
null
if no data was associated with the vertex. A
null
return can also indicate that the vertex was explicitly
associated with null
.protected void finishVertex(V vertex)
vertex
- vertex which has been finished
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |