com.phoenixst.plexus

Class TrivialOrientedForestView

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
TraverserchildTraverser(Object node)
This implementation returns an empty Traverser.
intgetDepth(Object node)
This implementation returns 0.
GraphgetGraph()
intgetHeight(Object node)
This implementation returns 0.
ObjectgetLeastCommonAncestor(Object aNode, Object bNode)
This implementation returns aNode if the specified nodes are equal, and null otherwise.
ObjectgetParent(Object node)
This implementation returns null.
Graph.EdgegetParentEdge(Object node)
This implementation returns null.
ObjectgetParentEndpoint(Graph.Edge edge)
This implementation throws an IllegalArgumentException.
ObjectgetRoot(Object node)
This implementation returns the specified node.
booleanisAncestor(Object ancestor, Object descendant)
This implementation returns true if the specified nodes are equal, and false otherwise.
booleanisForestEdge(Graph.Edge edge)
This implementation returns false.
booleanisLeaf(Object node)
This implementation returns true.
CollectionrootNodes()
This implementation returns all nodes.

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

childTraverser

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

Description copied from interface: OrientedForest
{@inheritDoc }

getDepth

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

Description copied from interface: OrientedForest
{@inheritDoc }

getGraph

public Graph getGraph()

getHeight

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

Description copied from interface: OrientedForest
{@inheritDoc }

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
{@inheritDoc }

getParent

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

Description copied from interface: OrientedForest
{@inheritDoc }

getParentEdge

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

Description copied from interface: OrientedForest
{@inheritDoc }

getParentEndpoint

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

Description copied from interface: OrientedForest
{@inheritDoc }

getRoot

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

Description copied from interface: OrientedForest
{@inheritDoc }

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
{@inheritDoc }

isForestEdge

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

Description copied from interface: OrientedForest
{@inheritDoc }

isLeaf

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

Description copied from interface: OrientedForest
{@inheritDoc }

rootNodes

public Collection rootNodes()
This implementation returns all nodes.

Description copied from interface: OrientedForest
{@inheritDoc }

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.