public class FilteredTraverser extends Object implements Traverser
Traverser
. Because this class must
advance the underlying Traverser
to function
properly, remove()
and removeEdge()
may delegate to
Graph.removeNode( node )
and Graph.removeEdge( edge )
in some situations.Constructor and Description |
---|
FilteredTraverser(Graph graph,
Traverser delegate,
org.apache.commons.collections.Predicate traverserPredicate)
Creates a new
FilteredTraverser which will have
remove() and removeEdge() delegate to Graph.removeNode( node ) and Graph.removeEdge( edge ) if necessary. |
FilteredTraverser(Traverser delegate,
org.apache.commons.collections.Predicate traverserPredicate)
Creates a new
FilteredTraverser which will throw
an IllegalStateException if remove()
or removeEdge() is called after
hasNext() without an intervening call to
next() . |
Modifier and Type | Method and Description |
---|---|
Graph.Edge |
getEdge()
Returns the
Edge which was traversed to get to
the last node returned by next() , or
null if no Edge was traversed. |
boolean |
hasNext() |
Object |
next() |
void |
remove() |
void |
removeEdge()
|
public FilteredTraverser(Traverser delegate, org.apache.commons.collections.Predicate traverserPredicate)
FilteredTraverser
which will throw
an IllegalStateException
if remove()
or removeEdge()
is called after
hasNext()
without an intervening call to
next()
.public FilteredTraverser(Graph graph, Traverser delegate, org.apache.commons.collections.Predicate traverserPredicate)
FilteredTraverser
which will have
remove()
and removeEdge()
delegate to Graph.removeNode( node )
and Graph.removeEdge( edge )
if necessary.
Depending upon the Graph
implementation, this may
invalidate this Traverser
.public Graph.Edge getEdge()
Traverser
Edge
which was traversed to get to
the last node returned by next()
, or
null
if no Edge
was traversed. This
call can be made only if remove()
or removeEdge()
has not been called after the last
call to next()
.public void removeEdge()
Traverser
Graph
the
Edge
that would be returned by getEdge()
(optional operation). If no Edge
was
traversed (as in the root of a breadth-first search), this
method throws a IllegalStateException
. This
method can be called only once per call to next()
. The behavior of a traverser is unspecified if the
underlying graph structure is modified while the traversal is
in progress in any way other than by calling this method or
remove()
.removeEdge
in interface Traverser
See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.