All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class collections.RBTree

java.lang.Object
   |
   +----collections.UpdatableImpl
           |
           +----collections.UpdatableBagImpl
                   |
                   +----collections.RBTree

public class RBTree
extends UpdatableBagImpl
implements UpdatableBag, ElementSortedCollection
RedBlack trees.


Variable Index

 o cmp_
The comparator to use for ordering.
 o tree_
The root of the tree.

Constructor Index

 o RBTree()
Make an empty tree.
 o RBTree(Comparator)
Make an empty tree, using the supplied element comparator for ordering.
 o RBTree(Predicate)
Make an empty tree, using the supplied element screener.
 o RBTree(Predicate, Comparator)
Make an empty tree, using the supplied element screener and comparator
 o RBTree(Predicate, Comparator, RBCell, int)
Special version of constructor needed by clone()

Method Index

 o add(Object)
Implements collections.UpdatableBag.add.
 o addIfAbsent(Object)
Implements collections.UpdatableBag.addIfAbsent Time complexity: O(log n).
 o checkImplementation()
Implements collections.ImplementationCheckable.checkImplementation.
 o clear()
Implements collections.UpdatableCollection.clear.
 o clone()
Make an indepenent copy of the tree.
 o elementComparator()
Implements collections.ElementSortedCollection.elementComparator Time complexity: O(1).
 o elementComparator(Comparator)
Reset the comparator.
 o elements()
Implements collections.Collection.elements.
 o exclude(Object)
Implements collections.UpdatableCollection.exclude.
 o includes(Object)
Implements collections.Collection.includes.
 o occurrencesOf(Object)
Implements collections.Collection.occurrencesOf.
 o removeOneOf(Object)
Implements collections.UpdatableCollection.removeOneOf.
 o replaceAllOf(Object, Object)
Implements collections.UpdatableCollection.replaceAllOf.
 o replaceOneOf(Object, Object)
Implements collections.UpdatableCollection.replaceOneOf Time complexity: O(log n).
 o take()
Implements collections.UpdatableCollection.take.

Variables

 o tree_
 protected RBCell tree_
The root of the tree. Null if empty.

 o cmp_
 protected Comparator cmp_
The comparator to use for ordering.

Constructors

 o RBTree
 public RBTree()
Make an empty tree. Initialize to use DefaultComparator for ordering

 o RBTree
 public RBTree(Predicate s)
Make an empty tree, using the supplied element screener. Initialize to use DefaultComparator for ordering

 o RBTree
 public RBTree(Comparator c)
Make an empty tree, using the supplied element comparator for ordering.

 o RBTree
 public RBTree(Predicate s,
               Comparator c)
Make an empty tree, using the supplied element screener and comparator

 o RBTree
 protected RBTree(Predicate s,
                  Comparator cmp,
                  RBCell t,
                  int n)
Special version of constructor needed by clone()

Methods

 o clone
 protected Object clone() throws CloneNotSupportedException
Make an indepenent copy of the tree. Does not clone elements.

Overrides:
clone in class Object
 o includes
 public synchronized boolean includes(Object element)
Implements collections.Collection.includes. Time complexity: O(log n).

Overrides:
includes in class UpdatableImpl
See Also:
includes
 o occurrencesOf
 public synchronized int occurrencesOf(Object element)
Implements collections.Collection.occurrencesOf. Time complexity: O(log n).

Overrides:
occurrencesOf in class UpdatableImpl
See Also:
occurrencesOf
 o elements
 public synchronized CollectionEnumeration elements()
Implements collections.Collection.elements. Time complexity: O(1).

Overrides:
elements in class UpdatableImpl
See Also:
elements
 o elementComparator
 public synchronized Comparator elementComparator()
Implements collections.ElementSortedCollection.elementComparator Time complexity: O(1).

See Also:
elementComparator
 o elementComparator
 public synchronized void elementComparator(Comparator cmp)
Reset the comparator. Will cause a reorganization of the tree. Time complexity: O(n log n).

 o clear
 public synchronized void clear()
Implements collections.UpdatableCollection.clear. Time complexity: O(1).

Overrides:
clear in class UpdatableImpl
See Also:
clear
 o exclude
 public synchronized void exclude(Object element)
Implements collections.UpdatableCollection.exclude. Time complexity: O(log n * occurrencesOf(element)).

Overrides:
exclude in class UpdatableImpl
See Also:
exclude
 o removeOneOf
 public synchronized void removeOneOf(Object element)
Implements collections.UpdatableCollection.removeOneOf. Time complexity: O(log n).

Overrides:
removeOneOf in class UpdatableImpl
See Also:
removeOneOf
 o replaceOneOf
 public synchronized void replaceOneOf(Object oldElement,
                                       Object newElement) throws IllegalElementException
Implements collections.UpdatableCollection.replaceOneOf Time complexity: O(log n).

Overrides:
replaceOneOf in class UpdatableImpl
See Also:
replaceOneOf
 o replaceAllOf
 public synchronized void replaceAllOf(Object oldElement,
                                       Object newElement) throws IllegalElementException
Implements collections.UpdatableCollection.replaceAllOf. Time complexity: O(log n * occurrencesOf(oldElement)).

Overrides:
replaceAllOf in class UpdatableImpl
See Also:
replaceAllOf
 o take
 public synchronized Object take() throws NoSuchElementException
Implements collections.UpdatableCollection.take. Time complexity: O(log n). Takes the least element.

Overrides:
take in class UpdatableImpl
See Also:
take
 o addIfAbsent
 public synchronized void addIfAbsent(Object element) throws IllegalElementException
Implements collections.UpdatableBag.addIfAbsent Time complexity: O(log n).

Overrides:
addIfAbsent in class UpdatableBagImpl
See Also:
addIfAbsent
 o add
 public synchronized void add(Object element) throws IllegalElementException
Implements collections.UpdatableBag.add. Time complexity: O(log n).

Overrides:
add in class UpdatableBagImpl
See Also:
add
 o checkImplementation
 public void checkImplementation() throws ImplementationError
Implements collections.ImplementationCheckable.checkImplementation.

Overrides:
checkImplementation in class UpdatableImpl
See Also:
checkImplementation

All Packages  Class Hierarchy  This Package  Previous  Next  Index