com.phoenixst.plexus.algorithms
public class DepthFirstTreeView extends AbstractDepthFirstForestView implements RootedTree
Graph
. As described in the RootedTree class docs, all methods in this view which take a
node argument will throw a NoSuchNodeException
if
given a node which is not a descendant of the root node.
This implementation tracks discovery time and finishing time,
and can possibly answer a few structural questions about the
portion of the underlying Graph
reachable from the
specified start node. Whether or not these questions can be
answered depends upon whether the supplied Traverser
predicate or factory is direction agnostic. If at least
one encountered edge can be traversed in only one direction, then
many structural queries cannot be answered by this class, and will
throw exceptions. The only exception is in the case of
self-loops; these may only be traversed in one direction with no
ill effect. These cases are documented in the appropriate
methods.
If the underlying Graph
changes, this view may
become invalid, but perhaps not detectably so.
Since: 1.0
Version: $Revision: 1.21 $
Constructor Summary | |
---|---|
DepthFirstTreeView(Object startNode, Graph graph, Predicate traverserPredicate)
Creates a new DepthFirstTreeView starting at
the specified node. | |
DepthFirstTreeView(Object startNode, Graph graph, Transformer traverserFactory)
Creates a new DepthFirstTreeView starting at
the specified node. |
Method Summary | |
---|---|
Object | getRoot() |
Object | getRoot(Object node) |
boolean | isTreeNode(Object node) |
Collection | rootNodes() |
void | setRoot(Object root)
Throws an UnsupportedOperationException . |
DepthFirstTreeView
starting at
the specified node.DepthFirstTreeView
starting at
the specified node.UnsupportedOperationException
.