Class CompositeSortedSet<T>

java.lang.Object
  extended by CompositeSortedSet<T>
All Implemented Interfaces:
SortedSet<T>

public abstract class CompositeSortedSet<T>
extends java.lang.Object
implements SortedSet<T>

An Abstract Class for SortedSets composed from two sets


Constructor Summary
CompositeSortedSet(SortedSet<T> setA, SortedSet<T> setB)
          Constructs a new CompositeSortedSet
 
Method Summary
 T getMaximum()
          Return the maximum element in this set.
 T getMinimum()
          Return the minimum element in this set.
 boolean isEmpty()
          Return true iff the set is empty.
 int size()
          Return the size of this set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface SortedSet
contains, iterator
 

Constructor Detail

CompositeSortedSet

public CompositeSortedSet(SortedSet<T> setA,
                          SortedSet<T> setB)
Constructs a new CompositeSortedSet

Parameters:
SortedSet - setA, SortedSet setB
Method Detail

size

public int size()
Return the size of this set. the size is computed only once, and is memoized for later use

Specified by:
size in interface SortedSet<T>
Returns:
the size of this set.

isEmpty

public boolean isEmpty()
Return true iff the set is empty.

Specified by:
isEmpty in interface SortedSet<T>
Returns:
true iff the set is empty

getMinimum

public T getMinimum()
Return the minimum element in this set. The minimum element is memoized

Specified by:
getMinimum in interface SortedSet<T>
Returns:
the minimum element in this set.

getMaximum

public T getMaximum()
Return the maximum element in this set. The maximum element is memoized

Specified by:
getMaximum in interface SortedSet<T>
Returns:
the maximum element in this set.