org._3pq.jgrapht.traverse
Class CrossComponentIterator
- GraphIterator, Iterator
public abstract class CrossComponentIterator
Provides a cross-connected-component traversal functionality for iterator
subclasses.
protected abstract void | encounterVertex(Object vertex, Edge edge) - Update data structures the first time we see a vertex.
|
protected abstract void | encounterVertexAgain(Object vertex, Edge edge) - Called whenever we re-encounter a vertex.
|
protected Object | getSeenData(Object 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(Object vertex) - Determines whether a vertex has been seen yet by this traversal.
|
Object | next()
|
protected abstract Object | provideNextVertex() - Returns the vertex to be returned in the following call to the iterator
next method.
|
protected Object | putSeenData(Object vertex, Object data) - Stores iterator-dependent data for a vertex that has been seen.
|
addTraversalListener , fireConnectedComponentFinished , fireConnectedComponentStarted , fireEdgeTraversed , fireVertexTraversed , isCrossComponentTraversal , isReuseEvents , remove , removeTraversalListener , setCrossComponentTraversal , setReuseEvents |
CrossComponentIterator
public CrossComponentIterator(Graph g,
Object startVertex)
Creates a new iterator for the specified graph. Iteration will start at
the specified start vertex. If the specified start vertex is
null
, Iteration will start at an arbitrary graph vertex.
g
- the graph to be iterated.startVertex
- the vertex iteration to be started.
encounterVertex
protected abstract void encounterVertex(Object vertex,
Edge edge)
Update data structures the first time we see a vertex.
vertex
- the vertex encounterededge
- the edge via which the vertex was encountered, or null if
the vertex is a starting point
encounterVertexAgain
protected abstract void encounterVertexAgain(Object vertex,
Edge edge)
Called whenever we re-encounter a vertex. The default implementation
does nothing.
vertex
- the vertex re-encounterededge
- the edge via which the vertex was re-encountered
getSeenData
protected Object getSeenData(Object vertex)
Access the data stored for a seen vertex.
vertex
- a vertex which has already been seen.
- data associated with the seen vertex or
null
if no
data was associated with the vertex. A null
return
can also indicate that the vertex was explicitly associated
with null
.
hasNext
public boolean hasNext()
java.util.Iterator.hasNext()
isConnectedComponentExhausted
protected abstract boolean isConnectedComponentExhausted()
Returns true if there are no more uniterated vertices in the
currently iterated connected component; false otherwise.
- true if there are no more uniterated vertices in the
currently iterated connected component; false
otherwise.
isSeenVertex
protected boolean isSeenVertex(Object vertex)
Determines whether a vertex has been seen yet by this traversal.
vertex
- vertex in question
- true if vertex has already been seen
next
public Object next()
java.util.Iterator.next()
provideNextVertex
protected abstract Object provideNextVertex()
Returns the vertex to be returned in the following call to the iterator
next
method.
- the next vertex to be returned by this iterator.
putSeenData
protected Object putSeenData(Object vertex,
Object data)
Stores iterator-dependent data for a vertex that has been seen.
vertex
- a vertex which has been seen.data
- data to be associated with the seen vertex.
- previous value associated with specified vertex or
null
if no data was associated with the vertex. A
null
return can also indicate that the vertex was
explicitly associated with null
.