|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.ocl.AbstractEnvironment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject>
org.eclipse.ocl.ecore.EcoreEnvironment
public class EcoreEnvironment
Implementation of the Environment for parsing OCL expressions on
Ecore models. The EcoreEnvironment uses a client-supplied
package registry (or the global registry) to look up EPackages
by qualified name.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.eclipse.ocl.AbstractEnvironment |
|---|
AbstractEnvironment.VariableEntry |
| Nested classes/interfaces inherited from interface org.eclipse.ocl.Environment |
|---|
Environment.Registry |
| Field Summary |
|---|
| Fields inherited from interface org.eclipse.ocl.Environment |
|---|
OCL_NAMESPACE_URI, RESULT_VARIABLE_NAME, SELF_VARIABLE_NAME |
| Constructor Summary | |
|---|---|
protected |
EcoreEnvironment(Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> parent)
Initializes me with a parent environment, from which I inherit such things as a package registry and a resource. |
protected |
EcoreEnvironment(EPackage.Registry reg)
Initializes me with a package registry for package look-ups. |
protected |
EcoreEnvironment(EPackage.Registry reg,
Resource resource)
Initializes me with a package registry and a resource in which I am persisted (and from which I load myself if it already has content). |
| Method Summary | |
|---|---|
protected void |
collectStates(EClassifier owner,
List<String> pathPrefix,
List<EObject> 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. |
protected TypeResolver<EClassifier,EOperation,EStructuralFeature> |
createTypeResolver()
Creates a new type resolver for use with this environment. |
EStructuralFeature |
defineAttribute(EClassifier owner,
Variable<EClassifier,EParameter> variable,
Constraint constraint)
In processing an additional attribute definition, constructs the property and associates it with its definition constraint. |
EOperation |
defineOperation(EClassifier owner,
String name,
EClassifier type,
List<Variable<EClassifier,EParameter>> params,
Constraint constraint)
In processing an additional operation definition, constructs the operation and associates it with its definition constraint. |
static EPackage |
findPackage(List<String> packageNames)
Looks in the EMF registry for a package with the specified qualified package name. |
static EPackage |
findPackage(List<String> packageNames,
EPackage.Registry registry)
Looks in the given registry for a package with the specified qualified package name. |
Constraint |
getDefinition(Object feature)
Obtains the definition constraint of the specified feature, if it is an additional attribute or operation defined via an OCL constraint. |
EnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> |
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. |
OCLStandardLibrary<EClassifier> |
getOCLStandardLibrary()
Obtains the collection of core types representing the OCL Standard Library. |
List<EObject> |
getStates(EClassifier owner,
List<String> pathPrefix)
Obtains the states matching the specified path prefix in the owner type by trying the collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List method on it and, recursively, its
supertypes to find all matches. |
TypeResolver<EClassifier,EOperation,EStructuralFeature> |
getTypeResolver()
Obtains a type resolver to be used to create (and cache) concrete bindings for the generic OCL types, based on the user model types provided by this environment. |
UMLReflection<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint> |
getUMLReflection()
Obtains a utility for for reflection on the UML metaclasses that are used by the OCL abstract syntax. |
boolean |
isInPostcondition(OCLExpression<EClassifier> exp)
Checks whether the specified OCL expression is in an operation postcondition constraint. |
EClassifier |
lookupClassifier(List<String> names)
Finds the classifier identified by the specified sequence of names (a qualified name). |
EPackage |
lookupPackage(List<String> path)
Finds the package identified by the specified sequence of names (a qualified name). Implements the inherited specification by looking up the qualified name in my package registry. |
protected void |
setFactory(EnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> factory)
Sets the factory that created me. |
void |
setParent(Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> env)
Sets my parent environment. |
void |
undefine(Object feature)
Removes the definition of an additional operation or property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected EcoreEnvironment(EPackage.Registry reg)
reg - a package registry
protected EcoreEnvironment(EPackage.Registry reg,
Resource resource)
reg - a package registryresource - a resource, which may or may not already have contentprotected EcoreEnvironment(Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> parent)
parent - my parent environment| Method Detail |
|---|
public EnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> getFactory()
Environment
EnvironmentFactory.createEnvironment(Environment)protected void setFactory(EnvironmentFactory<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> factory)
factory - my originating factorypublic void setParent(Environment<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint,EClass,EObject> env)
Environmentnull if it was not already null.
env - my new parent environmentpublic OCLStandardLibrary<EClassifier> getOCLStandardLibrary()
EnvironmentEnvironmentFactory.
public TypeResolver<EClassifier,EOperation,EStructuralFeature> getTypeResolver()
Environment
public OCLFactory getOCLFactory()
Environment
public UMLReflection<EPackage,EClassifier,EOperation,EStructuralFeature,EEnumLiteral,EParameter,EObject,CallOperationAction,SendSignalAction,Constraint> getUMLReflection()
Environment
protected TypeResolver<EClassifier,EOperation,EStructuralFeature> createTypeResolver()
public EPackage lookupPackage(List<String> path)
Implements the inherited specification by looking up the qualified name in my package registry.
path - the qualified name
null if not foundpublic EClassifier lookupClassifier(List<String> names)
Environment
names - the qualified name
null if not found
public List<EObject> getStates(EClassifier owner,
List<String> pathPrefix)
collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List, java.util.List) 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.emf.ecore.EClassifier, java.util.List 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 names
protected void collectStates(EClassifier owner,
List<String> pathPrefix,
List<EObject> 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(EClassifier, List)
public EStructuralFeature defineAttribute(EClassifier owner,
Variable<EClassifier,EParameter> variable,
Constraint constraint)
Environment
owner - the context classifier of the property definition constraintvariable - the name and type of the property (conveniently
encapsulated in a variable)constraint - the definition constraint
public EOperation defineOperation(EClassifier owner,
String name,
EClassifier type,
List<Variable<EClassifier,EParameter>> params,
Constraint constraint)
Environment
owner - the context classifier of the property definition constraintname - the operation nameparams - the names and types of the parameters, if any (conveniently
encapsulated in variables)constraint - the definition constraint
public void undefine(Object feature)
Environment
feature - an additional property or operationpublic Constraint getDefinition(Object feature)
Environment
feature - a property or operation
null
if this feature is not defined by OCLpublic static EPackage findPackage(List<String> packageNames)
packageNames - the qualified package name
null if not found
public static EPackage findPackage(List<String> packageNames,
EPackage.Registry registry)
packageNames - the qualified package nameregistry - the EPackage.Registry to look in
null if not foundpublic boolean isInPostcondition(OCLExpression<EClassifier> exp)
Environment
exp - an OCL expression
true if it is in a postcondition constraint;
false, otherwise (including case of no constraint at all)
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||