mathCollection
Interface MathSet

All Superinterfaces:
java.util.Collection, java.util.Set
All Known Implementing Classes:
AbstractMathSet, HashMathSet, MathCollections.SynchronizedMathSet

public interface MathSet
extends java.util.Set

An extension of java.util.Set for representing mathematical sets.

See Also:
Set, AbstractMathSet, AbstractSetOfSets, HashMathSet, HashSetOfSets

Method Summary
 MathSet difference(java.util.Set s)
          Returns the asymmetric difference between this mathematical set and the specified set.
 SetOfSets fixedSizeSubsets(int size)
          Returns all possible subsets of this set with the specified size, contained in a SetOfSets instance.
 MathSet intersection(java.util.Set s)
          Returns the intersection with the specified set.
 boolean isDisjoint(java.util.Set s)
          Returns true if the specified set has no common elements with this mathematical set.
 boolean isSubset(java.util.Set s)
          Returns true if this mathematical set is a subset of the specified set.
 boolean isSuperset(java.util.Set s)
          Returns true if this mathematical set is a superset of the specified set.
 SetOfSets powerSet()
          Returns the power set of this mathematical set.
 MathSet symmetricDifference(java.util.Set s)
          Returns the symmetric difference between this mathematical set and the specified set.
 MathSet union(java.util.Set s)
          Returns the union with the specified set.
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

isSuperset

public boolean isSuperset(java.util.Set s)
Returns true if this mathematical set is a superset of the specified set. That is, if all elements of the specified set are also present in this mathematical set.

Parameters:
s - set for which is checked whether this mathematical set is a superset of or not.
Returns:
true if this mathematical set is a superset, false otherwise.

isSubset

public boolean isSubset(java.util.Set s)
Returns true if this mathematical set is a subset of the specified set. That is, if all elements of this mathematical set are also present in the specified set.

Parameters:
s - set for which is checked whether this mathematical set is a subset of or not.
Returns:
true if this mathematical set is a subset, false otherwise.

isDisjoint

public boolean isDisjoint(java.util.Set s)
Returns true if the specified set has no common elements with this mathematical set.

Parameters:
s - set to be checked for common elements.
Returns:
true if there are common elements, false otherwise.

union

public MathSet union(java.util.Set s)
Returns the union with the specified set. This is a new MathSet containing all elements that are present in this mathematical set or in the specified set.

Parameters:
s - set that is to be united with.
Returns:
the union with the specified set.

intersection

public MathSet intersection(java.util.Set s)
Returns the intersection with the specified set. This is a new MathSet containing all elements that are present in this mathematical set as well as in the specified set.

Parameters:
s - set that is to be intersected with.
Returns:
the intersection with the specified set.

difference

public MathSet difference(java.util.Set s)
Returns the asymmetric difference between this mathematical set and the specified set. This is a new MathSet containing all elements that are present in this mathematical set but not in the specified set.

Parameters:
s - set from what the difference is calculated.
Returns:
the difference with the specified set.

symmetricDifference

public MathSet symmetricDifference(java.util.Set s)
Returns the symmetric difference between this mathematical set and the specified set. This is a new MathSet containing all elements that are present either in this mathematical set or in the specified set but not in both.

Parameters:
s - set from what the symmetric difference is calculated
Returns:
the symmetric difference with the specified set.

powerSet

public SetOfSets powerSet()
Returns the power set of this mathematical set. This is a set containing all subsets of this mathematical set, including, in particular, the empty set and this mathematical set itself.

Returns:
power set of this mathematical set.

fixedSizeSubsets

public SetOfSets fixedSizeSubsets(int size)
Returns all possible subsets of this set with the specified size, contained in a SetOfSets instance. In case the size parameter is negative or greater than the size of the set itself, an empty SetOfSets is returned.

Parameters:
size - size of the returned subsets.
Returns:
a SetOfSets containing all subsets of this mathematical set with the specified size.