edu.neu.ccs.demeterf.lib
Class RBLeaf<X extends java.lang.Comparable<X>>

java.lang.Object
  extended by edu.neu.ccs.demeterf.lib.RBTree<X>
      extended by edu.neu.ccs.demeterf.lib.RBLeaf<X>
All Implemented Interfaces:
java.lang.Iterable<X>

public class RBLeaf<X extends java.lang.Comparable<X>>
extends RBTree<X>

Represents the Leaf of an RBTree, e.g., the empty tree


Constructor Summary
RBLeaf()
           
 
Method Summary
 RBNode<X> asNode()
           
 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, java.util.Comparator<X> comp)
          Are all the elements int the given RBTree contained in this RBTree, using the given Comparator?
 boolean equals(java.lang.Object o)
           
 X find(X x, java.util.Comparator<X> comp)
          Return the X in this RBTree that matches the given one, using the given Comparator
 int hashCode()
           
 boolean isBlack()
           
 boolean isLeaf()
          Is this RBTree a leaf?
 boolean isRed()
           
 X max()
          Return this RBTree's maximum element (Only valid on RBNodes)
 X min()
          Return this RBTree's minimum element (Only valid on RBNodes)
 X pred()
          Return this RBTree's predicessor element (Only valid on RBNodes)
 RBTree<X> remove(X x)
          Return this RBTree without the given (Comparable) element
 RBTree<X> remove(X x, java.util.Comparator<X> c)
          Return this RBTree without the given element, using the given Comparator
 RBTree<X> replace(X x, java.util.Comparator<X> comp)
          Return a new RBTree without the given element, using the given Comparator
 int size()
          Return the number of elements in the RBTree
 X succ()
          Return this RBTree's successor element (Only valid on RBNodes)
 List<X> toList()
          Return all the elements in thei RBTree as a List in order
 java.lang.String toString()
           
 
Methods inherited from class edu.neu.ccs.demeterf.lib.RBTree
black, contains, containsAll, create, create, find, insert, insert, insertAll, insertAll, insertAll, insertAll, iterator, leaf, node, red, replace
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RBLeaf

public RBLeaf()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

isLeaf

public boolean isLeaf()
Description copied from class: RBTree
Is this RBTree a leaf?

Specified by:
isLeaf in class RBTree<X extends java.lang.Comparable<X>>

isBlack

public boolean isBlack()

isRed

public boolean isRed()

contains

public boolean contains(X x,
                        java.util.Comparator<X> comp)
Description copied from class: RBTree
Is the given element in this RBTree, using the given Comparator?

Specified by:
contains in class RBTree<X extends java.lang.Comparable<X>>

containsAll

public boolean containsAll(RBTree<X> x,
                           java.util.Comparator<X> comp)
Description copied from class: RBTree
Are all the elements int the given RBTree contained in this RBTree, using the given Comparator?

Specified by:
containsAll in class RBTree<X extends java.lang.Comparable<X>>

find

public X find(X x,
              java.util.Comparator<X> comp)
Description copied from class: RBTree
Return the X in this RBTree that matches the given one, using the given Comparator

Specified by:
find in class RBTree<X extends java.lang.Comparable<X>>

toList

public List<X> toList()
Description copied from class: RBTree
Return all the elements in thei RBTree as a List in order

Specified by:
toList in class RBTree<X extends java.lang.Comparable<X>>

asNode

public RBNode<X> asNode()

pred

public X pred()
Description copied from class: RBTree
Return this RBTree's predicessor element (Only valid on RBNodes)

Specified by:
pred in class RBTree<X extends java.lang.Comparable<X>>

succ

public X succ()
Description copied from class: RBTree
Return this RBTree's successor element (Only valid on RBNodes)

Specified by:
succ in class RBTree<X extends java.lang.Comparable<X>>

min

public X min()
Description copied from class: RBTree
Return this RBTree's minimum element (Only valid on RBNodes)

Specified by:
min in class RBTree<X extends java.lang.Comparable<X>>

max

public X max()
Description copied from class: RBTree
Return this RBTree's maximum element (Only valid on RBNodes)

Specified by:
max in class RBTree<X extends java.lang.Comparable<X>>

remove

public RBTree<X> remove(X x)
Description copied from class: RBTree
Return this RBTree without the given (Comparable) element

Overrides:
remove in class RBTree<X extends java.lang.Comparable<X>>

remove

public RBTree<X> remove(X x,
                        java.util.Comparator<X> c)
Description copied from class: RBTree
Return this RBTree without the given element, using the given Comparator

Specified by:
remove in class RBTree<X extends java.lang.Comparable<X>>

replace

public RBTree<X> replace(X x,
                         java.util.Comparator<X> comp)
Description copied from class: RBTree
Return a new RBTree without the given element, using the given Comparator

Specified by:
replace in class RBTree<X extends java.lang.Comparable<X>>

size

public int size()
Description copied from class: RBTree
Return the number of elements in the RBTree

Specified by:
size in class RBTree<X extends java.lang.Comparable<X>>

hashCode

public int hashCode()
Specified by:
hashCode in class RBTree<X extends java.lang.Comparable<X>>