jdsl
Class SimpleBinarySearchTree

java.lang.Object
  |
  +--jdsl.SimpleBinarySearchTree
Direct Known Subclasses:
SimpleAVLTree, SimpleRBTree

public class SimpleBinarySearchTree
extends java.lang.Object
implements SimpleDictionary


Field Summary
protected  Position actionPos
           
 
Constructor Summary
SimpleBinarySearchTree(Comparator c)
           
 
Method Summary
protected  void checkKey(java.lang.Object key)
           
protected  java.lang.Object element(Position position)
           
 java.util.Iterator elements()
           
protected  ArrayListIter findAllArrayListIter(java.lang.Object key, Position pos)
           
 java.util.Iterator findAllElements(java.lang.Object key)
           
 java.lang.Object findElement(java.lang.Object key)
           
protected  Position findPosition(java.lang.Object key, Position pos)
           
 void insertItem(java.lang.Object key, java.lang.Object element)
           
 boolean isEmpty()
           
protected  java.lang.Object key(Position position)
           
 java.util.Iterator keys()
           
 Container newContainer()
          Make a new container of this type using the same comparator
 java.lang.Object remove(java.lang.Object key)
           
 java.util.Iterator removeAll(java.lang.Object key)
           
 int size()
           
protected  void swap(Position swapPos, Position remPos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionPos

protected Position actionPos
Constructor Detail

SimpleBinarySearchTree

public SimpleBinarySearchTree(Comparator c)
Method Detail

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)