|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.ocl.AbstractEnvironment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> org.eclipse.ocl.uml.UMLEnvironment
public class UMLEnvironment
Implementation of the Environment
for parsing OCL expressions on UML
models. The UMLEnvironment
uses a client-supplied resource set
to look up UML Package
s in UML resources. It also uses an
EPackage
registry to find the corresponding Ecore definitions of
packages when evaluating expressions on instances of the UML model (in the
case of evaluation on UML2-generated API objects).
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 |
UMLEnvironment(Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> parent)
Initializes me with a parent environment. |
protected |
UMLEnvironment(EPackage.Registry registry,
ResourceSet rset)
Initializes me with a package registry for looking up the Ecore representations of UML packages and a resource set for looking up UML packages in UML resources. |
protected |
UMLEnvironment(EPackage.Registry registry,
ResourceSet rset,
Resource resource)
Initializes me with a package registry for looking up the Ecore representations of UML packages, a resource set for looking up UML packages in UML resources, and a resource from which to load myself. |
Method Summary | |
---|---|
protected TypeResolver<Classifier,Operation,Property> |
createTypeResolver()
Creates a new type resolver for use with this environment. |
Property |
defineAttribute(Classifier owner,
Variable<Classifier,Parameter> variable,
Constraint constraint)
In processing an additional attribute definition, constructs the property and associates it with its definition constraint. |
Operation |
defineOperation(Classifier owner,
String name,
Classifier type,
List<Variable<Classifier,Parameter>> params,
Constraint constraint)
In processing an additional operation definition, constructs the operation and associates it with its definition constraint. |
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<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,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<Classifier> |
getOCLStandardLibrary()
Obtains the collection of core types representing the OCL Standard Library. |
protected ResourceSet |
getResourceSet()
Obtains the resource set in which I look for UML packages when resolving package names. |
List<State> |
getStates(Classifier owner,
List<String> pathPrefix)
Retrieves a list of all possible states of the specified owner
whose paths are prefixed by the specified partial name. |
TypeResolver<Classifier,Operation,Property> |
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. |
protected Package |
getUMLMetamodel()
Obtains the UML metamodel library, loaded in my resource set. |
UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,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<Classifier> exp)
Checks whether the specified OCL expression is in an operation postcondition constraint. |
Classifier |
lookupClassifier(List<String> names)
Finds the classifier identified by the specified sequence of names (a qualified name). |
Package |
lookupPackage(List<String> path)
Finds the package identified by the specified sequence of names (a qualified name). Implements the inherited specification by looking in my resource set for a resource containing the specified package. |
Property |
lookupProperty(Classifier owner,
String name)
Finds a property defined or inherited by the specified classifier. |
protected void |
setFactory(EnvironmentFactory<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> factory)
Sets the factory that created me. |
void |
setParent(Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,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 UMLEnvironment(EPackage.Registry registry, ResourceSet rset)
registry
- the Ecore package registry to userset
- the resource set to useprotected UMLEnvironment(EPackage.Registry registry, ResourceSet rset, Resource resource)
registry
- the Ecore package registry to userset
- the resource set to useresource
- my resource for persistenceprotected UMLEnvironment(Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> parent)
parent
- my parent environmentMethod Detail |
---|
public EnvironmentFactory<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> getFactory()
Environment
EnvironmentFactory.createEnvironment(Environment)
protected void setFactory(EnvironmentFactory<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> factory)
factory
- my originating factorypublic void setParent(Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject> env)
Environment
null
if it was not already null
.
env
- my new parent environmentpublic OCLStandardLibrary<Classifier> getOCLStandardLibrary()
Environment
EnvironmentFactory
.
protected final ResourceSet getResourceSet()
protected Package getUMLMetamodel()
public TypeResolver<Classifier,Operation,Property> getTypeResolver()
Environment
public OCLFactory getOCLFactory()
Environment
public UMLReflection<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint> getUMLReflection()
Environment
protected TypeResolver<Classifier,Operation,Property> createTypeResolver()
public Package lookupPackage(List<String> path)
Implements the inherited specification by looking in my resource set for a resource containing the specified package.
path
- the qualified name
null
if not foundpublic Classifier lookupClassifier(List<String> names)
Environment
names
- the qualified name
null
if not foundpublic Property lookupProperty(Classifier owner, String name)
Environment
lookupProperty
in interface Environment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject>
lookupProperty
in class AbstractEnvironment<Package,Classifier,Operation,Property,EnumerationLiteral,Parameter,State,CallOperationAction,SendSignalAction,Constraint,Class,EObject>
owner
- the owner of the property that we are looking for, or
null
to find an implicit owner type (in iteration
expressions)name
- the property name
null
if it could not be foundpublic List<State> getStates(Classifier owner, List<String> pathPrefix)
Environment
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
public Property defineAttribute(Classifier owner, Variable<Classifier,Parameter> 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 Operation defineOperation(Classifier owner, String name, Classifier type, List<Variable<Classifier,Parameter>> 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 boolean isInPostcondition(OCLExpression<Classifier> 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 |