edu.ksu.cis.viewer
Interface BSTInterface

All Known Implementing Classes:
AATree, AVLTree, BinarySearchTree, PatriciaTrie, RedBlackTree, SplayTree, Trie

public interface BSTInterface

This interface is implemented by each of the data structures whose functionality is equivalent to a binary search tree. Functionality includes the ability to insert and delete String keys, to clone itself, and to draw itself.

Note that this interface does not extend java.lang.Cloneable. This is because implementations may not need to use the clone method of Object in order to clone themselves.

Author:
Rod Howell (howell@cis.ksu.edu)
See Also:
AVLTree, BinarySearchTree, SplayTree, Cloneable, Object

Method Summary
 Object clone()
          Returns a clone of this tree.
 JComponent getDrawing()
          Returns a drawing of the tree.
 JComponent getDrawing(Font fnt)
          Returns a drawing of the tree using the given Font.
 BSTInterface put(String key)
          Returns the result of inserting key into this tree.
 BSTInterface remove(String key)
          Returns the result of removing key from this.
 

Method Detail

put

public BSTInterface put(String key)
                 throws NullPointerException
Returns the result of inserting key into this tree. If key is already in the tree, a tree having the same contents is returned.

Throws:
NullPointerException - If key is null

remove

public BSTInterface remove(String key)
                    throws NullPointerException
Returns the result of removing key from this. If key is not in the tree, a tree having the same contents is returned.

Throws:
NullPointerException - If key is null

getDrawing

public JComponent getDrawing()
Returns a drawing of the tree.


getDrawing

public JComponent getDrawing(Font fnt)
Returns a drawing of the tree using the given Font.

Throws:
NullPointerException - if fnt is null.

clone

public Object clone()
Returns a clone of this tree.