|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.ocl.AbstractEvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
org.eclipse.ocl.uml.UMLEvaluationEnvironment
public class UMLEvaluationEnvironment
Implementation of the EvaluationEnvironment for evaluation of OCL
expressions on instances of UML models (i.e., on M0 models).
| Constructor Summary | |
|---|---|
UMLEvaluationEnvironment(EvaluationEnvironment<Classifier,Operation,Property,Class,EObject> parent)
Initializes me with my parent evaluation environment (nesting scope). |
|
UMLEvaluationEnvironment(UMLEnvironmentFactory factory)
Initializes me. |
|
| Method Summary | |
|---|---|
Object |
callOperation(Operation operation,
int opcode,
Object source,
Object[] args)
Implements the inherited method by attempting to find an appropriate Java method in the actual type of the source object and invoking it. |
Map<Class,Set<EObject>> |
createExtentMap(Object object)
Creates an extent map for invocation of OclType.allInstances() using the specified object as a context from which to find
the scope in which OCL classifier extents are defined. |
Tuple<Operation,Property> |
createTuple(Classifier type,
Map<Property,Object> values)
Creates a new tuple instance. |
protected EClassifier |
getEClassifier(Classifier umlClassifier,
Object element)
Looks up the Ecore definition of the specified UML classifier, using the specified element as a context for finding profile
applications in the case that the classifier is a stereotype or some
other type in a Profile. |
protected EPackage |
getEPackage(Package pkg)
Looks up the Ecore definition of the specified UML package. |
protected EPackage.Registry |
getEPackageRegistry()
Obtains my package registry for looking up the Ecore definitions of UML packages. |
protected Object |
getInvalidResult()
Obtains the language-binding-specific representation of the predefined OclInvalid object. |
protected Method |
getJavaMethodFor(Operation operation,
Object receiver)
Returns the java method that corresponds to the supplied EOperation |
Classifier |
getType(Object object)
Queries the type of the specified object. |
boolean |
isKindOf(Object object,
Classifier classifier)
Queries whether an object is an instance of the specified classifier or some specialization thereof. |
boolean |
isTypeOf(Object object,
Classifier classifier)
Queries whether an object's type is the specified classifier. |
Object |
navigateAssociationClass(Classifier associationClass,
Property navigationSource,
Object source)
Obtains the instance of the specified association class that links the specified source element, optionally via the specified property. |
Object |
navigateProperty(Property property,
List<?> qualifiers,
Object source)
Obtains the value of the specified operation, for the given source element, according to the particular metamodel semantics. |
| Methods inherited from class org.eclipse.ocl.AbstractEvaluationEnvironment |
|---|
add, clear, getParent, getValueOf, overrides, remove, replace, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UMLEvaluationEnvironment(UMLEnvironmentFactory factory)
public UMLEvaluationEnvironment(EvaluationEnvironment<Classifier,Operation,Property,Class,EObject> parent)
parent - my parent (nesting scope); must not be null| Method Detail |
|---|
protected final EPackage.Registry getEPackageRegistry()
public Object callOperation(Operation operation,
int opcode,
Object source,
Object[] args)
throws IllegalArgumentException
AbstractEvaluationEnvironment
callOperation in interface EvaluationEnvironment<Classifier,Operation,Property,Class,EObject>callOperation in class AbstractEvaluationEnvironment<Classifier,Operation,Property,Class,EObject>operation - the operation to invokeopcode - the operation code, if this is an OCL Standard Library
operation (which this environment overrides)source - the source element on which the operation is invokedargs - the arguments, or an empty array if none
IllegalArgumentException - if the operation is not supported
by this environment
protected Method getJavaMethodFor(Operation operation,
Object receiver)
AbstractEvaluationEnvironmentEOperation
getJavaMethodFor in class AbstractEvaluationEnvironment<Classifier,Operation,Property,Class,EObject>operation - the operation
protected Object getInvalidResult()
AbstractEvaluationEnvironment
getInvalidResult in class AbstractEvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
public Object navigateProperty(Property property,
List<?> qualifiers,
Object source)
throws IllegalArgumentException
EvaluationEnvironment
property - the property to navigatequalifiers - the association-end qualifier values, or an empty list
if nonesource - the source element owning the property value
IllegalArgumentException - if the property is not supported by the
element or by this environment
public Object navigateAssociationClass(Classifier associationClass,
Property navigationSource,
Object source)
throws IllegalArgumentException
EvaluationEnvironment
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
IllegalArgumentException - if the association class is not
associated with the source element, or is not supported by this
environment
public Tuple<Operation,Property> createTuple(Classifier type,
Map<Property,Object> values)
EvaluationEnvironment
type - the type (a TupleType) of the tuple to be createdvalues - a mapping of the tuple parts
public Map<Class,Set<EObject>> createExtentMap(Object object)
EvaluationEnvironmentobject as a context from which to find
the scope in which OCL classifier extents are defined. This scope may
be a resource, resource set, or some metamodel-specific scope. Note that
in the case that the object is not an
EObject but is, instead, some primitive
type, then this may be difficult to determine.
Clients are encouraged to do what they can to optimize this mapping, by
lazy initialization of key-value pairs, workspace indices, or whatever
means is available. Note that the map will only ever be accessed by
key (Map.get(java.lang.Object)); it will never be queried for
all entries, all keys, all values, etc. This knowledge could help
optimization.
object - a context object in the scope that covers the OCL
classifier extents
public boolean isKindOf(Object object,
Classifier classifier)
EvaluationEnvironment
object - an objectclassifier - a classifier
true if the specified classifier is the object's
type or some supertype thereof; false, otherwise
public boolean isTypeOf(Object object,
Classifier classifier)
EvaluationEnvironment
object - an objectclassifier - a classifier
true if ths specified classifier is the object's
type; false, otherwisepublic Classifier getType(Object object)
EvaluationEnvironment
object - an object
protected EPackage getEPackage(Package pkg)
pkg - a UML package
null if not found
protected EClassifier getEClassifier(Classifier umlClassifier,
Object element)
element as a context for finding profile
applications in the case that the classifier is a stereotype or some
other type in a Profile. Finding the Ecore definition of a
profile type requires finding the actual applied version of the profile.
umlClassifier - a UML classifierelement - an element in the context of which the OCL evaluation is being
performed
null if not
found
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||