/** * A simple binary tree. Most of the manipulation is done via * BinaryTreeCursors. * * @author Samuel A. Rebelsky * @version 1.0 of April 1999 */ public interface BinaryTree { // +---------+------------------------------------------------- // | Methods | // +---------+ /** * Determine the number of elements in the tree. * Pre: The tree is initialized. * Post: Returns the number of elements in the tree. */ public int size(); /** * Determine the depth of the tree. * Pre: The tree is initialized and nonempty. * Post: Returns the depth of the tree. */ public int depth(); /** * Create a new cursor at the root of the tree. * Pre: The tree is initialized and nonempty. * Post: Returns a cursor at the root of the tree. */ public BinaryTreeCursor rootCursor(); /** * Set the value at the root of the tree. * Pre: The tree is initialized and empty. * Post: The value at the root of the tree is newValue. */ public void setRoot(Object newValue); } // interface BinaryTree