Dresden OCL Toolkit

tudresden.ocl.lib
Class OclSet

java.lang.Object
  extended bytudresden.ocl.lib.OclCollection
      extended bytudresden.ocl.lib.OclUnsortedCollection
          extended bytudresden.ocl.lib.OclSet
All Implemented Interfaces:
Cloneable, OclRoot, OclSizable, OclSubtractable

public class OclSet
extends OclUnsortedCollection
implements OclSubtractable

A OclSet is a collection that does not contain duplicates. See documentation of OclCollection further information.

Author:
Frank Finger
See Also:
OclCollection

Field Summary
 
Fields inherited from class tudresden.ocl.lib.OclCollection
collection, STRICT_VALUE_TYPES
 
Constructor Summary
  OclSet(int dummy, String reason)
          private constructor for undefined OclSet
protected OclSet(List l)
          This constructor should only be used if the parameter is known to contain no duplicates, e.g.
  OclSet(Set set)
          public constructor for valid OclSets; usually it is preferrably to use the methods Ocl.getOclRepresentationFor(...) to get instances of library classes
 
Method Summary
 OclCollection collect(OclIterator iter, OclRootEvaluatable eval)
           
 OclCollection excluding(OclRoot obj)
          STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection.
static OclSet getEmptyOclSet()
          static factory method for OclSet containing no elements
 OclCollection including(OclRoot obj)
          STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection.
protected  Set intersection(Collection col)
          This method is called by the public methods intersection(OclBag) and intersection(OclSet).
 OclUnsortedCollection intersection(OclBag bag)
          The OCL types Bag and Set have this operation defined.
 OclSet intersection(OclSet set)
          The OCL types Bag and Set have this operation defined.
 OclBoolean isEqualTo(Object o)
          two OclSets are equal if they contain the same elements
 OclCollection select(OclIterator iter, OclBooleanEvaluatable eval)
           
 OclSubtractable subtract(OclSubtractable s)
          STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection.
 OclSet symmetricDifference(OclSet set)
          STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection.
 String toString()
           
 OclBag union(OclBag bag)
          The union of an OclSet and an OclBag is an OclBag.
 OclCollection union(OclCollection col)
          This method tries to call the appropriate method of the same name (for OclSet or OclBag parameters) or, if there is no such method, handles this error by returning an undefined value.
 OclSet union(OclSet set)
          The union of two OclSets is itself an OclSet again.
 
Methods inherited from class tudresden.ocl.lib.OclUnsortedCollection
getFeature
 
Methods inherited from class tudresden.ocl.lib.OclCollection
asBag, asSequence, asSet, becomeUndefined, collectToList, count, equals, excludes, exists, forAll, getFeatureAsCollection, getIterator, getUndefinedReason, includes, includesAll, isEmpty, isNotEqualTo, isUndefined, isUnique, iterate, notEmpty, reject, selectToList, setToInclude, setToRange, size, sortedBy, sum
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface tudresden.ocl.lib.OclRoot
getFeature, getFeatureAsCollection, getUndefinedReason, isNotEqualTo, isUndefined
 

Constructor Detail

OclSet

public OclSet(Set set)
public constructor for valid OclSets; usually it is preferrably to use the methods Ocl.getOclRepresentationFor(...) to get instances of library classes


OclSet

protected OclSet(List l)
This constructor should only be used if the parameter is known to contain no duplicates, e.g. if it is the result of a select operation on a OclSet.


OclSet

public OclSet(int dummy,
              String reason)
private constructor for undefined OclSet

Method Detail

getEmptyOclSet

public static OclSet getEmptyOclSet()
static factory method for OclSet containing no elements


isEqualTo

public OclBoolean isEqualTo(Object o)
two OclSets are equal if they contain the same elements

Specified by:
isEqualTo in interface OclRoot
Specified by:
isEqualTo in class OclCollection

select

public OclCollection select(OclIterator iter,
                            OclBooleanEvaluatable eval)
Specified by:
select in class OclCollection
Returns:
an instance of OclSet
See Also:
OclCollection.select(OclIterator iter, OclBooleanEvaluatable eval), OclCollection.selectToList(OclIterator iter, OclBooleanEvaluatable eval)

collect

public OclCollection collect(OclIterator iter,
                             OclRootEvaluatable eval)
Specified by:
collect in class OclCollection
Returns:
an instance of OclBag
See Also:
OclCollection.collect(OclIterator iter, OclRootEvaluatable eval), OclCollection.collectToList(OclIterator iter, OclRootEvaluatable eval)

union

public OclCollection union(OclCollection col)
This method tries to call the appropriate method of the same name (for OclSet or OclBag parameters) or, if there is no such method, handles this error by returning an undefined value.

Specified by:
union in class OclCollection
Returns:
a collection containing all elements found in this collection or the collection given as parameter; for details see implementations in subclasses
See Also:
OclCollection.union(OclCollection col), union(OclBag col), union(OclSet col)

union

public OclSet union(OclSet set)
The union of two OclSets is itself an OclSet again.


union

public OclBag union(OclBag bag)
The union of an OclSet and an OclBag is an OclBag.


intersection

public OclUnsortedCollection intersection(OclBag bag)
Description copied from class: OclUnsortedCollection
The OCL types Bag and Set have this operation defined.

Specified by:
intersection in class OclUnsortedCollection
Returns:
an OclSet containing all elements found both in this OclSet and in the OclBag given as parameter

intersection

public OclSet intersection(OclSet set)
Description copied from class: OclUnsortedCollection
The OCL types Bag and Set have this operation defined.

Specified by:
intersection in class OclUnsortedCollection
Returns:
the intersection of this collection and the OclSet given as

intersection

protected Set intersection(Collection col)
This method is called by the public methods intersection(OclBag) and intersection(OclSet). It is assumed that this OclSet is not undefined.

Parameters:
col - must not be null and should contain only objects of type OclRoot
Returns:
a java.lang.Set containing all elements found in both the backing java.lang.Collection of this OclSet and the argument

including

public OclCollection including(OclRoot obj)
STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection.

Specified by:
including in class OclCollection
Returns:
an OclSet containing all elements of this set, plus the argument
See Also:
OclCollection.STRICT_VALUE_TYPES

subtract

public OclSubtractable subtract(OclSubtractable s)
STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection.

Specified by:
subtract in interface OclSubtractable
Parameters:
s - needs to be an OclSet, undefined value is returned
Returns:
an OclSet containing all elements of this OclSet that are not present in the argument set
See Also:
subtract(OclSubtractable), OclReal.subtract(OclSubtractable), OclInteger.subtract(OclSubtractable)

symmetricDifference

public OclSet symmetricDifference(OclSet set)
STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection. If this OclSet is not backed by a java.util.HashSet, a new OclSet is created even if STRICT_VALUE_TYPES is set to false.

Returns:
the OclSet containing all elements found in this OclSet or the argument, but not in both
See Also:
OclCollection.STRICT_VALUE_TYPES

excluding

public OclCollection excluding(OclRoot obj)
STRICT_VALUE_TYPES determines whether the changes of the returned collection affect this collection, and if the returned is actually different from this collection. If this OclSet is not backed by a java.util.HashSet, a new OclSet is created even if STRICT_VALUE_TYPES is set to false.

Specified by:
excluding in class OclCollection
Returns:
an OclSet containing all elements of this OclSet but the argument
See Also:
OclCollection.STRICT_VALUE_TYPES

toString

public String toString()
Overrides:
toString in class OclCollection

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.