org.eclipse.ocl.uml.internal
Class OCLStandardLibraryImpl

java.lang.Object
  extended by org.eclipse.ocl.uml.internal.OCLStandardLibraryImpl
All Implemented Interfaces:
OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>

public final class OCLStandardLibraryImpl
extends java.lang.Object
implements OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>

Implementation of the OCLStandardLibrary for the UML environment.

Author:
Christian W. Damus (cdamus)

Field Summary
static OCLStandardLibraryImpl INSTANCE
          The shared instance of the OCL Standard Library for the UML environment.
static java.lang.Object INVALID
          The singleton instance of the OclInvalid standard library type.
static org.eclipse.uml2.uml.Package stdlibPackage
          The package containing the OCL Standard Library classifiers.
 
Method Summary
static java.util.Collection<org.eclipse.uml2.uml.Operation> createCollectionTypeOperations(Environment<?,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,?,?,org.eclipse.uml2.uml.Parameter,?,?,?,?,?,?> env, CollectionKind kind)
           
static org.eclipse.uml2.uml.Class findShadowClass(org.eclipse.uml2.uml.Classifier classifier, org.eclipse.uml2.uml.Package pkg)
          Finds the shadow class to contain features defined for the specified OCL type, if it already exists.
 org.eclipse.uml2.uml.Classifier getBag()
          Obtains the generic instance of the BagType metatype, named Bag(T).
 org.eclipse.uml2.uml.Classifier getBoolean()
          Obtains the instance of the PrimitiveType metatype, named Boolean.
 org.eclipse.uml2.uml.Classifier getCollection()
          Obtains the generic instance of the CollectionType metatype, named Collection(T).
 org.eclipse.uml2.uml.Classifier getInteger()
          Obtains the instance of the PrimitiveType metatype, named Integer.
 java.lang.Object getInvalid()
          Obtains the single instance of the OclInvalid type, identified by the token invalid.
 org.eclipse.uml2.uml.Classifier getOclAny()
          Obtains the single instance of the AnyType metatype, named OclAny.
 org.eclipse.uml2.uml.Classifier getOclElement()
          Obtains the generic instance of the ElementType metatype, named OclElement.
 org.eclipse.uml2.uml.Classifier getOclExpression()
          Obtains the instance of the ElementType metatype that represents the type of OCL expressions in the model, named OclExpression.
 org.eclipse.uml2.uml.Classifier getOclInvalid()
          Obtains the single instance of the InvalidType metatype, named OclInvalid.
 org.eclipse.uml2.uml.Classifier getOclMessage()
          Obtains the generic instance of the MessageType metatype, named OclMessage.
 org.eclipse.uml2.uml.Classifier getOclType()
          Obtains the generic instance of the TypeType metatype, named OclType.
 org.eclipse.uml2.uml.Classifier getOclVoid()
          Obtains the single instance of the VoidType metatype, named OclVoid.
 org.eclipse.uml2.uml.Classifier getOrderedSet()
          Obtains the generic instance of the OrderedSetType metatype, named OrderedSet(T).
 org.eclipse.uml2.uml.Classifier getReal()
          Obtains the instance of the PrimitiveType metatype, named Real.
static org.eclipse.uml2.uml.Classifier getRealClassifier(org.eclipse.uml2.uml.Class shadow)
           
 org.eclipse.uml2.uml.Classifier getSequence()
          Obtains the generic instance of the SequenceType metatype, named Sequence(T).
 org.eclipse.uml2.uml.Classifier getSet()
          Obtains the generic instance of the SetType metatype, named Set(T).
 org.eclipse.uml2.uml.Classifier getState()
          Obtains the instance of the ElementType metatype that represents the type of states in the model, named State.
 org.eclipse.uml2.uml.Classifier getString()
          Obtains the instance of the PrimitiveType metatype, named String.
 org.eclipse.uml2.uml.Classifier getT()
          Obtains a generic instance of the AnyType metatype that represents the type parameter of generic types and operations, named T.
 org.eclipse.uml2.uml.Classifier getT2()
          Obtains a generic instance of the AnyType metatype that represents another type parameter of generic operations (particularly certain OCL Collection operations), named T2.
 org.eclipse.uml2.uml.Classifier getUnlimitedNatural()
          Obtains the instance of the PrimitiveType metatype, named UnlimitedNatural.
static org.eclipse.emf.common.util.EList<org.eclipse.uml2.uml.Operation> selectIterators(java.util.Collection<org.eclipse.uml2.uml.Operation> operations)
          Selects from the specified operations those that are collection iterators.
static void stereotypeAsIterator(java.util.Collection<org.eclipse.uml2.uml.Operation> operations)
          Marks the specified operations as being collection iterators (as distinct from ordinary operations).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final OCLStandardLibraryImpl INSTANCE
The shared instance of the OCL Standard Library for the UML environment.


INVALID

public static java.lang.Object INVALID
The singleton instance of the OclInvalid standard library type.


stdlibPackage

public static org.eclipse.uml2.uml.Package stdlibPackage
The package containing the OCL Standard Library classifiers.

Method Detail

getBoolean

public org.eclipse.uml2.uml.Classifier getBoolean()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named Boolean.

Specified by:
getBoolean in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Boolean type (an instance of PrimitiveType)

getInteger

public org.eclipse.uml2.uml.Classifier getInteger()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named Integer.

Specified by:
getInteger in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Integer type (an instance of PrimitiveType)

