Source of 24.8.java


  1: public T getRootData()
  2: {
  3:    if (isEmpty())
  4:       throw new EmptyTreeException();
  5:    else
  6:       return root.getData();
  7: } // end getRootData
  8: 
  9: public boolean isEmpty()
 10: {
 11:    return root == null;
 12: } // end isEmpty
 13: 
 14: public void clear()
 15: {
 16:    root = null;
 17: } // end clear
 18: 
 19: protected void setRootData(T rootData)
 20: {
 21:    root.setData(rootData);
 22: } // end setRootData
 23: 
 24: protected void setRootNode(BinaryNode<T> rootNode)
 25: {
 26:    root = rootNode;
 27: } // end setRootNode
 28: 
 29: protected BinaryNode<T> getRootNode()
 30: {
 31:    return root;
 32: } // end getRootNode
 33: // Version 4.0