V
- vertex typeE
- edge typeD
- type of data associated to seen verticespublic abstract class CrossComponentIterator<V,E,D> extends AbstractGraphIterator<V,E>
Modifier and Type | Class and Description |
---|---|
protected static class |
CrossComponentIterator.VisitColor
Standard vertex visit state enumeration.
|
nListeners, reusableEdgeEvent, reusableVertexEvent, specifics
Constructor and Description |
---|
CrossComponentIterator(Graph<V,E> g,
V startVertex)
Creates a new iterator for the specified graph.
|
Modifier and Type | Method and Description |
---|---|
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(V 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.
|
addTraversalListener, fireConnectedComponentFinished, fireConnectedComponentStarted, fireEdgeTraversed, fireVertexFinished, fireVertexTraversed, isCrossComponentTraversal, isReuseEvents, remove, removeTraversalListener, setCrossComponentTraversal, setReuseEvents
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
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.IllegalArgumentException
- if g==null
or does not contain
startVertex
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(V vertex)
vertex
- vertex in questionprotected 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 finishedCopyright © 2017. All rights reserved.