getUnlimitedNatural

public org.eclipse.uml2.uml.Classifier getUnlimitedNatural()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named UnlimitedNatural.

Specified by:
getUnlimitedNatural in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the UnlimitedNatural type (an instance of PrimitiveType)

getOclInvalid

public org.eclipse.uml2.uml.Classifier getOclInvalid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the InvalidType metatype, named OclInvalid.

Specified by:
getOclInvalid in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclInvalid type (an instance of InvalidType)

getReal

public org.eclipse.uml2.uml.Classifier getReal()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named Real.

Specified by:
getReal in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Real type (an instance of PrimitiveType)

getString

public org.eclipse.uml2.uml.Classifier getString()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named String.

Specified by:
getString in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the String type (an instance of PrimitiveType)

getOclAny

public org.eclipse.uml2.uml.Classifier getOclAny()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the AnyType metatype, named OclAny.

Specified by:
getOclAny in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclAny type (an instance of AnyType)

getOclElement

public org.eclipse.uml2.uml.Classifier getOclElement()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the ElementType metatype, named OclElement.

Specified by:
getOclElement in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclElement type (an instance of ElementType)

getInvalid

public java.lang.Object getInvalid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the OclInvalid type, identified by the token invalid.

Specified by:
getInvalid in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the invalid instance (an instance of invalid)

getState

public org.eclipse.uml2.uml.Classifier getState()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the ElementType metatype that represents the type of states in the model, named State.

Specified by:
getState in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the State type (an instance of ElementType)

getOclMessage

public org.eclipse.uml2.uml.Classifier getOclMessage()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the MessageType metatype, named OclMessage.

Specified by:
getOclMessage in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclMessage type (an instance of MessageType)

getOclType

public org.eclipse.uml2.uml.Classifier getOclType()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the TypeType metatype, named OclType.

Specified by:
getOclType in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclType type (an instance of TypeType)

getOclVoid

public org.eclipse.uml2.uml.Classifier getOclVoid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the VoidType metatype, named OclVoid.

Specified by:
getOclVoid in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclVoid type (an instance of VoidType)

getT

public org.eclipse.uml2.uml.Classifier getT()
Description copied from interface: OCLStandardLibrary
Obtains a generic instance of the AnyType metatype that represents the type parameter of generic types and operations, named T.

Specified by:
getT in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the T type parameter (an instance of AnyType)

getT2

public org.eclipse.uml2.uml.Classifier getT2()
Description copied from interface: OCLStandardLibrary
Obtains a generic instance of the AnyType metatype that represents another type parameter of generic operations (particularly certain OCL Collection operations), named T2.

Specified by:
getT2 in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the T2 type parameter (an instance of AnyType)

getSet

public org.eclipse.uml2.uml.Classifier getSet()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the SetType metatype, named Set(T).

Specified by:
getSet in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Set(T) type (an instance of SetType)

getOrderedSet

public org.eclipse.uml2.uml.Classifier getOrderedSet()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the OrderedSetType metatype, named OrderedSet(T).

Specified by:
getOrderedSet in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OrderedSet(T) type (an instance of OrderedSetType)

getBag

public org.eclipse.uml2.uml.Classifier getBag()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the BagType metatype, named Bag(T).

Specified by:
getBag in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Bag(T) type (an instance of BagType)

getSequence

public org.eclipse.uml2.uml.Classifier getSequence()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the SequenceType metatype, named Sequence(T).

Specified by:
getSequence in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Sequence(T) type (an instance of SequenceType)

getCollection

public org.eclipse.uml2.uml.Classifier getCollection()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the CollectionType metatype, named Collection(T).

Specified by:
getCollection in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the Collection(T) type (an instance of CollectionType)

getOclExpression

public org.eclipse.uml2.uml.Classifier getOclExpression()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the ElementType metatype that represents the type of OCL expressions in the model, named OclExpression.

Specified by:
getOclExpression in interface OCLStandardLibrary<org.eclipse.uml2.uml.Classifier>
Returns:
the OclExpression type (an instance of ElementType)

findShadowClass

public static org.eclipse.uml2.uml.Class findShadowClass(org.eclipse.uml2.uml.Classifier classifier,
                                                         org.eclipse.uml2.uml.Package pkg)
Finds the shadow class to contain features defined for the specified OCL type, if it already exists.

Parameters:
classifier - an Ecore classifier
pkg - the package in which to look for the shadow class
Returns:
the class containing its features, or null if not found

getRealClassifier

public static org.eclipse.uml2.uml.Classifier getRealClassifier(org.eclipse.uml2.uml.Class shadow)

stereotypeAsIterator

public static void stereotypeAsIterator(java.util.Collection<org.eclipse.uml2.uml.Operation> operations)
Marks the specified operations as being collection iterators (as distinct from ordinary operations).

Parameters:
operations - operations to designate as iterators

selectIterators

public static org.eclipse.emf.common.util.EList<org.eclipse.uml2.uml.Operation> selectIterators(java.util.Collection<org.eclipse.uml2.uml.Operation> operations)
Selects from the specified operations those that are collection iterators.

Parameters:
operations - operations
Returns:
the subset that are stereotyped as iterators

createCollectionTypeOperations

public static java.util.Collection<org.eclipse.uml2.uml.Operation> createCollectionTypeOperations(Environment<?,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,?,?,org.eclipse.uml2.uml.Parameter,?,?,?,?,?,?> env,
                                                                                                  CollectionKind kind)