public class UMLEvaluationEnvironment extends AbstractEvaluationEnvironment<Classifier,Operation,Property,Class,EObject> implements EvaluationEnvironment.Enumerations<EnumerationLiteral>
EvaluationEnvironment
for evaluation of OCL
expressions on instances of UML models (i.e., on M0 models).EvaluationEnvironment.Enumerations<EL>
Constructor and Description |
---|
UMLEvaluationEnvironment(EvaluationEnvironment<Classifier,Operation,Property,Class,EObject> parent)
Initializes me with my parent evaluation environment (nesting scope).
|
UMLEvaluationEnvironment(UMLEnvironmentFactory factory)
Initializes me.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Classifier |
getType(Object object)
Queries the type of the specified object.
|
Object |
getValue(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(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.
|
add, clear, clearOptions, getAdapter, getOptions, getValueOf, isEnabled, overrides, putOptions, remove, removeOption, removeOptions, replace, setOption, toString
public UMLEvaluationEnvironment(UMLEnvironmentFactory factory)
public UMLEvaluationEnvironment(EvaluationEnvironment<Classifier,Operation,Property,Class,EObject> parent)
parent
- my parent (nesting scope); must not be null
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 noneIllegalArgumentException
- if the operation is not supported
by this environmentpublic Object navigateProperty(Property property, List<?> qualifiers, Object source) throws IllegalArgumentException
EvaluationEnvironment
navigateProperty
in interface EvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
property
- the property to navigatequalifiers
- the association-end qualifier values, or an empty list
if nonesource
- the source element owning the property valueIllegalArgumentException
- if the property is not supported by the
element or by this environmentpublic Object navigateAssociationClass(Classifier associationClass, Property navigationSource, Object source) throws IllegalArgumentException
EvaluationEnvironment
navigateAssociationClass
in interface EvaluationEnvironment<Classifier,Operation,Property,Class,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 navigateIllegalArgumentException
- if the association class is not
associated with the source element, or is not supported by this
environmentpublic Tuple<Operation,Property> createTuple(Classifier type, Map<Property,Object> values)
EvaluationEnvironment
createTuple
in interface EvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
type
- the type (a TupleType
) of the tuple to be createdvalues
- a mapping of the tuple partspublic Map<Class,Set<EObject>> createExtentMap(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<Classifier,Operation,Property,Class,EObject>
object
- a context object in the scope that covers the OCL
classifier extentspublic boolean isKindOf(Object object, Classifier classifier)
EvaluationEnvironment
isKindOf
in interface EvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
object
- an objectclassifier
- a classifiertrue
if the specified classifier is the object's
type or some supertype thereof; false
, otherwisepublic boolean isTypeOf(Object object, Classifier classifier)
EvaluationEnvironment
isTypeOf
in interface EvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
object
- an objectclassifier
- a classifiertrue
if ths specified classifier is the object's
type; false
, otherwisepublic Classifier getType(Object object)
EvaluationEnvironment
getType
in interface EvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
object
- an objectpublic Object getValue(EnumerationLiteral enumerationLiteral)
getValue
in interface EvaluationEnvironment.Enumerations<EnumerationLiteral>
getValue
in interface Customizable
getValue
in class AbstractEvaluationEnvironment<Classifier,Operation,Property,Class,EObject>
enumerationLiteral
- the option to queryCopyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.