com.phoenixst.plexus.traversals
public class TopologicalSortTraverser extends Object implements Traverser
Traverser
which returns nodes in a topologically
sorted order.
Since: 1.0
Version: $Revision: 1.6 $
Constructor Summary | |
---|---|
TopologicalSortTraverser(Graph graph, Predicate traverserPredicate)
Creates a new TopologicalSortTraverser , where the
traverserPredicate specifies adjacent nodes which
should be returned before a given node. | |
TopologicalSortTraverser(Graph graph, Transformer traverserFactory)
Creates a new TopologicalSortTraverser , where the
traverserFactory returns a Traverser
over adjacent nodes which should be returned before
the given node. | |
TopologicalSortTraverser(Iterator nodeIter, Transformer traverserFactory)
Creates a new TopologicalSortTraverser , where the
traverserFactory returns a Traverser
over adjacent nodes which should be returned before
the given node. |
Method Summary | |
---|---|
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() |
TopologicalSortTraverser
, where the
traverserPredicate
specifies adjacent nodes which
should be returned before a given node.TopologicalSortTraverser
, where the
traverserFactory
returns a Traverser
over adjacent nodes which should be returned before
the given node.TopologicalSortTraverser
, where the
traverserFactory
returns a Traverser
over adjacent nodes which should be returned before
the given node.Edge
which was traversed to get to
the last node returned by next()
, or
null
if no Edge
was traversed. Note
that because the nodes of the underlying Graph
are visited in no particular order by the internals of this
algorithm, this method may return null
even if
some other adjacent node succeeds this one.
Description copied from interface: Traverser
{@inheritDoc }