|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--brutil.BSTree
| Inner Class Summary | |
class |
BSTree.BSTIterator
|
class |
BSTree.Entry
|
| Field Summary | |
int |
level
|
protected BSTree.Entry |
root
|
| Constructor Summary | |
|
BSTree()
|
protected |
BSTree(BSTree.Entry root)
Constructor, constructing a tree with one element as its root |
| Method Summary | |
void |
clear()
Clears out the contents of the Collection (optional operation) |
boolean |
containsKey(java.lang.Object key)
Whether or not a specified mapping exists in the tree |
protected BSTree.Entry |
createEntry(BSTree.Entry parent,
java.lang.Object key,
java.lang.Object value)
|
protected java.util.Iterator |
createIterator()
|
int |
depth()
|
protected BSTree.Entry |
findEntry(java.lang.Object key)
|
java.lang.Object |
get(java.lang.Object key)
Find an Object in the Tree, return the Node where object found or null if object is not found |
int |
getSize()
return the size of the tree |
protected void |
initMemory()
|
int |
inputDepth()
|
boolean |
isEmpty()
Returns true if the Collection contains no elements, false otherwise |
java.util.Iterator |
iterator()
Return a binary search tree \iterator |
protected BSTree.Entry |
maxEntry(BSTree.Entry e)
|
java.lang.Object |
maxKey()
return Node with largest key |
protected BSTree.Entry |
minEntry(BSTree.Entry e)
|
java.lang.Object |
minKey()
return Node with the smallest key |
protected BSTree.Entry |
nextEntry(java.lang.Object entry)
|
java.lang.Object |
nextKey(java.lang.Object key)
Returns the smallest key that is greater than the specified key |
protected BSTree.Entry |
prevEntry(java.lang.Object entry)
|
java.lang.Object |
prevKey(java.lang.Object key)
Returns the greatest key that is smaller than the specified key |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object data)
Insert the object accordingly maintaining the binary search tree structure |
java.lang.Object |
remove(java.lang.Object key)
Find the object and delete it from the tree, return true after after deleting succesfully, return false otherwise |
void |
removeAll()
remove all element in the tree |
int |
size()
Default constructor, constructing an empty tree |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected BSTree.Entry root
public int level
| Constructor Detail |
public BSTree()
protected BSTree(BSTree.Entry root)
key - and associate data of a root node| Method Detail |
public int size()
size in interface Collectionnone - public boolean isEmpty()
CollectionisEmpty in interface Collectionpublic void clear()
Collectionclear in interface Collectionprotected void initMemory()
protected BSTree.Entry createEntry(BSTree.Entry parent,
java.lang.Object key,
java.lang.Object value)
public java.lang.Object get(java.lang.Object key)
get in interface MapObject - comparable
public java.lang.Object put(java.lang.Object key,
java.lang.Object data)
put in interface Mapkey - has to be Object comparable.ClassCastException - if the key is not comparablepublic java.lang.Object remove(java.lang.Object key)
remove in interface MapObject - comparableClassCastException - if key is not comparablepublic java.lang.Object nextKey(java.lang.Object key)
nextKey in interface SortedMapObject - comparableClassCastException - if key is not comparablepublic java.lang.Object prevKey(java.lang.Object key)
prevKey in interface SortedMapObject - comparableClassCastException - if key is not comparableprotected BSTree.Entry nextEntry(java.lang.Object entry)
protected BSTree.Entry prevEntry(java.lang.Object entry)
protected BSTree.Entry minEntry(BSTree.Entry e)
protected BSTree.Entry maxEntry(BSTree.Entry e)
protected BSTree.Entry findEntry(java.lang.Object key)
public java.util.Iterator iterator()
iterator in interface SortedMapprotected java.util.Iterator createIterator()
public java.lang.Object minKey()
minKey in interface SortedMappublic java.lang.Object maxKey()
maxKey in interface SortedMappublic boolean containsKey(java.lang.Object key)
containsKey in interface MapObject - comparableClassCastException - if key is not comparablepublic void removeAll()
public int getSize()
Object - comparablepublic int depth()
public int inputDepth()
|
BRUtil - Making Java a Kinder, Gentler, Place to be. |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||