il.ac.tau.cs.sw1.sortedset.lazy
Class BinaryOpSortedSet<T extends java.lang.Comparable<T>>

java.lang.Object
  extended by il.ac.tau.cs.sw1.sortedset.lazy.BinaryOpSortedSet<T>
All Implemented Interfaces:
SortedSet<T>
Direct Known Subclasses:
IntersectionSortedSet, SymetricDifferenceSortedSet, UnionSortedSet

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


Constructor Summary
BinaryOpSortedSet(SortedSet<T> setA, SortedSet<T> setB)
          Constructs a new CompositeSortedSet from two preexisting sets
 
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. the size is computed only once, and is memoized for later use
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface il.ac.tau.cs.sw1.sortedset.SortedSet
contains, iterator
 

Constructor Detail

BinaryOpSortedSet

public BinaryOpSortedSet(SortedSet<T> setA,
                         SortedSet<T> setB)
Constructs a new CompositeSortedSet from two preexisting sets

Parameters:
setA - - the first set in the composition
setB - - the second set in the composition
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 extends java.lang.Comparable<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 extends java.lang.Comparable<T>>
Returns:
true iff the set is empty

getMinimum

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

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

getMaximum

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

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