mathCollection
Interface SetOfSets

All Superinterfaces:
java.util.Collection, java.util.Set
All Known Implementing Classes:
AbstractSetOfSets, HashSetOfSets, MathCollections.SynchronizedSetOfSets

public interface SetOfSets
extends java.util.Set

An extension of java.util.Set for representing sets of sets. The primary set elements must implement the Set interface. The null element is not allowed.

See Also:
Set, AbstractSetOfSets, HashSetOfSets

Method Summary
 boolean add(java.lang.Object o)
          Adds the specified element to this set if it is not already present.
 SetOfSets containingSets(java.lang.Object o)
          Returns a set containing the elementary sets from within this set of sets that contain the specified element.
 boolean contains(java.lang.Object o)
          Returns true if this set contains the specified element.
 boolean containsAtom(java.lang.Object o)
          Returns true if this set of sets contains a set in which the specified element is present.
 boolean remove(java.lang.Object o)
          Removes the specified element from this set if it is present.
 SetOfSets subsets(java.util.Set s)
          Returns a new set containing the subsets of the specified set.
 SetOfSets supersets(java.util.Set s)
          Returns a new set containing the supersets of the specified set.
 Multiset toMultiset()
          Returns the 'flattened' multiset version of this set of sets, containing the same elements as in all sets of this set of sets.
 java.util.Set toSet()
          Returns the 'flattened' version of this set of sets, in which each basic element of this set of sets is present exactly once.
 
Methods inherited from interface java.util.Set
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray
 

Method Detail

toSet

public java.util.Set toSet()
Returns the 'flattened' version of this set of sets, in which each basic element of this set of sets is present exactly once.

Returns:
the 'flattened' version (simple set) of this set of sets.

toMultiset

public Multiset toMultiset()
Returns the 'flattened' multiset version of this set of sets, containing the same elements as in all sets of this set of sets.

Returns:
the 'flattened' multiset version of this set of sets.

containsAtom

public boolean containsAtom(java.lang.Object o)
Returns true if this set of sets contains a set in which the specified element is present.

Parameters:
o - the element whose presence in any elementary set within this set of sets is tested for.
Returns:
true if any set within this set of sets contains the specified element, false otherwise.

containingSets

public SetOfSets containingSets(java.lang.Object o)
Returns a set containing the elementary sets from within this set of sets that contain the specified element. If there are no sets containing the specified element, an empty set is returned.

Parameters:
o - the element that the returned sets have to contain.
Returns:
the elementary sets from this set of sets that contain the specified element.

add

public boolean add(java.lang.Object o)
Adds the specified element to this set if it is not already present.

Specified by:
add in interface java.util.Set
Parameters:
o - element to be added to this set.
Returns:
true if the set did not already contain the specified element, false otherwise.
Throws:
java.lang.ClassCastException - if the type of the specified element is incompatible (!(o instanceof Set)).

remove

public boolean remove(java.lang.Object o)
Removes the specified element from this set if it is present.

Specified by:
remove in interface java.util.Set
Parameters:
o - object to be removed from this set, if present.
Returns:
true if the set did contain the specified element, false otherwise.
Throws:
java.lang.ClassCastException - if the type of the specified element is incompatible (!(o instanceof Set)).

contains

public boolean contains(java.lang.Object o)
Returns true if this set contains the specified element.

Specified by:
contains in interface java.util.Set
Parameters:
o - element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element, false otherwise.
Throws:
java.lang.ClassCastException - if the type of the specified element is incompatible (!(o instanceof Set)).

supersets

public SetOfSets supersets(java.util.Set s)
Returns a new set containing the supersets of the specified set. If the specified set is empty, a copy of this set of sets is returned. If no supersets exist in this set, an empty set of sets is returned.

Parameters:
s - the set that the returned sets have to be supersets of.
Returns:
the elementary sets from this set of sets that contain the specified set.

subsets

public SetOfSets subsets(java.util.Set s)
Returns a new set containing the subsets of the specified set. If the specified set is empty or no supersets exist in this set, an empty set of sets is returned.

Parameters:
s - the set that the returned sets have to be subsets of.
Returns:
the elementary sets from this set of sets that occur in the specified set.