Plexus v0.13.1

com.phoenixst.plexus
Interface OrientedForest

All Known Subinterfaces:
RootedTree
All Known Implementing Classes:
AbstractOrientedForest, DefaultOrientedForest, DefaultOrientedForestView, DefaultRootedTreeView, DepthFirstForestView, DepthFirstTreeView, FileSystemForest, ForestTreeAdapter, ForestTreeExtension, TrivialOrientedForestView

public interface OrientedForest

A data structure with parent/child relationships. Each node may have at most one adjacent node distinguished as being its "parent", and the data structure should be acyclic under the parent operation. The following are definitions for other terms used here (and elsewhere):

The word "oriented" was chosen instead of the more commonly used "directed" because the directedness of the edges need not have any bearing on the parent-child relationships.

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

Method Summary
 Traverser childTraverser(Object node)
          Traverses over the children of the specified node.
 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.
 Graph.Edge getParentEdge(Object node)
          Gets the parent Edge 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.
 Collection rootNodes()
          Returns the root nodes of this forest.
 

Method Detail

getParent

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


childTraverser

Traverser childTraverser(Object node)
Traverses over the children of the specified node.


getParentEdge

Graph.Edge getParentEdge(Object node)
Gets the parent Edge of the specified node, or null if it doesn't have one.


isForestEdge

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


getParentEndpoint

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.


rootNodes

Collection rootNodes()
Returns the root nodes of this forest.


getRoot

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


isLeaf

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


isAncestor

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


getLeastCommonAncestor

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


getDepth

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


getHeight

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


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.