com.phoenixst.plexus

Class ForestTreeExtension

public class ForestTreeExtension extends Object implements RootedTree

A RootedTree which is formed by extending an OrientedForest, adding a dummy root node (and edges) which is the parent of the forest's root nodes.

Since: 1.0

Version: $Revision: 1.9 $

Author: Ray A. Conner

Constructor Summary
ForestTreeExtension(OrientedForest forest)
Creates a new ForestTreeExtension.
ForestTreeExtension(Object root, OrientedForest forest)
Creates a new ForestTreeExtension.
Method Summary
TraverserchildTraverser(Object node)
Returns a Traverser over the children of the specified node.
intgetDepth(Object node)
intgetHeight(Object node)
ObjectgetLeastCommonAncestor(Object aNode, Object bNode)
ObjectgetParent(Object node)
Graph.EdgegetParentEdge(Object node)
ObjectgetParentEndpoint(Graph.Edge edge)
ObjectgetRoot()
ObjectgetRoot(Object node)
booleanisAncestor(Object ancestor, Object descendant)
booleanisForestEdge(Graph.Edge edge)
booleanisLeaf(Object node)
booleanisTreeNode(Object node)
If the specified node is not the root node, this method delegates to OrientedForest and returns true if a NoSuchNodeException is not thrown.
CollectionrootNodes()
voidsetRoot(Object root)
Sets the root node, which must not be contained by the forest being extended, although this implementation does not check for that condition.

Constructor Detail

ForestTreeExtension

public ForestTreeExtension(OrientedForest forest)
Creates a new ForestTreeExtension.

ForestTreeExtension

public ForestTreeExtension(Object root, OrientedForest forest)
Creates a new ForestTreeExtension. The specified forest should not contain the given root node.

Method Detail

childTraverser

public Traverser childTraverser(Object node)
Returns a Traverser over the children of the specified node. Traversers over the children of the root node are unmodifiable.

getDepth

public int getDepth(Object node)

getHeight

public int getHeight(Object node)

getLeastCommonAncestor

public Object getLeastCommonAncestor(Object aNode, Object bNode)

getParent

public Object getParent(Object node)

getParentEdge

public Graph.Edge getParentEdge(Object node)

getParentEndpoint

public Object getParentEndpoint(Graph.Edge edge)

getRoot

public Object getRoot()

getRoot

public Object getRoot(Object node)

isAncestor

public boolean isAncestor(Object ancestor, Object descendant)

isForestEdge

public boolean isForestEdge(Graph.Edge edge)

isLeaf

public boolean isLeaf(Object node)

isTreeNode

public boolean isTreeNode(Object node)
If the specified node is not the root node, this method delegates to OrientedForest and returns true if a NoSuchNodeException is not thrown. Otherwise, it returns false.

rootNodes

public Collection rootNodes()

setRoot

public void setRoot(Object root)
Sets the root node, which must not be contained by the forest being extended, although this implementation does not check for that condition.
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.