|
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.RBSet
An implementation of the Set interface based on RBTree. Add, contains, remove take logarithmic time.
| Inner Class Summary | |
protected class |
RBSet.RBIterator
|
class |
RBSet.RBNode
|
| Field Summary | |
int |
colorCount
|
int |
rotateCount
|
| Constructor Summary | |
RBSet()
Creates an empty tree |
|
| Method Summary | |
java.lang.Object |
add(java.lang.Object elt)
Add the specified object to the Set. |
void |
clear()
Clears all the items out of this tree |
boolean |
contains(java.lang.Object elt)
Tells if the specified object is contained within this set. |
java.lang.Object |
find(java.lang.Object elt)
Returns the object that is mapped to the given key. |
protected void |
initMemory()
Associates the given key with the given value. |
boolean |
isEmpty()
Returns true if the Tree is empty, false otherwise |
java.util.Iterator |
iterator()
Returns an Iterator for this tree. |
java.lang.Object |
maxElement()
Returns the maximum key in the tree. |
java.lang.Object |
minElement()
Returns the minimum key in the tree. |
java.lang.Object |
nextElement(java.lang.Object elt)
Returns the lowest key that is greater that the specified key. |
java.lang.Object |
prevElement(java.lang.Object elt)
Returns the greatest key that is less that the specified key. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping associated with the specified key from the tree. |
int |
size()
Returns the number of mappings in the tree. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public int rotateCount
public int colorCount
| Constructor Detail |
public RBSet()
| Method Detail |
public java.lang.Object find(java.lang.Object elt)
#containsKey(Object) method to
determine if null return values indicate no
mapping for this key or a mapping to null.find in interface Setkey - The Comparable Object for associated return valueClassCastException - key does not implement Comparablepublic boolean contains(java.lang.Object elt)
contains in interface Seto - The object to search for in the Set.true if the object is contained in the
set, false otherwise.protected void initMemory()
key - The Comparable Object to associate this value with.value - The Object to associate with this key.ClassCastException - key does not implement Comparablepublic java.lang.Object add(java.lang.Object elt)
Setadd in interface Setbrutil.Seto - The object to add to the Set.Object pointer that was replaced by this
add, null otherwise.public java.lang.Object remove(java.lang.Object key)
remove in interface Setkey - The Comparable Object which will be removed from
the tree.ClassCastException - key does not implement Comparablepublic int size()
size in interface Collectionpublic boolean isEmpty()
isEmpty in interface Setbrutil.Settrue if the Set is empty, false
otherwise.public void clear()
clear in interface Collectionpublic java.lang.Object minElement()
minElement in interface SortedSetpublic java.lang.Object maxElement()
maxElement in interface SortedSetpublic java.lang.Object prevElement(java.lang.Object elt)
prevElement in interface SortedSetkey - Comparable object for which to find the previous
key.ClassCastException - key is not Comparablepublic java.lang.Object nextElement(java.lang.Object elt)
nextElement in interface SortedSetkey - Comparable object for which to find the next key.ClassCastException - key is not Comparablepublic java.util.Iterator iterator()
iterator in interface Setpublic java.lang.String toString()
toString in class java.lang.Object
|
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 | |||||||