biTree
Class BiTree

java.lang.Object
  |
  +--biTree.BiTree
All Implemented Interfaces:
java.lang.Comparable, WeightCompare

public class BiTree
extends java.lang.Object
implements java.lang.Comparable, WeightCompare

The concrete instance of WeightCompare that makes up the root and limbs of a binary tree.

Author:
Chad Cook

Field Summary
(package private)  WeightCompare _leftChild
           
(package private)  WeightCompare _rightChild
           
(package private)  java.lang.Integer _weight
           
 
Constructor Summary
BiTree(WeightCompare leftChild, WeightCompare rightChild)
          Constructor for BiTree
 
Method Summary
 int compareTo(java.lang.Object wc)
          The required compareTo method from Comparable.
 void execute(Visitor v)
          The hook for my visitors
 WeightCompare getLeftChild()
          Getter for left child
 WeightCompare getRightChild()
          Getter for right child
 java.lang.Integer getWeight()
          Getter for weight
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_weight

java.lang.Integer _weight

_leftChild

WeightCompare _leftChild

_rightChild

WeightCompare _rightChild
Constructor Detail

BiTree

public BiTree(WeightCompare leftChild,
              WeightCompare rightChild)
Constructor for BiTree
Parameters:
WeightCompare - The left child
WeightCompare - The right child
Method Detail

getLeftChild

public WeightCompare getLeftChild()
Getter for left child
Returns:
The left child of this BiTree

getRightChild

public WeightCompare getRightChild()
Getter for right child
Returns:
The right child of this BiTree

getWeight

public java.lang.Integer getWeight()
Getter for weight
Specified by:
getWeight in interface WeightCompare
Returns:
The weight of this BiTree

compareTo

public int compareTo(java.lang.Object wc)
The required compareTo method from Comparable. Compares the two weights, which are Integers.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
Object - What to compare this BiTree to. Must be of type WeightCompare.
Returns:
The result of comparing the weights.

execute

public void execute(Visitor v)
The hook for my visitors
Specified by:
execute in interface WeightCompare
Parameters:
Visitor - The visitor