org.eclipse.ocl.ecore.internal
Class OCLStandardLibraryImpl

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

public final class OCLStandardLibraryImpl
extends Object
implements OCLStandardLibrary<EClassifier>

Implementation of the OCLStandardLibrary for the Ecore environment.


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


OCL_INVALID

public static final EObject OCL_INVALID
The singleton instance of the Invalid standard library type.

Method Detail

getBoolean

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

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

getInteger

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

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

getUnlimitedNatural

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

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

getInvalid

public EClassifier getInvalid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the InvalidType metatype, named Invalid.

Specified by:
getInvalid in interface OCLStandardLibrary<EClassifier>
Returns:
the Invalid type (an instance of InvalidType)

getReal

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

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

getString

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

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

getOclAny

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

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

getOclElement

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

Specified by:
getOclElement in interface OCLStandardLibrary<EClassifier>
Returns:
the OclElement type (an instance of ElementType)

getOclInvalid

public Object getOclInvalid()
Description copied from interface: OCLStandardLibrary
Obtains the single instance of the Invalid type, identified by the token OclInvalid.

Specified by:
getOclInvalid in interface OCLStandardLibrary<EClassifier>
Returns:
the OclInvalid instance (an instance of Invalid)

getState

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

getOclMessage

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

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

getOclType

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

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

getOclVoid

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

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

getT

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

getT2

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

getSet

public EClassifier getSet()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the SetType metatype, named Set(T).

Specified by:
getSet in interface OCLStandardLibrary<EClassifier>
Returns:
the Set(T) type (an instance of SetType)

getOrderedSet

public EClassifier getOrderedSet()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the OrderedSetType metatype, named OrderedSet(T).

Specified by:
getOrderedSet in interface OCLStandardLibrary<EClassifier>
Returns:
the OrderedSet(T) type (an instance of OrderedSetType)

getBag

public EClassifier getBag()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the BagType metatype, named Bag(T).

Specified by:
getBag in interface OCLStandardLibrary<EClassifier>
Returns:
the Bag(T) type (an instance of BagType)

getSequence

public EClassifier getSequence()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the SequenceType metatype, named Sequence(T).

Specified by:
getSequence in interface OCLStandardLibrary<EClassifier>
Returns:
the Sequence(T) type (an instance of SequenceType)

getCollection

public EClassifier getCollection()
Description copied from interface: OCLStandardLibrary
Obtains the generic instance of the CollectionType metatype, named Collection(T).

Specified by:
getCollection in interface OCLStandardLibrary<EClassifier>
Returns:
the Collection(T) type (an instance of CollectionType)

getOclExpression

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

getOwner

public static EClassifier getOwner(EOperation operation)

getOwner

public static EClassifier getOwner(EStructuralFeature property)

createShadowClass

public static EClass createShadowClass(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 EClass findShadowClass(EClassifier classifier,
                                     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 EClassifier getRealClassifier(EClass shadowClass)

getExistingOperations

public static EList<EOperation> getExistingOperations(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(Collection<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 EList<EOperation> selectIterators(Collection<EOperation> operations)
Selects from the specified operations those that are collection iterators.

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

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.