|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PK
- is substituted by the metaclass representing the metamodel's
analogue for the UML 2.x PackageC
- corresponds to the UML Classifier metaclassO
- corresponds to the UML Operation metaclassP
- corresponds to the UML Property metaclassEL
- corresponds to the UML EnumerationLiteral metaclass
(Enumerations are simply represented as classifiers)PM
- corresponds to the UML Parameter metaclassS
- corresponds to the UML State metaclass (for metamodels
that describe state machines)COA
- corresponds to the UML CallOperationAction metaclass
(used in message expressions)SSA
- corresponds to the UML SendSignalAction metaclass
(used in message expressions)CT
- corresponds to the UML Constraint metaclassCLS
- corresponds to the UML Class metaclassE
- corresponds to the UML Element metaclasspublic interface Environment
An Environment stores the variables created while evaluating an OCL expression, including self. It also maintains the context classifier and, if appropriate, operation or property. This interface is not typically used by clients of the parser API, but by providers of bindings for particular UML-like metamodels.
The generic type parameters of this interface represent the UML concepts that
the OCL parser and evaluation engine require. A binding for a particular
metamodel (e.g., Ecore or UML) is implemented as a concrete Environment
with appropriate metaclasses substituting for these type parameters.
This interface is not intended to be implemented "directly" by
providers of metamodel bindings.
It is highly recommended to extend the AbstractEnvironment
class,
instead.
Since 1.2, the default abstract implementation of this interface
(AbstractEnvironment
) implements the Adaptable
protocol to
provide dynamic interface adapters. Use the
OCLUtil.getAdapter(Environment, Class)
method to obtain
adapters for any environment instance.
AbstractEnvironment
,
EnvironmentFactory
Nested Class Summary | |
---|---|
static interface |
Environment.Internal
An interface that merges the Environment and
BasicEnvironment interfaces that define the
behaviour realised in abstract form by AbstractEnvironment . |
static interface |
Environment.Registry
A registry of environments. |
Field Summary | |
---|---|
static java.lang.String |
OCL_NAMESPACE_URI
Namespace URI of the OCL core metamodel, used for example as the source of certain Ecore annotations. |
static java.lang.String |
RESULT_VARIABLE_NAME
The name of the operation result variable 'result'. |
static java.lang.String |
SELF_VARIABLE_NAME
The name of the context variable 'self'. |
Method Summary | |
---|---|
boolean |
addElement(java.lang.String name,
Variable elem,
boolean explicit)
Adds a variable declaration to the environment. |
Package |
getContextPackage()
Obtains my context package, if any. |
Constraint |
getDefinition(java.lang.Object feature)
Obtains the definition constraint of the specified feature, if it is an additional attribute or operation defined via an OCL constraint. |
EnvironmentFactory |
getFactory()
Obtains the factory that created me, or an appropriate default factory if I was not created using a factory. |
OCLFactory |
getOCLFactory()
Obtains a factory for the creation of types that are parameterized by model elements. |
StandardLibrary |
getOCLStandardLibrary()
Obtains the collection of core types representing the OCL Standard Library. |
Environment |
getParent()
Obtains my parent environment, if I have one. |
Variable |
getSelfVariable()
Gets the self variable, looking it up in a parent environment if necessary. |
java.util.List<State> |
getStates(Type owner,
java.util.List<java.lang.String> pathPrefix)
Retrieves a list of all possible states of the specified owner
whose paths are prefixed by the specified partial name. |
TypeManager |
getTypeManager()
|
void |
setSelfVariable(Variable var)
Sets the "self" variable that is the implicit source of any property, operation, or association class call. |
Field Detail |
---|
static final java.lang.String OCL_NAMESPACE_URI
static final java.lang.String SELF_VARIABLE_NAME
static final java.lang.String RESULT_VARIABLE_NAME
Method Detail |
---|
EnvironmentFactory getFactory()
EnvironmentFactory.createEnvironment(Environment)
Environment getParent()
null
if I am a root environmentPackage getContextPackage()
#getContextClassifier()
StandardLibrary getOCLStandardLibrary()
EnvironmentFactory
.
TypeManager getTypeManager()
java.util.List<State> getStates(Type owner, java.util.List<java.lang.String> pathPrefix)
owner
whose paths are prefixed by the specified partial name. If the
owner is null
, then the target of the oclIsInState()
operation call is implicit and must be looked up in the usual way for
implicit operation call targets. This method is used for content-assist.
owner
- the classifier for which states are being sought. Can be
null
in the case of an oclIsInState() call on an
implicit targetpathPrefix
- partial path name of the states being sought. This
can be empty to find the first level of state names
boolean addElement(java.lang.String name, Variable elem, boolean explicit)
name
- the name of the variable, or null
elem
- a variable declarationexplicit
- whether this is an explicitly declared variable
true
if the variable was successfully added because
it wasn't already declared locally in this environment;
false
, otherwisevoid setSelfVariable(Variable var)
var
- the "self" variableVariable getSelfVariable()
null
if none (which should
only be the case in a root environment having only a package context,
if even that)Constraint getDefinition(java.lang.Object feature)
feature
- a property or operation
null
if this feature is not defined by OCLOCLFactory getOCLFactory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |