|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.neu.ccs.demeterf.lib.RBTree<X>
public abstract class RBTree<X extends java.lang.Comparable<X>>
Java Functional implementation of Red-Black Trees. Use the static methods to create them, then insert/remove to modify them. Note that they are completely functional, so insert/remove return a new tree with or without the given element respectively
The elements stored in the tree must implement Comparable
Constructor Summary | |
---|---|
RBTree()
|
Method Summary | ||
---|---|---|
static RBColor |
black()
Return the RBColor "Black" |
|
boolean |
contains(X x)
Is the given (Comparable) element in this RBTree? |
|
abstract boolean |
contains(X x,
java.util.Comparator<X> comp)
Is the given element in this RBTree, using the given Comparator? |
|
boolean |
containsAll(RBTree<X> x)
Are all the (Comparable) elements int the given RBTree contained in this RBTree? |
|
abstract boolean |
containsAll(RBTree<X> x,
java.util.Comparator<X> comp)
Are all the elements int the given RBTree contained in this RBTree, using the given Comparator? |
|
static
|
create(List<X> l)
Create an RBTree containing the given elements, using the given Comparator |
|
static
|
create(X... xs)
Create an RBTree containing the given elements |
|
X |
find(X x)
Return the (Comparable) X in this RBTree that matches the given one |
|
abstract X |
find(X x,
java.util.Comparator<X> comp)
Return the X in this RBTree that matches the given one, using the given Comparator |
|
abstract int |
hashCode()
|
|
RBTree<X> |
insert(X x)
Returns a new RBTree that includes the given Comparable element |
|
RBTree<X> |
insert(X x,
java.util.Comparator<X> comp)
Returns a new RBTree that includes the given element using the given Comparator |
|
RBTree<X> |
insertAll(List<X> lst)
Returns a new RBTree that includes all the (Comparable) elements from the given List |
|
RBTree<X> |
insertAll(List<X> lst,
java.util.Comparator<X> c)
Returns a new RBTree that includes all the elements from the given List, using the given Comparator |
|
RBTree<X> |
insertAll(RBTree<X> t)
Returns a new RBTree that includes all the (Comparable) elements from the given RBTree |
|
RBTree<X> |
insertAll(RBTree<X> t,
java.util.Comparator<X> c)
Returns a new RBTree that includes all the elements from the given RBTree, using the given Comparator |
|
abstract boolean |
isLeaf()
Is this RBTree a leaf? |
|
java.util.Iterator<X> |
iterator()
Return an Interator for the elements in this list, in Comparator order. |
|
static
|
leaf()
Create a new RBLeaf |
|
abstract X |
max()
Return this RBTree's maximum element (Only valid on RBNodes) |
|
abstract X |
min()
Return this RBTree's minimum element (Only valid on RBNodes) |
|
static
|
node(RBColor c,
X d,
RBTree<X> l,
RBTree<X> r)
Create a new RBNode |
|
abstract X |
pred()
Return this RBTree's predicessor element (Only valid on RBNodes) |
|
static RBColor |
red()
Return the RBColor "Red" |
|
RBTree<X> |
remove(X x)
Return this RBTree without the given (Comparable) element |
|
abstract RBTree<X> |
remove(X x,
java.util.Comparator<X> comp)
Return this RBTree without the given element, using the given Comparator |
|
RBTree<X> |
replace(X x)
Return a new RBTree without the given (Comparable) element |
|
abstract RBTree<X> |
replace(X x,
java.util.Comparator<X> comp)
Return a new RBTree without the given element, using the given Comparator |
|
abstract int |
size()
Return the number of elements in the RBTree |
|
abstract X |
succ()
Return this RBTree's successor element (Only valid on RBNodes) |
|
abstract List<X> |
toList()
Return all the elements in thei RBTree as a List in order |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RBTree()
Method Detail |
---|
public abstract boolean isLeaf()
public RBTree<X> insert(X x)
public RBTree<X> insert(X x, java.util.Comparator<X> comp)
public RBTree<X> insertAll(RBTree<X> t)
public RBTree<X> insertAll(List<X> lst)
public RBTree<X> insertAll(RBTree<X> t, java.util.Comparator<X> c)
public RBTree<X> insertAll(List<X> lst, java.util.Comparator<X> c)
public RBTree<X> remove(X x)
public abstract RBTree<X> remove(X x, java.util.Comparator<X> comp)
public abstract int size()
public abstract X pred()
public abstract X succ()
public abstract X min()
public abstract X max()
public boolean contains(X x)
public abstract boolean contains(X x, java.util.Comparator<X> comp)
public boolean containsAll(RBTree<X> x)
public abstract boolean containsAll(RBTree<X> x, java.util.Comparator<X> comp)
public X find(X x)
public abstract X find(X x, java.util.Comparator<X> comp)
public RBTree<X> replace(X x)
public abstract RBTree<X> replace(X x, java.util.Comparator<X> comp)
public abstract List<X> toList()
public static RBColor black()
public static RBColor red()
public static <X extends java.lang.Comparable<X>> RBTree<X> create(X... xs)
public static <X extends java.lang.Comparable<X>> RBTree<X> create(List<X> l)
public static <X extends java.lang.Comparable<X>> RBLeaf<X> leaf()
public static <X extends java.lang.Comparable<X>> RBNode<X> node(RBColor c, X d, RBTree<X> l, RBTree<X> r)
public java.util.Iterator<X> iterator()
iterator
in interface java.lang.Iterable<X extends java.lang.Comparable<X>>
public abstract int hashCode()
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |