|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jdsl.core.ref.RBTree
A Red Black tree. Implemented using a RestructurableNodeBinaryTree.
| Constructor Summary | |
RBTree(Comparator comparator)
The class's constructor. |
|
| Method Summary | |
Locator |
after(Locator locator)
Finds the locator after the passed in Locator. |
Locator |
before(Locator locator)
Finds the locator before the passed in Locator |
Locator |
closestAfter(java.lang.Object key)
Finds the Locator that comes right after a Locator with the given key |
Locator |
closestBefore(java.lang.Object key)
Finds the Locator that comes right before a Locator with the given key in the tree. |
Comparator |
comparator()
Retrieves the Comparator. |
java.util.Enumeration |
elements()
Produces an Enumeration of the elements of all the Locators in the tree |
Locator |
find(java.lang.Object key)
Finds the Locator with the given key |
java.util.Enumeration |
findAll(java.lang.Object key)
Finds all of the locators in the tree with the given key |
Position |
findInSubtree(java.lang.Object key,
Position subtreeRoot)
a helper method that will return the position is key is found or the position where the key would be (i.e. |
InspectableBinaryTree |
getTree()
Returns the underlying tree. |
void |
insert(Locator locator)
Inserts a locator into the tree. |
Locator |
insert(java.lang.Object key,
java.lang.Object element)
Inserts a new key element pair into the tree. |
boolean |
isEmpty()
|
java.util.Enumeration |
keys()
Returns an Enumeration of all the keys within this Container. |
java.util.Enumeration |
locators()
Returns an enumeration of colors |
Locator |
makeLocator(java.lang.Object key,
java.lang.Object element)
Produces a Locator that is ready to be inserted. |
Container |
newContainer()
|
void |
remove(Locator locator)
|
java.lang.Object |
replaceElement(Locator loc,
java.lang.Object newElement)
Replaces the element of the passed in locator |
java.lang.Object |
replaceKey(Locator locator,
java.lang.Object key)
Replaces the key of the passed in locator |
Comparator |
setComparator(Comparator c)
Sets the Comparator to be used in this container. |
int |
size()
|
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public RBTree(Comparator comparator)
RBTLocator which is black.comparator - the comparator for this dictionary| Method Detail |
public Comparator comparator()
Comparator.Comparator that is used by this
PriorityQueue.
public Locator find(java.lang.Object key)
throws InvalidKeyException
key - The search key.
public java.util.Enumeration findAll(java.lang.Object key)
throws InvalidKeyException
key - The search key.Enumeration of the found locators
public Locator closestBefore(java.lang.Object key)
throws InvalidKeyException
key - The key to search forLocator if it exists.
public Locator closestAfter(java.lang.Object key)
throws InvalidKeyException
key - The key of the Locator to find the closestAfterLocator if it exists
public Locator after(Locator locator)
throws InvalidLocatorException
locator - Locator after locator, or BOUNDARY_VIOLATION
if it doesn't exist.
public Locator before(Locator locator)
throws InvalidLocatorException
locator - Locator before locator, or BOUNDARY_VIOLATION
if it doesn't exist.
public Position findInSubtree(java.lang.Object key,
Position subtreeRoot)
throws InvalidKeyException
key - The search key.subtreeRoot - Where the search will start.Position
public void insert(Locator locator)
throws InvalidKeyException,
InvalidLocatorException,
ContainedLocatorException
locator - The Locator to insert.
public Locator insert(java.lang.Object key,
java.lang.Object element)
throws InvalidKeyException,
ContainedLocatorException
locator - The Locator to insert.
public void remove(Locator locator)
throws InvalidLocatorException
public java.lang.Object replaceKey(Locator locator,
java.lang.Object key)
throws InvalidLocatorException,
InvalidKeyException
locator - The Locator whose key will be replaced.key - The new key
public java.lang.Object replaceElement(Locator loc,
java.lang.Object newElement)
throws InvalidLocatorException
locator - The Locator whose element will be replaced.newElement - The new elementpublic java.util.Enumeration locators()
public java.util.Enumeration keys()
Enumeration is returned.elements,
Enumeration
public Locator makeLocator(java.lang.Object key,
java.lang.Object element)
key - The new Locator's key.element - The new Locator's element.Locatorpublic java.util.Enumeration elements()
Enumerationpublic Container newContainer()
public int size()
public boolean isEmpty()
public InspectableBinaryTree getTree()
public Comparator setComparator(Comparator c)
c - The comparator to use.Comparator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||