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
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
_weight
java.lang.Integer _weight
_leftChild
WeightCompare _leftChild
_rightChild
WeightCompare _rightChild
BiTree
public BiTree(WeightCompare leftChild,
WeightCompare rightChild)
- Constructor for BiTree
- Parameters:
WeightCompare
- The left childWeightCompare
- The right child
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