Source of 25.8.java


  1: // @author Frank M. Carrano, Timothy M. Henry
  2: // @version 5.0

  4: public void setRootData(T rootData)
  5: {
  6:    root.setData(rootData);
  7: } // end setRootData

  9: public T getRootData()
 10: {
 11:    if (isEmpty())
 12:       throw new EmptyTreeException();
 13:    else
 14:       return root.getData();
 15: } // end getRootData

 17: public boolean isEmpty()
 18: {
 19:    return root == null;
 20: } // end isEmpty

 22: public void clear()
 23: {
 24:    root = null;
 25: } // end clear

 27: protected void setRootNode(BinaryNode<T> rootNode)
 28: {
 29:    root = rootNode;
 30: } // end setRootNode

 32: protected BinaryNode<T> getRootNode()
 33: {
 34:    return root;
 35: } // end getRootNode