mathCollection
Class MathCollections.SynchronizedMathSet

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

static class MathCollections.SynchronizedMathSet
extends java.lang.Object
implements MathSet, java.io.Serializable, java.lang.Cloneable


Field Summary
private  MathSet myMathSet
           
private  java.lang.Object myMutex
           
 
Constructor Summary
(package private) MathCollections.SynchronizedMathSet(MathSet ms)
           
(package private) MathCollections.SynchronizedMathSet(MathSet ms, java.lang.Object mutex)
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 void clear()
           
 java.lang.Object clone()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 MathSet difference(java.util.Set s)
          Returns the asymmetric difference between this mathematical set and the specified set.
 boolean equals(java.lang.Object o)
           
 SetOfSets fixedSizeSubsets(int size)
          Returns all possible subsets of this set with the specified size, contained in a SetOfSets instance.
 int hashCode()
           
 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 isEmpty()
           
 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.
 java.util.Iterator iterator()
           
 SetOfSets powerSet()
          Returns the power set of this mathematical set.
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 MathSet symmetricDifference(java.util.Set s)
          Returns the symmetric difference between this mathematical set and the specified set.
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] o)
           
 java.lang.String toString()
           
 MathSet union(java.util.Set s)
          Returns the union with the specified set.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myMathSet

private MathSet myMathSet

myMutex

private java.lang.Object myMutex
Constructor Detail

MathCollections.SynchronizedMathSet

MathCollections.SynchronizedMathSet(MathSet ms)

MathCollections.SynchronizedMathSet

MathCollections.SynchronizedMathSet(MathSet 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

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)
Specified by:
add in interface java.util.Set

addAll

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

contains

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

containsAll

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

remove

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

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

union

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

Specified by:
union in interface MathSet
Parameters:
s - set that is to be united with.
Returns:
the union with the specified set.

intersection

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

Specified by:
intersection in interface MathSet
Parameters:
s - set that is to be intersected with.
Returns:
the intersection with the specified set.

difference

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

Specified by:
difference in interface MathSet
Parameters:
s - set from what the difference is calculated.
Returns:
the difference with the specified set.

symmetricDifference

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

Specified by:
symmetricDifference in interface MathSet
Parameters:
s - set from what the symmetric difference is calculated
Returns:
the symmetric difference with the specified set.

isDisjoint

public boolean isDisjoint(java.util.Set s)
Description copied from interface: MathSet
Returns true if the specified set has no common elements with this mathematical set.

Specified by:
isDisjoint in interface MathSet
Parameters:
s - set to be checked for common elements.
Returns:
true if there are common elements, false otherwise.

isSubset

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

Specified by:
isSubset in interface MathSet
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.

isSuperset

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

Specified by:
isSuperset in interface MathSet
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.

powerSet

public SetOfSets powerSet()
Description copied from interface: MathSet
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.

Specified by:
powerSet in interface MathSet
Returns:
power set of this mathematical set.

fixedSizeSubsets

public SetOfSets fixedSizeSubsets(int size)
Description copied from interface: MathSet
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.

Specified by:
fixedSizeSubsets in interface MathSet
Parameters:
size - size of the returned subsets.
Returns:
a SetOfSets containing all subsets of this mathematical set with the specified size.