public class RBTree<T extends Comparable> extends Object
For an introduction to this package see Overview .
| Modifier and Type | Field and Description |
|---|---|
protected int |
count_ |
FireEvent |
firstFire
save time for noTillInputEvent iteration
|
InputEvent |
firstInput
save time for noTillFireEvent iteration
|
Map |
flags |
boolean |
iterExit
make iterate exit
|
| Constructor and Description |
|---|
RBTree()
Constructs a new empty tree.
|
RBTree(RBCell<T> x)
Constructs a new tree with a root node x.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(T element)
Implements collections.UpdatableBag.add.
|
void |
addIfAbsent(T element)
Implements collections.UpdatableBag.addIfAbsent
Time complexity: O(log n).
|
void |
clear()
Implements collections.UpdatableCollection.clear.
|
protected void |
decCount() |
void |
exclude(T element)
Implements collections.UpdatableCollection.exclude.
|
protected void |
incCount() |
boolean |
includes(T element)
Implements collections.Collection.includes.
|
void |
inorderTreeWalk(RBCell<T> x,
PrintStream p)
Prints the keys of current tree in inorder (ascending).
|
void |
inorderTreeWalk(RBCell<T> x,
StringWrap p) |
int |
occurrencesOf(T element)
Implements collections.Collection.occurrencesOf.
|
void |
removeOneOf(T element)
Implements collections.UpdatableCollection.removeOneOf.
|
void |
replaceAllOf(T oldElement,
T newElement)
Implements collections.UpdatableCollection.replaceAllOf.
|
void |
replaceOneOf(T oldElement,
T newElement)
Implements collections.UpdatableCollection.replaceOneOf
Time complexity: O(log n).
|
RBCell<T> |
root()
Returns the root of the tree.
|
protected void |
setCount(int c)
set the element count and update version_ if changed
|
T |
take()
Implements collections.UpdatableCollection.take.
|
boolean |
treeNoTillFireEvent(RBCell<T> x) |
boolean |
treeNoTillFireEvent2(RBCell<T> x) |
boolean |
treeNoTillInputEvent(RBCell<T> x) |
protected int count_
public boolean iterExit
public InputEvent firstInput
public RBTree()
protected final void incCount()
protected final void decCount()
protected final void setCount(int c)
public boolean includes(T element)
collections.Collection#includespublic int occurrencesOf(T element)
collections.Collection#occurrencesOfpublic void clear()
collections.UpdatableCollection#clearpublic void exclude(T element)
collections.UpdatableCollection#excludepublic void removeOneOf(T element)
collections.UpdatableCollection#removeOneOfpublic void replaceOneOf(T oldElement, T newElement)
collections.UpdatableCollection#replaceOneOfpublic void replaceAllOf(T oldElement, T newElement)
collections.UpdatableCollection#replaceAllOfpublic T take()
collections.UpdatableCollection#takepublic void addIfAbsent(T element)
collections.UpdatableBag#addIfAbsentpublic void add(T element)
collections.UpdatableBag#addpublic boolean treeNoTillFireEvent(RBCell<T> x)
public boolean treeNoTillFireEvent2(RBCell<T> x)
public boolean treeNoTillInputEvent(RBCell<T> x)
public void inorderTreeWalk(RBCell<T> x, PrintStream p)
x - The node from which to start.public void inorderTreeWalk(RBCell<T> x, StringWrap p)