edu.rice.cs.plt.collect
Class ComplementSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<T>
          extended by edu.rice.cs.plt.collect.AbstractPredicateSet<T>
              extended by edu.rice.cs.plt.collect.FilteredSet<E>
                  extended by edu.rice.cs.plt.collect.ComplementSet<E>
All Implemented Interfaces:
PredicateSet<E>, SizedIterable<E>, Predicate<java.lang.Object>, Composite, java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

public class ComplementSet<E>
extends FilteredSet<E>

The complement of a set excluded in a domain domain (alternatively, domain - excluded), constructed lazily and updated dynamically.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.rice.cs.plt.collect.FilteredSet
_pred, _set
 
Constructor Summary
ComplementSet(java.util.Set<? extends E> domain, java.util.Set<?> excluded)
           
 
Method Summary
 boolean hasFixedSize()
          true if this iterable is known to have a fixed size.
 boolean isEmpty()
          Returns size(1) == 0.
 boolean isInfinite()
          true if the iterable is known to have infinite size.
 boolean isStatic()
          true if this iterable is unchanging.
 
Methods inherited from class edu.rice.cs.plt.collect.FilteredSet
compositeHeight, compositeSize, contains, containsAll, iterator
 
Methods inherited from class edu.rice.cs.plt.collect.AbstractPredicateSet
size, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, equals, hashCode, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ComplementSet

public ComplementSet(java.util.Set<? extends E> domain,
                     java.util.Set<?> excluded)
Method Detail

isInfinite

public boolean isInfinite()
Description copied from interface: SizedIterable
true if the iterable is known to have infinite size. If true, an iterator over the iterable in its current state will never return false from hasNext().

Specified by:
isInfinite in interface SizedIterable<E>
Overrides:
isInfinite in class FilteredSet<E>

hasFixedSize

public boolean hasFixedSize()
Description copied from interface: SizedIterable
true if this iterable is known to have a fixed size. This is the case if the iterable is immutable, or if changes can only replace values, not remove or add them. An infinite iterable may be fixed if it is guaranteed to never become finite.

Specified by:
hasFixedSize in interface SizedIterable<E>
Overrides:
hasFixedSize in class FilteredSet<E>

isStatic

public boolean isStatic()
Description copied from interface: SizedIterable
true if this iterable is unchanging. This implies that hasFixedSize() is true, and that iterator() will always return the same (either == or equal() and immutable) elements in the same order. ("Immutable" here means that equals() invocations are consistent over time -- if two objects are equal, they will never become inequal, and vice versa.)

Specified by:
isStatic in interface SizedIterable<E>
Overrides:
isStatic in class FilteredSet<E>

isEmpty

public boolean isEmpty()
Description copied from class: AbstractPredicateSet
Returns size(1) == 0.

Specified by:
isEmpty in interface SizedIterable<E>
Specified by:
isEmpty in interface java.util.Collection<E>
Specified by:
isEmpty in interface java.util.Set<E>
Overrides:
isEmpty in class FilteredSet<E>