org.eclipse.ocl.examples.pivot.evaluation
Class PivotEvaluationEnvironment
java.lang.Object
org.eclipse.ocl.examples.pivot.AbstractBasicEnvironment<EvaluationEnvironment>
org.eclipse.ocl.examples.pivot.evaluation.AbstractEvaluationEnvironment
org.eclipse.ocl.examples.pivot.evaluation.PivotEvaluationEnvironment
- All Implemented Interfaces:
- DomainEvaluationEnvironment, Adaptable, BasicEnvironment, Customizable, EvaluationEnvironment
- Direct Known Subclasses:
- VMEvaluationEnvironment
public class PivotEvaluationEnvironment
- extends AbstractEvaluationEnvironment
Implementation of the EvaluationEnvironment
for evaluation of OCL
expressions on instances of Ecore models (i.e., on M0 models).
- Author:
- Tim Klinger (tklinger), Christian W. Damus (cdamus)
Method Summary |
DomainModelManager |
createModelManager(java.lang.Object object)
Retrieves the reference feature in the specified context object that
references the specified association class. |
DomainTypedElement |
createVariable(java.lang.String name,
DomainType type)
Ecore implementation of the enumeration literal value. |
Type |
getType(java.lang.Object object)
Queries the type of the specified object. |
java.lang.Object |
navigateAssociationClass(Type associationClass,
Property navigationSource,
java.lang.Object source)
Obtains the instance of the specified association class that links the
specified source element, optionally via the specified property. |
Methods inherited from class org.eclipse.ocl.examples.pivot.AbstractBasicEnvironment |
basicGetOptions, clearOptions, getAdapter, getOptions, getParent, getValue, isEnabled, notOK, putOptions, removeOption, removeOptions, setOption, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PivotEvaluationEnvironment
public PivotEvaluationEnvironment(@NonNull
MetaModelManager metaModelManager)
- Initializes me.
PivotEvaluationEnvironment
public PivotEvaluationEnvironment(@NonNull
EvaluationEnvironment parent)
- Initializes me with my parent evaluation environment (nesting scope).
- Parameters:
parent
- my parent (nesting scope); must not be null
createModelManager
@NonNull
public DomainModelManager createModelManager(@Nullable
java.lang.Object object)
- Retrieves the reference feature in the specified context object that
references the specified association class.
- Parameters:
context
- the context objectassociationClass
- the association class that it references
- Returns:
- the reference in question
private EReference getAssociationClassReference(EObject context,
org.eclipse.ocl.examples.pivot.Class associationClass) {
EReference result = null;
StringBuilder nameBuf = new StringBuilder(associationClass.getName());
UnicodeSupport.setCodePointAt(nameBuf, 0, UnicodeSupport
.toLowerCase(UnicodeSupport.codePointAt(nameBuf, 0)));
String name = nameBuf.toString();
for (EReference next : context.eClass().getEAllReferences()) {
if (name.equals(next.getName())
&& (associationClass == next.getEReferenceType())) {
result = next;
break;
}
}
return result;
}
createVariable
@NonNull
public DomainTypedElement createVariable(@NonNull
java.lang.String name,
@NonNull
DomainType type)
- Ecore implementation of the enumeration literal value.
- Since:
- 1.2
public Enumerator getValue(EnumerationLiteral enumerationLiteral) {
return enumerationLiteral.getInstance();
}
navigateAssociationClass
public java.lang.Object navigateAssociationClass(Type associationClass,
Property navigationSource,
java.lang.Object source)
throws java.lang.IllegalArgumentException
- Description copied from interface:
EvaluationEnvironment
- Obtains the instance of the specified association class that links the
specified source element, optionally via the specified property.
- Parameters:
associationClass
- the association class to navigate tonavigationSource
- in case of ambiguity, the property of the
source element's classifier through which to navigate to the
association classsource
- the source element from which to navigate
- Returns:
- the association class instance
- Throws:
java.lang.IllegalArgumentException
- if the association class is not
associated with the source element, or is not supported by this
environment
getType
public Type getType(java.lang.Object object)
- Description copied from interface:
EvaluationEnvironment
- Queries the type of the specified object.
- Parameters:
object
- an object
- Returns:
- its type