com.phoenixst.plexus.algorithms

Class DepthFirstTreeView

public class DepthFirstTreeView extends AbstractDepthFirstForestView implements RootedTree

A constructive (not lazy) depth-first tree for a portion of a 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 $

Author: Ray A. Conner

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
ObjectgetRoot()
ObjectgetRoot(Object node)
booleanisTreeNode(Object node)
CollectionrootNodes()
voidsetRoot(Object root)
Throws an UnsupportedOperationException.

Constructor Detail

DepthFirstTreeView

public DepthFirstTreeView(Object startNode, Graph graph, Predicate traverserPredicate)
Creates a new DepthFirstTreeView starting at the specified node.

DepthFirstTreeView

public DepthFirstTreeView(Object startNode, Graph graph, Transformer traverserFactory)
Creates a new DepthFirstTreeView starting at the specified node.

Method Detail

getRoot

public Object getRoot()

getRoot

public Object getRoot(Object node)

isTreeNode

public boolean isTreeNode(Object node)

rootNodes

public Collection rootNodes()

setRoot

public void setRoot(Object root)
Throws an UnsupportedOperationException.
See the Plexus project home, hosted by SourceForge.
Copyright B) 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.