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#includes
public int occurrencesOf(T element)
collections.Collection#occurrencesOf
public void clear()
collections.UpdatableCollection#clear
public void exclude(T element)
collections.UpdatableCollection#exclude
public void removeOneOf(T element)
collections.UpdatableCollection#removeOneOf
public void replaceOneOf(T oldElement, T newElement)
collections.UpdatableCollection#replaceOneOf
public void replaceAllOf(T oldElement, T newElement)
collections.UpdatableCollection#replaceAllOf
public T take()
collections.UpdatableCollection#take
public void addIfAbsent(T element)
collections.UpdatableBag#addIfAbsent
public void add(T element)
collections.UpdatableBag#add
public 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)