org.eclipse.ocl.ecore.internal
Class OCLStandardLibraryImpl

java.lang.Object
  extended by org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl
All Implemented Interfaces:
OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>

public final class OCLStandardLibraryImpl
extends java.lang.Object
implements OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>

Implementation of the OCLStandardLibrary for the Ecore environment.

Author:
Christian W. Damus (cdamus)

Field Summary
static OCLStandardLibraryImpl INSTANCE
          The shared instance of the OCL Standard Library for the UML environment.
static org.eclipse.emf.ecore.EObject INVALID
          The singleton instance of the OclInvalid standard library type.
static org.eclipse.emf.ecore.EPackage stdlibPackage
          The package containing the OCL Standard Library classifiers.
 
Method Summary
static org.eclipse.emf.ecore.EClass createShadowClass(org.eclipse.emf.ecore.EClassifier classifier)
          Creates the shadow class to contain features that an Ecore classifier cannot contain for itself.
static org.eclipse.emf.ecore.EClass findShadowClass(org.eclipse.emf.ecore.EClassifier classifier, org.eclipse.emf.ecore.EPackage pkg)
          Finds the shadow class to contain features defined for the specified OCL type, if it already exists.
 org.eclipse.emf.ecore.EClassifier getBag()
          Obtains the generic instance of the BagType metatype, named Bag(T).
 org.eclipse.emf.ecore.EClassifier getBoolean()
          Obtains the instance of the PrimitiveType metatype, named Boolean.
 org.eclipse.emf.ecore.EClassifier getCollection()
          Obtains the generic instance of the CollectionType metatype, named Collection(T).
static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EOperation> getExistingOperations(org.eclipse.emf.ecore.EClassifier type)
          Obtains the existing operations of the specified type, stored in it or in a shadow class.
 org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier getOclAny()
          Obtains the single instance of the AnyType metatype, named OclAny.
 org.eclipse.emf.ecore.EClassifier getOclElement()
          Obtains the generic instance of the ElementType metatype, named OclElement.
 org.eclipse.emf.ecore.EClassifier getOclExpression()
          Obtains the instance of the ElementType metatype that represents the type of OCL expressions in the model, named OclExpression.
 org.eclipse.emf.ecore.EClassifier getOclInvalid()
          Obtains the single instance of the InvalidType metatype, named OclInvalid.
 org.eclipse.emf.ecore.EClassifier getOclMessage()
          Obtains the generic instance of the MessageType metatype, named OclMessage.
 org.eclipse.emf.ecore.EClassifier getOclType()
          Obtains the generic instance of the TypeType metatype, named OclType.
 org.eclipse.emf.ecore.EClassifier getOclVoid()
          Obtains the single instance of the VoidType metatype, named OclVoid.
 org.eclipse.emf.ecore.EClassifier getOrderedSet()
          Obtains the generic instance of the OrderedSetType metatype, named OrderedSet(T).
static org.eclipse.emf.ecore.EClassifier getOwner(org.eclipse.emf.ecore.EOperation operation)
           
static org.eclipse.emf.ecore.EClassifier getOwner(org.eclipse.emf.ecore.EStructuralFeature property)
           
 org.eclipse.emf.ecore.EClassifier getReal()
          Obtains the instance of the PrimitiveType metatype, named Real.
static org.eclipse.emf.ecore.EClassifier getRealClassifier(org.eclipse.emf.ecore.EClass shadowClass)
           
 org.eclipse.emf.ecore.EClassifier getSequence()
          Obtains the generic instance of the SequenceType metatype, named Sequence(T).
 org.eclipse.emf.ecore.EClassifier getSet()
          Obtains the generic instance of the SetType metatype, named Set(T).
 org.eclipse.emf.ecore.EClassifier getState()
          Obtains the instance of the ElementType metatype that represents the type of states in the model, named State.
 org.eclipse.emf.ecore.EClassifier getString()
          Obtains the instance of the PrimitiveType metatype, named String.
 org.eclipse.emf.ecore.EClassifier getT()
          Obtains a generic instance of the AnyType metatype that represents the type parameter of generic types and operations, named T.
 org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier getUnlimitedNatural()
          Obtains the instance of the PrimitiveType metatype, named UnlimitedNatural.
static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EOperation> selectIterators(java.util.Collection<org.eclipse.emf.ecore.EOperation> operations)
          Selects from the specified operations those that are collection iterators.
