Plexus v0.13.1

com.phoenixst.plexus
Class AbstractOrientedForest

java.lang.Object
  extended by com.phoenixst.plexus.AbstractOrientedForest
All Implemented Interfaces:
OrientedForest
Direct Known Subclasses:
DefaultOrientedForestView, DepthFirstForestView, DepthFirstTreeView

public abstract class AbstractOrientedForest
extends Object
implements OrientedForest

This class provides a skeletal implementation of the OrientedForest interface, to minimize the effort required to implement this interface.

All concrete extensions of this class must implement the following methods:

The documentation for each non-abstract method in this class describes its implementation in detail. Each of these methods may be overridden if there is a more efficient implementation.

Since:
1.0
Version:
$Revision: 1.12 $
Author:
Ray A. Conner

Constructor Summary
protected AbstractOrientedForest()
          Creates a new AbstractOrientedForest.
 
Method Summary
 int getDepth(Object node)
          Gets the depth of the specified node.
 int getHeight(Object node)
          Gets the height of the specified node.
 Object getLeastCommonAncestor(Object aNode, Object bNode)
          Returns the least common ancestor of the specified nodes, or null if none exists.
 Object getParent(Object node)
          Gets the parent of the specified node, or null if it doesn't have one.
 Object getParentEndpoint(Graph.Edge edge)
          Returns the parent endpoint of the specified forest edge.
 Object getRoot(Object node)
          Gets the root of the subgraph containing the specified node.
 boolean isAncestor(Object ancestor, Object descendant)
          Returns true if ancestor is actually an ancestor of descendant.
 boolean isForestEdge(Graph.Edge edge)
          Gets whether or not the specified edge is a forest edge.
 boolean isLeaf(Object node)
          Returns true if the specified node has no children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.phoenixst.plexus.OrientedForest
childTraverser, getParentEdge, rootNodes
 

Constructor Detail

AbstractOrientedForest

protected AbstractOrientedForest()
Creates a new AbstractOrientedForest.

Method Detail

getParent

public Object getParent(Object node)
Gets the parent of the specified node, or null if it doesn't have one. If the graph may contain a null node, then getParentEdge( node ) must be used to distinguish the two cases.

Specified by:
getParent in interface OrientedForest

isForestEdge

public boolean isForestEdge(Graph.Edge edge)
Gets whether or not the specified edge is a forest edge.

Specified by:
isForestEdge in interface OrientedForest

getParentEndpoint

public Object getParentEndpoint(Graph.Edge edge)
Returns the parent endpoint of the specified forest edge. If the specified edge is not a forest edge, throws an IllegalArgumentException.

Specified by:
getParentEndpoint in interface OrientedForest

getRoot

public Object getRoot(Object node)
Gets the root of the subgraph containing the specified node.

Specified by:
getRoot in interface OrientedForest

isLeaf

public boolean isLeaf(Object node)
Returns true if the specified node has no children.

Specified by:
isLeaf in interface OrientedForest

isAncestor

public boolean isAncestor(Object ancestor,
                          Object descendant)
Returns true if ancestor is actually an ancestor of descendant.

Specified by:
isAncestor in interface OrientedForest

getLeastCommonAncestor

public Object getLeastCommonAncestor(Object aNode,
                                     Object bNode)
Returns the least common ancestor of the specified nodes, or null if none exists. If the graph may contain a null node, then some other method must be used to distinguish the two cases.

Specified by:
getLeastCommonAncestor in interface OrientedForest

getDepth

public int getDepth(Object node)
Gets the depth of the specified node.

Specified by:
getDepth in interface OrientedForest

getHeight

public int getHeight(Object node)
Gets the height of the specified node.

Specified by:
getHeight in interface OrientedForest

Plexus v0.13.1

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.