mathCollection
Class MathCollections.SynchronizedSetOfSets

java.lang.Object
  extended bymathCollection.MathCollections.SynchronizedSetOfSets
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.io.Serializable, java.util.Set, SetOfSets
Enclosing class:
MathCollections

static class MathCollections.SynchronizedSetOfSets
extends java.lang.Object
implements SetOfSets, java.io.Serializable, java.lang.Cloneable


Field Summary
private  java.lang.Object myMutex
           
private  SetOfSets mySetOfSets
           
 
Constructor Summary
(package private) MathCollections.SynchronizedSetOfSets(SetOfSets ms)
           
(package private) MathCollections.SynchronizedSetOfSets(SetOfSets ms, java.lang.Object mutex)
           
 
Method Summary
 boolean add(java.lang.Object o)
          Adds the specified element to this set if it is not already present.
 boolean addAll(java.util.Collection c)
           
 void clear()
           
 java.lang.Object clone()
           
 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 containsAll(java.util.Collection c)
           
 boolean containsAtom(java.lang.Object o)
          Returns true if this set of sets contains a set in which the specified element is present.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
          Removes the specified element from this set if it is present.
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 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.
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] o)
           
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mySetOfSets

private SetOfSets mySetOfSets

myMutex

private java.lang.Object myMutex
Constructor Detail

MathCollections.SynchronizedSetOfSets

MathCollections.SynchronizedSetOfSets(SetOfSets ms)

MathCollections.SynchronizedSetOfSets

MathCollections.SynchronizedSetOfSets(SetOfSets ms,
                                      java.lang.Object mutex)
Method Detail

size

public int size()
Specified by:
size in interface java.util.Set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Set

clear

public void clear()
Specified by:
clear in interface java.util.Set

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Set

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Set

toSet

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

Specified by:
toSet in interface SetOfSets
Returns:
the 'flattened' version (simple set) of this set of sets.

toMultiset

public Multiset toMultiset()
Description copied from interface: SetOfSets
Returns the 'flattened' multiset version of this set of sets, containing the same elements as in all sets of this set of sets.

Specified by:
toMultiset in interface SetOfSets
Returns:
the 'flattened' multiset version of this set of sets.

toString

public java.lang.String toString()

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Set

toArray

public java.lang.Object[] toArray(java.lang.Object[] o)
Specified by:
toArray in interface java.util.Set

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Set

clone

public java.lang.Object clone()

add

public boolean add(java.lang.Object o)
Description copied from interface: SetOfSets
Adds the specified element to this set if it is not already present.

Specified by:
add in interface SetOfSets
Parameters:
o - element to be added to this set.
Returns:
true if the set did not already contain the specified element, false otherwise.

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Set

contains

public boolean contains(java.lang.Object o)
Description copied from interface: SetOfSets
Returns true if this set contains the specified element.

Specified by:
contains in interface SetOfSets
Parameters:
o - element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element, false otherwise.

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Set

remove

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

Specified by:
remove in interface SetOfSets
Parameters:
o - object to be removed from this set, if present.
Returns:
true if the set did contain the specified element, false otherwise.

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Set

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Set

containingSets

public SetOfSets containingSets(java.lang.Object o)
Description copied from interface: SetOfSets
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.

Specified by:
containingSets in interface SetOfSets
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.

containsAtom

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

Specified by:
containsAtom in interface SetOfSets
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.

supersets

public SetOfSets supersets(java.util.Set s)
Description copied from interface: SetOfSets
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.

Specified by:
supersets in interface SetOfSets
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)
Description copied from interface: SetOfSets
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.

Specified by:
subsets in interface SetOfSets
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.