|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.AbstractEvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.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).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.ocl.AbstractEvaluationEnvironment |
---|
AbstractEvaluationEnvironment.AbstractTuple<O,P> |
Nested classes/interfaces inherited from interface org.eclipse.ocl.EvaluationEnvironment |
---|
EvaluationEnvironment.Enumerations<EL> |
Constructor Summary | |
---|---|
UMLEvaluationEnvironment(EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> parent)
Initializes me with my parent evaluation environment (nesting scope). |
|
UMLEvaluationEnvironment(UMLEnvironmentFactory factory)
Initializes me. |
Method Summary | |
---|---|
java.lang.Object |
callOperation(org.eclipse.uml2.uml.Operation operation,
int opcode,
java.lang.Object source,
java.lang.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. |
java.util.Map<org.eclipse.uml2.uml.Class,java.util.Set<org.eclipse.emf.ecore.EObject>> |
createExtentMap(java.lang.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<org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> |
createTuple(org.eclipse.uml2.uml.Classifier type,
java.util.Map<org.eclipse.uml2.uml.Property,java.lang.Object> values)
Creates a new tuple instance. |
protected org.eclipse.emf.ecore.EClassifier |
getEClassifier(org.eclipse.uml2.uml.Classifier umlClassifier,
java.lang.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 EvaluationMode |
getEffectiveEvaluationMode()
Queries my effective evaluation mode which is just my assigned mode, unless I am EvaluationMode.ADAPTIVE . |
protected EvaluationMode |
getEffectiveEvaluationMode(java.lang.Object context)
Queries my effective evaluation mode which is just my assigned mode, unless I am EvaluationMode.ADAPTIVE . |
protected org.eclipse.emf.ecore.EPackage |
getEPackage(org.eclipse.uml2.uml.Package pkg)
Looks up the Ecore definition of the specified UML package. |
protected org.eclipse.emf.ecore.EPackage.Registry |
getEPackageRegistry()
Obtains my package registry for looking up the Ecore definitions of UML packages. |
protected java.lang.Object |
getInvalidResult()
Obtains the language-binding-specific representation of the predefined OclInvalid object. |
protected java.lang.reflect.Method |
getJavaMethodFor(org.eclipse.uml2.uml.Operation operation,
java.lang.Object receiver)
Returns the java method that corresponds to the supplied EOperation |
org.eclipse.uml2.uml.Classifier |
getType(java.lang.Object object)
Queries the type of the specified object. |
java.lang.Object |
getValue(org.eclipse.uml2.uml.EnumerationLiteral enumerationLiteral)
Implements the interface by finding the corresponding Enumerator value in a generated (or dynamic) EMF implementation, else the same enumeration literal (supporting the instance-specification model case). |
boolean |
isKindOf(java.lang.Object object,
org.eclipse.uml2.uml.Classifier classifier)
Queries whether an object is an instance of the specified classifier or some specialization thereof. |
boolean |
isTypeOf(java.lang.Object object,
org.eclipse.uml2.uml.Classifier classifier)
Queries whether an object's type is the specified classifier. |
java.lang.Object |
navigateAssociationClass(org.eclipse.uml2.uml.Classifier associationClass,
org.eclipse.uml2.uml.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. |
java.lang.Object |
navigateProperty(org.eclipse.uml2.uml.Property property,
java.util.List<?> qualifiers,
java.lang.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, basicGetOptions, clear, clearOptions, getAdapter, getOptions, getParent, getValue, getValueOf, isEnabled, overrides, putOptions, remove, removeOption, removeOptions, replace, setOption, 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<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> parent)
parent
- my parent (nesting scope); must not be null
Method Detail |
---|
protected final org.eclipse.emf.ecore.EPackage.Registry getEPackageRegistry()
protected EvaluationMode getEffectiveEvaluationMode()
EvaluationMode.ADAPTIVE
. In that case, I derive an
effective evaluation mode from my self context variable.
Note that my effective evaluation mode is inherited from my parent evaluation environment, if I have one.
AbstractEvaluationEnvironment.getParent()
,
getEffectiveEvaluationMode(Object)
protected EvaluationMode getEffectiveEvaluationMode(java.lang.Object context)
EvaluationMode.ADAPTIVE
. In that case, I derive an
effective evaluation mode from the specified context object.
Note that my effective evaluation mode is inherited from my parent evaluation environment, if I have one.
AbstractEvaluationEnvironment.getParent()
public java.lang.Object callOperation(org.eclipse.uml2.uml.Operation operation, int opcode, java.lang.Object source, java.lang.Object[] args) throws java.lang.IllegalArgumentException
AbstractEvaluationEnvironment
callOperation
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
callOperation
in class AbstractEvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.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
java.lang.IllegalArgumentException
- if the operation is not supported
by this environmentprotected java.lang.reflect.Method getJavaMethodFor(org.eclipse.uml2.uml.Operation operation, java.lang.Object receiver)
AbstractEvaluationEnvironment
EOperation
getJavaMethodFor
in class AbstractEvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
operation
- the operation
protected java.lang.Object getInvalidResult()
AbstractEvaluationEnvironment
getInvalidResult
in class AbstractEvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
public java.lang.Object navigateProperty(org.eclipse.uml2.uml.Property property, java.util.List<?> qualifiers, java.lang.Object source) throws java.lang.IllegalArgumentException
EvaluationEnvironment
navigateProperty
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
property
- the property to navigatequalifiers
- the association-end qualifier values, or an empty list
if nonesource
- the source element owning the property value
java.lang.IllegalArgumentException
- if the property is not supported by the
element or by this environmentpublic java.lang.Object navigateAssociationClass(org.eclipse.uml2.uml.Classifier associationClass, org.eclipse.uml2.uml.Property navigationSource, java.lang.Object source) throws java.lang.IllegalArgumentException
EvaluationEnvironment
navigateAssociationClass
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
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
java.lang.IllegalArgumentException
- if the association class is not
associated with the source element, or is not supported by this
environmentpublic Tuple<org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> createTuple(org.eclipse.uml2.uml.Classifier type, java.util.Map<org.eclipse.uml2.uml.Property,java.lang.Object> values)
EvaluationEnvironment
createTuple
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
type
- the type (a TupleType
) of the tuple to be createdvalues
- a mapping of the tuple parts
public java.util.Map<org.eclipse.uml2.uml.Class,java.util.Set<org.eclipse.emf.ecore.EObject>> createExtentMap(java.lang.Object object)
EvaluationEnvironment
object
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.
createExtentMap
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
object
- a context object in the scope that covers the OCL
classifier extents
public boolean isKindOf(java.lang.Object object, org.eclipse.uml2.uml.Classifier classifier)
EvaluationEnvironment
isKindOf
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
object
- an objectclassifier
- a classifier
true
if the specified classifier is the object's
type or some supertype thereof; false
, otherwisepublic boolean isTypeOf(java.lang.Object object, org.eclipse.uml2.uml.Classifier classifier)
EvaluationEnvironment
isTypeOf
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
object
- an objectclassifier
- a classifier
true
if ths specified classifier is the object's
type; false
, otherwisepublic org.eclipse.uml2.uml.Classifier getType(java.lang.Object object)
EvaluationEnvironment
getType
in interface EvaluationEnvironment<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
object
- an object
protected org.eclipse.emf.ecore.EPackage getEPackage(org.eclipse.uml2.uml.Package pkg)
pkg
- a UML package
null
if not foundprotected org.eclipse.emf.ecore.EClassifier getEClassifier(org.eclipse.uml2.uml.Classifier umlClassifier, java.lang.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
foundpublic java.lang.Object getValue(org.eclipse.uml2.uml.EnumerationLiteral enumerationLiteral)
getValue
in interface EvaluationEnvironment.Enumerations<org.eclipse.uml2.uml.EnumerationLiteral>
enumerationLiteral
- the enumeration literal model element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |