|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public 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.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. |
void |
dispose()
Disposes of any objects that I have created that should be cleaned up. |
Type |
getContextClassifier()
Obtains the context classifier of this environment. |
Operation |
getContextOperation()
Obtains the context operation of this environment, if it is an operation context. |
Package |
getContextPackage()
Obtains my context package, if any. |
Property |
getContextProperty()
Obtains the context property of this environment, if it is a property context. |
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. |
MetaModelManager |
getMetaModelManager()
|
PivotFactory |
getOCLFactory()
Obtains a factory for the creation of types that are parameterized by model elements. |
DomainStandardLibrary |
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. |
void |
setSelfVariable(Variable var)
Sets the "self" variable that is the implicit source of any property, operation, or association class call. |
Methods inherited from interface org.eclipse.ocl.examples.pivot.Adaptable |
---|
getAdapter |
Methods inherited from interface org.eclipse.ocl.examples.pivot.Customizable |
---|
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption |
Field Detail |
---|
@NonNull static final java.lang.String OCL_NAMESPACE_URI
@NonNull static final java.lang.String SELF_VARIABLE_NAME
@NonNull static final java.lang.String RESULT_VARIABLE_NAME
Method Detail |
---|
void dispose()
@NonNull EnvironmentFactory getFactory()
EnvironmentFactory.createEnvironment(Environment)
@Nullable Environment getParent()
null
if I am a root environment@Nullable Package getContextPackage()
getContextClassifier()
@Nullable Type getContextClassifier()
@Nullable Operation getContextOperation()
null
if this is not an
operation environment@Nullable Property getContextProperty()
null
if this is not a
property environment@NonNull DomainStandardLibrary getOCLStandardLibrary()
EnvironmentFactory
.
@NonNull MetaModelManager getMetaModelManager()
@NonNull java.util.List<State> getStates(@NonNull Type owner, @NonNull 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(@NonNull java.lang.String name, @NonNull 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(@NonNull Variable var)
var
- the "self" variable@Nullable Variable getSelfVariable()
null
if none (which should
only be the case in a root environment having only a package context,
if even that)Constraint getDefinition(@NonNull java.lang.Object feature)
feature
- a property or operation
null
if this feature is not defined by OCL@NonNull PivotFactory getOCLFactory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |