public class PivotEnvironment extends AbstractEnvironment
Environment
for parsing OCL expressions on
Ecore models. The EcoreEnvironment
uses a client-supplied
package registry (or the global registry) to look up EPackage
s
by qualified name.AbstractEnvironment.VariableEntry
Environment.Registry
parent
OCL_NAMESPACE_URI, RESULT_VARIABLE_NAME, SELF_VARIABLE_NAME
Modifier | Constructor and Description |
---|---|
protected |
PivotEnvironment(PivotEnvironment parent)
Initializes me with a parent environment, from which I inherit such things
as a package registry and a resource.
|
protected |
PivotEnvironment(PivotEnvironmentFactory factory,
org.eclipse.emf.ecore.resource.Resource resource)
Initializes me with an environment factory from which package registry
and opposite end finder (if any) are obtained consistently, and from a
resource in which I am persisted (and from which I load myself if it
already has content).
|
Modifier and Type | Method and Description |
---|---|
protected void |
collectStates(Type owner,
java.util.List<java.lang.String> pathPrefix,
java.util.List<State> states)
Implemented by subclasses to find all states in the specified owner type
that match the given path name prefix and add them to the accumulator
list.
|
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.
|
java.util.List<State> |
getStates(Type owner,
java.util.List<java.lang.String> pathPrefix)
Obtains the states matching the specified path prefix in the owner type
by trying the
collectStates(org.eclipse.ocl.examples.pivot.Type, java.util.List<java.lang.String>, java.util.List<org.eclipse.ocl.examples.pivot.State>) method on it and, recursively, its
supertypes to find all matches. |
addElement, dispose, getContextClassifier, getContextOperation, getContextPackage, getContextProperty, getSelfVariable, setContextOperation, setContextPackage, setContextProperty, setSelfVariable
basicGetOptions, clearOptions, getAdapter, getOptions, getParent, getValue, isEnabled, notOK, putOptions, removeOption, removeOptions, setOption, setParent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParent
getAdapter
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption
protected PivotEnvironment(@NonNull PivotEnvironmentFactory factory, @Nullable org.eclipse.emf.ecore.resource.Resource resource)
reg
- a package registryresource
- a resource, which may or may not already have contentprotected PivotEnvironment(@NonNull PivotEnvironment parent)
parent
- my parent environment@NonNull public EnvironmentFactory getFactory()
Environment
EnvironmentFactory.createEnvironment(Environment)
@NonNull public java.util.List<State> getStates(@NonNull Type owner, @NonNull java.util.List<java.lang.String> pathPrefix)
collectStates(org.eclipse.ocl.examples.pivot.Type, java.util.List<java.lang.String>, java.util.List<org.eclipse.ocl.examples.pivot.State>)
method on it and, recursively, its
supertypes to find all matches. For implicit (null
) owners,
looks up the innermost-scoped variable as the implicit source and tries
again on this variable's type.
To extend this implementation, override the
collectStates(org.eclipse.ocl.examples.pivot.Type, java.util.List<java.lang.String>, java.util.List<org.eclipse.ocl.examples.pivot.State>)
method.
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 namesprotected void collectStates(Type owner, java.util.List<java.lang.String> pathPrefix, java.util.List<State> states)
Implementors must only provide the states defined directly in the namespace indicated by the path prefix (i.e., only one level).
owner
- the owner typepathPrefix
- partial qualified name, specifying the parent of the
states to be collectionstates
- a list of states directly owned by the namespace indicated
by path prefix, within the owner typegetStates(Type, List)
public Constraint getDefinition(@NonNull java.lang.Object feature)
Environment
feature
- a property or operationnull
if this feature is not defined by OCL@NonNull public MetaModelManager getMetaModelManager()
@NonNull public DomainStandardLibrary getOCLStandardLibrary()
Environment
EnvironmentFactory
.@NonNull public PivotFactory getOCLFactory()
Environment