Plexus v0.13.1

com.phoenixst.plexus.examples
Class CompleteTree

java.lang.Object
  extended by com.phoenixst.plexus.AbstractGraph
      extended by com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
          extended by com.phoenixst.plexus.examples.CompleteTree
All Implemented Interfaces:
Graph, Serializable

public class CompleteTree
extends AbstractIntegerNodeGraph

A Graph which is a complete tree.

Since:
1.0
Version:
$Revision: 1.32 $
Author:
Ray A. Conner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
AbstractIntegerNodeGraph.AbstractIntegerEdgeCollection, AbstractIntegerNodeGraph.EdgeImpl
 
Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph
Graph.Edge
 
Constructor Summary
CompleteTree(int height, int numChildren)
          Creates a new CompleteTree.
 
Method Summary
protected  Graph.Edge createEdge(int tailIndex, int headIndex)
          If an edge exists between the specified indices, create and return it.
protected  Collection createEdgeCollection()
          Creates the (single) collection of edges for this instance.
protected  Traverser createTraverser(int nodeIndex)
          Creates a traverser with no filtering; assumes that the node index is valid.
 int degree(Object node)
          Returns the degree of node, defined as the number of edges incident on node.
 int getHeight()
          Gets the height of this CompleteTree.
 int getNumChildren()
          Gets the number of children of each internal node in this CompleteTree.
 String toString()
           
 
Methods inherited from class com.phoenixst.plexus.examples.AbstractIntegerNodeGraph
checkNode, containsEdge, containsNode, edges, getNodeIndex, getNodeSize, nodes, removeEdge, removeNode, traverser
 
Methods inherited from class com.phoenixst.plexus.AbstractGraph
addEdge, addNode, adjacentNodes, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompleteTree

public CompleteTree(int height,
                    int numChildren)
Creates a new CompleteTree. A tree of height 0 is just a single root node (numChildren is ignored in this case).

Method Detail

getHeight

public final int getHeight()
Gets the height of this CompleteTree.


getNumChildren

public final int getNumChildren()
Gets the number of children of each internal node in this CompleteTree.


degree

public int degree(Object node)
Returns the degree of node, defined as the number of edges incident on node.

Specified by:
degree in interface Graph
Overrides:
degree in class AbstractGraph
Parameters:
node - return the degree of this node.
Returns:
the degree of node.

createEdge

protected Graph.Edge createEdge(int tailIndex,
                                int headIndex)
Description copied from class: AbstractIntegerNodeGraph
If an edge exists between the specified indices, create and return it. If not, return null. The indices are assumed to represent valid nodes for this Graph.

Specified by:
createEdge in class AbstractIntegerNodeGraph

createEdgeCollection

protected Collection createEdgeCollection()
Description copied from class: AbstractIntegerNodeGraph
Creates the (single) collection of edges for this instance.

Specified by:
createEdgeCollection in class AbstractIntegerNodeGraph

createTraverser

protected Traverser createTraverser(int nodeIndex)
Description copied from class: AbstractIntegerNodeGraph
Creates a traverser with no filtering; assumes that the node index is valid.

Specified by:
createTraverser in class AbstractIntegerNodeGraph

toString

public String toString()
Overrides:
toString in class Object

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.