public interface EvaluationEnvironment<C,O,P,CLS,E>
See the Environment
class for a description of the
generic type parameters of this class.
As of the 1.2 release, evaluation environments are encouraged to implement
the Adaptable
interface to provide optional interfaces such as
Customizable
for specifying evaluation options. Moreover, the
(AbstractEvaluationEnvironment
) class implements the Adaptable
protocol. Use the OCLUtil.getAdapter(EvaluationEnvironment, Class)
method to obtain adapters for any evaluation environment instance.
Modifier and Type | Interface and Description |
---|---|
static interface |
EvaluationEnvironment.Enumerations<EL>
Optional adapter interface for evaluation
environments that support additional enumeration evaluation capabilities.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
Object value)
Adds the supplied name and value binding to the environment.
|
Object |
callOperation(O operation,
int opcode,
Object source,
Object[] args)
Invokes the specified operation on the given source element, according
to the particular metamodel semantics.
|
void |
clear()
Clears the environment of variables.
|
Map<CLS,Set<E>> |
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<O,P> |
createTuple(C type,
Map<P,Object> values)
Creates a new tuple instance.
|
C |
getType(Object object)
Queries the type of the specified object.
|
Object |
getValueOf(String name)
Returns the value associated with the supplied name
|
boolean |
isKindOf(Object object,
C classifier)
Queries whether an object is an instance of the specified classifier or
some specialization thereof.
|
boolean |
isTypeOf(Object object,
C classifier)
Queries whether an object's type is the specified classifier.
|
Object |
navigateAssociationClass(C associationClass,
P navigationSource,
Object source)
Obtains the instance of the specified association class that links the
specified source element, optionally via the specified property.
|
Object |
navigateProperty(P property,
List<?> qualifiers,
Object source)
Obtains the value of the specified operation, for the given source element,
according to the particular metamodel semantics.
|
boolean |
overrides(O operation,
int opcode)
Queries whether this evaluation environment provides a custom
implementation of the specified pre-defined OCL
operation . |
Object |
remove(String name)
Removes the supplied name and binding from the environment (if it exists)
and returns it.
|
void |
replace(String name,
Object value)
Replaces the current value of the supplied name with the supplied value.
|
Object getValueOf(String name)
name
- the name whose value is to be returnedvoid replace(String name, Object value)
name
- the namevalue
- the new valuevoid add(String name, Object value)
name
- the name to addvalue
- the associated bindingreplace(String, Object)
Object remove(String name)
name
- the name to removevoid clear()
boolean overrides(O operation, int opcode)
operation
.
In the case that the receiver does, then it must implement the
callOperation(O, int, java.lang.Object, java.lang.Object[])
method to apply the operation.operation
- an OCL operationopcode
- the operation code, if one of the operations pre-defined
by OCL. Otherwise, -1
true
if this evaluation environment provides an
implementation of this operation
; false
,
otherwisecallOperation(O, int, java.lang.Object, java.lang.Object[])
Object callOperation(O operation, int opcode, Object source, Object[] args) throws IllegalArgumentException
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 environmentObject navigateProperty(P property, List<?> qualifiers, Object source) throws IllegalArgumentException
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 environmentObject navigateAssociationClass(C associationClass, P navigationSource, Object source) throws IllegalArgumentException
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
environmentMap<CLS,Set<E>> createExtentMap(Object object)
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.
object
- a context object in the scope that covers the OCL
classifier extentsboolean isKindOf(Object object, C classifier)
object
- an objectclassifier
- a classifiertrue
if the specified classifier is the object's
type or some supertype thereof; false
, otherwiseboolean isTypeOf(Object object, C classifier)
object
- an objectclassifier
- a classifiertrue
if ths specified classifier is the object's
type; false
, otherwiseC getType(Object object)
object
- an objectCopyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.