Package edu.ksu.cis.viewer
Interface BSTInterface
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AATree
,AVLTree
,BinarySearchTree
,PatriciaTrie
,RedBlackTree
,SplayTree
,Trie
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 (rhowell@ksu.edu)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of this tree.Returns a drawing of the tree.getDrawing
(Font fnt) Returns a drawing of the tree using the given Font.Returns the result of insertingkey
into this tree.Returns the result of removingkey
from this.
-
Method Details
-
put
Returns the result of insertingkey
into this tree. Ifkey
is already in the tree, a tree having the same contents is returned.- Parameters:
key
- the key to insert- Returns:
- the resutling tree
- Throws:
NullPointerException
- Ifkey
isnull
-
remove
Returns the result of removingkey
from this. Ifkey
is not in the tree, a tree having the same contents is returned.- Parameters:
key
- the key to remove- Returns:
- the resulting tree
- Throws:
NullPointerException
- If key isnull
-
getDrawing
JComponent getDrawing()Returns a drawing of the tree.- Returns:
- a drawing of the tree
-
getDrawing
Returns a drawing of the tree using the given Font.- Parameters:
fnt
- the font to use- Returns:
- a drawing of the tree
- Throws:
NullPointerException
- iffnt
isnull
.
-
clone
Object clone()Returns a clone of this tree.- Returns:
- a clone of the this tree
-