Plexus v0.13.1

com.phoenixst.plexus
Class TrivialOrientedForestView

java.lang.Object
  extended by com.phoenixst.plexus.TrivialOrientedForestView
All Implemented Interfaces:
GraphView, OrientedForest

public class TrivialOrientedForestView
extends Object
implements GraphView, OrientedForest

A trivial OrientedForest view of a Graph, where there is no forest structure. No Graph.Edges are forest edges, and so all nodes are roots and leaves.

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

Constructor Summary
TrivialOrientedForestView(Graph graph)
          Creates a new TrivialForestView with strict node- and edge-checking semantics.
TrivialOrientedForestView(Graph graph, boolean isStrict)
          Creates a new TrivialForestView with the specified node- and edge-checking semantics.
 
Method Summary
 Traverser childTraverser(Object node)
          This implementation returns an empty Traverser.
 int getDepth(Object node)
          This implementation returns 0.
 Graph getGraph()
          Returns the Graph of which this is a view.
 int getHeight(Object node)
          This implementation returns 0.
 Object getLeastCommonAncestor(Object aNode, Object bNode)
          This implementation returns aNode if the specified nodes are equal, and null otherwise.
 Object getParent(Object node)
          This implementation returns null.
 Graph.Edge getParentEdge(Object node)
          This implementation returns null.
 Object getParentEndpoint(Graph.Edge edge)
          This implementation throws an IllegalArgumentException.
 Object getRoot(Object node)
          This implementation returns the specified node.
 boolean isAncestor(Object ancestor, Object descendant)
          This implementation returns true if the specified nodes are equal, and false otherwise.
 boolean isForestEdge(Graph.Edge edge)
          This implementation returns false.
 boolean isLeaf(Object node)
          This implementation returns true.
 Collection rootNodes()
          This implementation returns all nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrivialOrientedForestView

public TrivialOrientedForestView(Graph graph)
Creates a new TrivialForestView with strict node- and edge-checking semantics.


TrivialOrientedForestView

public TrivialOrientedForestView(Graph graph,
                                 boolean isStrict)
Creates a new TrivialForestView with the specified node- and edge-checking semantics. If isStrict is true, passing in a node or edge into this view which is not contained in the underlying Graph will cause an exception to be thrown.

Method Detail

getGraph

public Graph getGraph()
Description copied from interface: GraphView
Returns the Graph of which this is a view.

Specified by:
getGraph in interface GraphView

getParent

public Object getParent(Object node)
This implementation returns null.

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

Specified by:
getParent in interface OrientedForest

childTraverser

public Traverser childTraverser(Object node)
This implementation returns an empty Traverser.

Description copied from interface: OrientedForest
Traverses over the children of the specified node.

Specified by:
childTraverser in interface OrientedForest

getParentEdge

public Graph.Edge getParentEdge(Object node)
This implementation returns null.

Description copied from interface: OrientedForest
Gets the parent Edge of the specified node, or null if it doesn't have one.

Specified by:
getParentEdge in interface OrientedForest

isForestEdge

public boolean isForestEdge(Graph.Edge edge)
This implementation returns false.

Description copied from interface: OrientedForest
Gets whether or not the specified Edge is a forest edge.

Specified by:
isForestEdge in interface OrientedForest

getParentEndpoint

public Object getParentEndpoint(Graph.Edge edge)
This implementation throws an IllegalArgumentException.

Description copied from interface: OrientedForest
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

rootNodes

public Collection rootNodes()
This implementation returns all nodes.

Description copied from interface: OrientedForest
Returns the root nodes of this forest.

Specified by:
rootNodes in interface OrientedForest

getRoot

public Object getRoot(Object node)
This implementation returns the specified node.

Description copied from interface: OrientedForest
Gets the root of the subgraph containing the specified node.

Specified by:
getRoot in interface OrientedForest

isLeaf

public boolean isLeaf(Object node)
This implementation returns true.

Description copied from interface: OrientedForest
Returns true if the specified node has no children.

Specified by:
isLeaf in interface OrientedForest

isAncestor

public boolean isAncestor(Object ancestor,
                          Object descendant)
This implementation returns true if the specified nodes are equal, and false otherwise.

Description copied from interface: OrientedForest
Returns true if ancestor is actually an ancestor of descendant.

Specified by:
isAncestor in interface OrientedForest

getLeastCommonAncestor

public Object getLeastCommonAncestor(Object aNode,
                                     Object bNode)
This implementation returns aNode if the specified nodes are equal, and null otherwise.

Description copied from interface: OrientedForest
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.

Specified by:
getLeastCommonAncestor in interface OrientedForest

getDepth

public int getDepth(Object node)
This implementation returns 0.

Description copied from interface: OrientedForest
Gets the depth of the specified node.

Specified by:
getDepth in interface OrientedForest

getHeight

public int getHeight(Object node)
This implementation returns 0.

Description copied from interface: OrientedForest
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.