jdsl
Class SimpleBinarySearchTree
java.lang.Object
|
+--jdsl.SimpleBinarySearchTree
- Direct Known Subclasses:
- SimpleAVLTree, SimpleRBTree
- public class SimpleBinarySearchTree
- extends java.lang.Object
- implements SimpleDictionary
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
actionPos
protected Position actionPos
SimpleBinarySearchTree
public SimpleBinarySearchTree(Comparator c)
key
protected java.lang.Object key(Position position)
element
protected java.lang.Object element(Position position)
checkKey
protected void checkKey(java.lang.Object key)
throws InvalidKeyException
findPosition
protected Position findPosition(java.lang.Object key,
Position pos)
findAllArrayListIter
protected ArrayListIter findAllArrayListIter(java.lang.Object key,
Position pos)
size
public int size()
isEmpty
public boolean isEmpty()
findElement
public java.lang.Object findElement(java.lang.Object key)
throws InvalidKeyException
- Specified by:
- findElement in interface SimpleDictionary
findAllElements
public java.util.Iterator findAllElements(java.lang.Object key)
throws InvalidKeyException
- Specified by:
- findAllElements in interface SimpleDictionary
insertItem
public void insertItem(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException
- Specified by:
- insertItem in interface SimpleDictionary
remove
public java.lang.Object remove(java.lang.Object key)
throws InvalidKeyException
- Specified by:
- remove in interface SimpleDictionary
removeAll
public java.util.Iterator removeAll(java.lang.Object key)
throws InvalidKeyException
- Specified by:
- removeAll in interface SimpleDictionary
keys
public java.util.Iterator keys()
- Specified by:
- keys in interface SimpleDictionary
elements
public java.util.Iterator elements()
- Specified by:
- elements in interface SimpleDictionary
newContainer
public Container newContainer()
- Make a new container of this type using the same comparator
swap
protected void swap(Position swapPos,
Position remPos)