static void stereotypeAsIterator(java.util.Collection<org.eclipse.emf.ecore.EOperation> 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.


stdlibPackage

public static org.eclipse.emf.ecore.EPackage stdlibPackage
The package containing the OCL Standard Library classifiers.


INVALID

public static final org.eclipse.emf.ecore.EObject INVALID
The singleton instance of the OclInvalid standard library type.

Method Detail

getBoolean

public org.eclipse.emf.ecore.EClassifier getBoolean()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named Boolean.

Specified by:
getBoolean in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the Boolean type (an instance of PrimitiveType)

getInteger

public org.eclipse.emf.ecore.EClassifier getInteger()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named Integer.

Specified by:
getInteger in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the Integer type (an instance of PrimitiveType)

getUnlimitedNatural

public org.eclipse.emf.ecore.EClassifier getUnlimitedNatural()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named UnlimitedNatural.

Specified by:
getUnlimitedNatural in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the UnlimitedNatural type (an instance of PrimitiveType)

getOclInvalid

public org.eclipse.emf.ecore.EClassifier getOclInvalid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the InvalidType metatype, named OclInvalid.

Specified by:
getOclInvalid in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the OclInvalid type (an instance of InvalidType)

getReal

public org.eclipse.emf.ecore.EClassifier getReal()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named Real.

Specified by:
getReal in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the Real type (an instance of PrimitiveType)

getString

public org.eclipse.emf.ecore.EClassifier getString()
Description copied from interface: OCLStandardLibrary
Obtains the instance of the PrimitiveType metatype, named String.

Specified by:
getString in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the String type (an instance of PrimitiveType)

getOclAny

public org.eclipse.emf.ecore.EClassifier getOclAny()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the AnyType metatype, named OclAny.

Specified by:
getOclAny in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the OclAny type (an instance of AnyType)

getOclElement

public org.eclipse.emf.ecore.EClassifier getOclElement()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the ElementType metatype, named OclElement.

Specified by:
getOclElement in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
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.emf.ecore.EClassifier>
Returns:
the invalid instance (an instance of invalid)

getState

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the State type (an instance of ElementType)

getOclMessage

public org.eclipse.emf.ecore.EClassifier getOclMessage()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the MessageType metatype, named OclMessage.

Specified by:
getOclMessage in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the OclMessage type (an instance of MessageType)

getOclType

public org.eclipse.emf.ecore.EClassifier getOclType()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the TypeType metatype, named OclType.

Specified by:
getOclType in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the OclType type (an instance of TypeType)

getOclVoid

public org.eclipse.emf.ecore.EClassifier getOclVoid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the VoidType metatype, named OclVoid.

Specified by:
getOclVoid in interface OCLStandardLibrary<org.eclipse.emf.ecore.EClassifier>
Returns:
the OclVoid type (an instance of VoidType)

getT

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the T type parameter (an instance of AnyType)

getT2

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the T2 type parameter (an instance of AnyType)

getSet

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the Set(T) type (an instance of SetType)

getOrderedSet

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the OrderedSet(T) type (an instance of OrderedSetType)

getBag

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the Bag(T) type (an instance of BagType)

getSequence

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the Sequence(T) type (an instance of SequenceType)

getCollection

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the Collection(T) type (an instance of CollectionType)

getOclExpression

public org.eclipse.emf.ecore.EClassifier 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.emf.ecore.EClassifier>
Returns:
the OclExpression type (an instance of ElementType)

getOwner

public static org.eclipse.emf.ecore.EClassifier getOwner(org.eclipse.emf.ecore.EOperation operation)

getOwner

public static org.eclipse.emf.ecore.EClassifier getOwner(org.eclipse.emf.ecore.EStructuralFeature property)

createShadowClass

public static org.eclipse.emf.ecore.EClass createShadowClass(org.eclipse.emf.ecore.EClassifier classifier)
Creates the shadow class to contain features that an Ecore classifier cannot contain for itself.

Parameters:
classifier - an Ecore classifier
Returns:
the class containing its features

findShadowClass

public static org.eclipse.emf.ecore.EClass findShadowClass(org.eclipse.emf.ecore.EClassifier classifier,
                                                           org.eclipse.emf.ecore.EPackage 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.emf.ecore.EClassifier getRealClassifier(org.eclipse.emf.ecore.EClass shadowClass)

getExistingOperations

public static org.eclipse.emf.common.util.EList<org.eclipse.emf.ecore.EOperation> getExistingOperations(org.eclipse.emf.ecore.EClassifier type)
Obtains the existing operations of the specified type, stored in it or in a shadow class. Note that this method returns null, not an empty list, if none are found.

Parameters:
type - an OCL pre-defined type
Returns:
its existing operations, or null if none are found

stereotypeAsIterator

public static void stereotypeAsIterator(java.util.Collection<org.eclipse.emf.ecore.EOperation> 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.emf.ecore.EOperation> selectIterators(java.util.Collection<org.eclipse.emf.ecore.EOperation> operations)
Selects from the specified operations those that are collection iterators.

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