|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.lpg.AbstractBasicEnvironment
org.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 EPackage
s
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.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>, Environment.Lookup<PK,C,O,P>, Environment.Registry |
Field Summary | |
---|---|
static java.lang.String |
OCL_STANDARD_LIBRARY_NS_URI
The namespace URI of the Ecore representation of the OCL Standard Library. |
Fields inherited from interface org.eclipse.ocl.Environment |
---|
OCL_NAMESPACE_URI, RESULT_VARIABLE_NAME, SELF_VARIABLE_NAME |
Constructor Summary | |
---|---|
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,
java.util.List<java.lang.String> pathPrefix,
java.util.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()
Deprecated. Override the createTypeResolver(Resource) method,
instead, handling the case where the resource is null |
protected TypeResolver<EClassifier,EOperation,EStructuralFeature> |
createTypeResolver(Resource resource)
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,
java.lang.String name,
EClassifier type,
java.util.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(java.util.List<java.lang.String> packageNames)
Looks in the EMF registry for a package with the specified qualified package name. |
static EPackage |
findPackage(java.util.List<java.lang.String> packageNames,
EPackage.Registry registry)
Looks in the given registry for a package with the specified qualified package name. |
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<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. |
java.util.List<EObject> |
getStates(EClassifier owner,
java.util.List<java.lang.String> pathPrefix)
Obtains the states matching the specified path prefix in the owner type by trying the collectStates(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(java.util.List<java.lang.String> names)
Finds the classifier identified by the specified sequence of names (a qualified name). |
EPackage |
lookupPackage(java.util.List<java.lang.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(java.lang.Object feature)
Removes the definition of an additional operation or property. |
Methods inherited from class org.eclipse.ocl.lpg.AbstractBasicEnvironment |
---|
analyzerError, analyzerError, analyzerError, analyzerWarning, basicGetOptions, clearOptions, createDefaultProblemHandler, createFormattingHelper, getASTMapping, getASTNodeToCSTNodeMap, getFormatter, getOptions, getParser, getProblemHandler, getValue, initASTMapping, initASTMapping, isEnabled, lexerError, parserError, problem, putOptions, removeOption, removeOptions, setASTNodeToCSTNodeMap, setOption, setParent, setParser, setProblemHandler, utilityError, validatorError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.ocl.lpg.BasicEnvironment |
---|
analyzerError, analyzerError, analyzerError, analyzerWarning, getASTMapping, getFormatter, getParser, getProblemHandler, initASTMapping, lexerError, parserError, problem, setParser, setProblemHandler, utilityError, validatorError |
Methods inherited from interface org.eclipse.ocl.options.Customizable |
---|
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption |
Field Detail |
---|
public static final java.lang.String OCL_STANDARD_LIBRARY_NS_URI
Constructor Detail |
---|
protected EcoreEnvironment(EPackage.Registry reg)
reg
- a package registryprotected EcoreEnvironment(EPackage.Registry reg, Resource resource)
reg
- a package registryresource
- a resource, which may or may not already have contentMethod 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)
Environment
null
if it was not already null
.
env
- my new parent environmentpublic OCLStandardLibrary<EClassifier> getOCLStandardLibrary()
Environment
EnvironmentFactory
.
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
@Deprecated protected TypeResolver<EClassifier,EOperation,EStructuralFeature> createTypeResolver()
createTypeResolver(Resource)
method,
instead, handling the case where the resource is null
protected TypeResolver<EClassifier,EOperation,EStructuralFeature> createTypeResolver(Resource resource)
Creates a new type resolver for use with this environment.
Subclasses may override.
resource
- the resource for the type resolver's persistence
public EPackage lookupPackage(java.util.List<java.lang.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(java.util.List<java.lang.String> names)
Environment
names
- the qualified name
null
if not foundpublic java.util.List<EObject> getStates(EClassifier owner, java.util.List<java.lang.String> pathPrefix)
collectStates(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(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, java.util.List<java.lang.String> pathPrefix, java.util.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, java.lang.String name, EClassifier type, java.util.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(java.lang.Object feature)
Environment
feature
- an additional property or operationpublic Constraint getDefinition(java.lang.Object feature)
Environment
feature
- a property or operation
null
if this feature is not defined by OCLpublic static EPackage findPackage(java.util.List<java.lang.String> packageNames)
packageNames
- the qualified package name
null
if not foundpublic static EPackage findPackage(java.util.List<java.lang.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 |