Class BinaryTree<T>

java.lang.Object
  extended by BinaryTreeBasis<T>
      extended by BinaryTree<T>

public class BinaryTree<T>
extends BinaryTreeBasis<T>


Constructor Summary
BinaryTree()
          The default constructor for BinaryTree initializes the BinaryTree to be empty.
BinaryTree(T rootItem)
          This constructor for BinaryTree initializes the BinaryTree to have a root containing the specified data item.
BinaryTree(T rootItem, BinaryTree<T> leftTree, BinaryTree<T> rightTree)
          This constructor for BinaryTree initializes the BinaryTree to have a root containing the specified data item.
 
Method Summary
 void setRootItem(T newItem)
          This method will place the specified data item in the root node of this BinaryTree.
 
Methods inherited from class BinaryTreeBasis
getRoot, getRootItem, isEmpty, makeEmpty, setRoot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryTree

public BinaryTree()
The default constructor for BinaryTree initializes the BinaryTree to be empty.


BinaryTree

public BinaryTree(T rootItem)
This constructor for BinaryTree initializes the BinaryTree to have a root containing the specified data item.

Parameters:
rootItem - The data item that will be contained by the root of this BinaryTree

BinaryTree

public BinaryTree(T rootItem,
                  BinaryTree<T> leftTree,
                  BinaryTree<T> rightTree)
This constructor for BinaryTree initializes the BinaryTree to have a root containing the specified data item. This constructor also initializes the left subtree and right subtree of the root to the specified parameters.

Parameters:
rootItem - The data item that will be contained by the root of this BinaryTree
leftTree - The left subtree of the root
rightTree - The right subtree of the root
Method Detail

setRootItem

public void setRootItem(T newItem)
This method will place the specified data item in the root node of this BinaryTree. If the BinaryTree already has a root node, its data item is updated. If the BinaryTree does not have a root node, a new root is created and it will contain the specified data item.

Specified by:
setRootItem in class BinaryTreeBasis<T>
Parameters:
newItem - The data item that will be contained by the root of this BinaryTree