|
||||||||||
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<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.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.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 UML 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 |
UMLEnvironment(Environment<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> parent)
Initializes me with a parent environment. |
protected |
UMLEnvironment(org.eclipse.emf.ecore.EPackage.Registry registry,
org.eclipse.emf.ecore.resource.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(org.eclipse.emf.ecore.EPackage.Registry registry,
org.eclipse.emf.ecore.resource.ResourceSet rset,
org.eclipse.emf.ecore.resource.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<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> |
createTypeResolver()
Deprecated. Override the createTypeResolver(Resource) method,
instead, handling the case where the resource is null |
protected TypeResolver<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> |
createTypeResolver(org.eclipse.emf.ecore.resource.Resource resource)
Creates a new type resolver for use with this environment. |
org.eclipse.uml2.uml.Property |
defineAttribute(org.eclipse.uml2.uml.Classifier owner,
Variable<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Parameter> variable,
org.eclipse.uml2.uml.Constraint constraint)
In processing an additional attribute definition, constructs the property and associates it with its definition constraint. |
org.eclipse.uml2.uml.Operation |
defineOperation(org.eclipse.uml2.uml.Classifier owner,
java.lang.String name,
org.eclipse.uml2.uml.Classifier type,
java.util.List<Variable<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Parameter>> params,
org.eclipse.uml2.uml.Constraint constraint)
In processing an additional operation definition, constructs the operation and associates it with its definition constraint. |
protected void |
findNonNavigableAssociationEnds(org.eclipse.uml2.uml.Classifier classifier,
java.lang.String name,
java.util.List<org.eclipse.uml2.uml.Property> ends)
Searches for non-navigable association ends with the specified name at the given classifier's end of an association. |
protected void |
findUnnamedAssociationEnds(org.eclipse.uml2.uml.Classifier classifier,
java.lang.String name,
java.util.List<org.eclipse.uml2.uml.Property> ends)
Searches for unnamed association ends using the specified name at the given classifier's end of an association. |
org.eclipse.uml2.uml.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. |
org.eclipse.emf.ecore.EClassifier |
getEClassifier(org.eclipse.uml2.uml.Classifier type,
java.lang.Object element)
Looks up the Ecore definition of the specified UML classifier, using the specified element as a context for finding profile
applications in the case that the classifier is a stereotype or some
other type in a Profile . |
EnvironmentFactory<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> |
getFactory()
Obtains the factory that created me, or an appropriate default factory if I was not created using a factory. |
FormattingHelper |
getFormatter()
I provide a custom formatting helper for UML metamodel. |
OCLFactory |
getOCLFactory()
Obtains a factory for the creation of types that are parameterized by model elements. |
OCLStandardLibrary<org.eclipse.uml2.uml.Classifier> |
getOCLStandardLibrary()
Obtains the collection of core types representing the OCL Standard Library. |
protected org.eclipse.emf.ecore.resource.ResourceSet |
getResourceSet()
Obtains the resource set in which I look for UML packages when resolving package names. |
java.util.List<org.eclipse.uml2.uml.State> |
getStates(org.eclipse.uml2.uml.Classifier 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. |
TypeResolver<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.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 org.eclipse.uml2.uml.Package |
getUMLMetamodel()
Obtains the UML metamodel library, loaded in my resource set. |
UMLReflection<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint> |
getUMLReflection()
Obtains a utility for for reflection on the UML metaclasses that are used by the OCL abstract syntax. |
boolean |
isInPostcondition(OCLExpression<org.eclipse.uml2.uml.Classifier> exp)
Checks whether the specified OCL expression is in an operation postcondition constraint. |
protected boolean |
isUnnamed(org.eclipse.uml2.uml.Property associationEnd)
Queries whether the specified association end has no name. |
org.eclipse.uml2.uml.Classifier |
lookupClassifier(java.util.List<java.lang.String> names)
Finds the classifier identified by the specified sequence of names (a qualified name). |
org.eclipse.uml2.uml.Package |
lookupPackage(java.util.List<java.lang.String> path)
Finds the package identified by the specified sequence of names (a qualified name). |
protected void |
setFactory(EnvironmentFactory<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> factory)
Sets the factory that created me. |
void |
setParent(Environment<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.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, 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, 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 UMLEnvironment(org.eclipse.emf.ecore.EPackage.Registry registry, org.eclipse.emf.ecore.resource.ResourceSet rset)
registry
- the Ecore package registry to userset
- the resource set to useprotected UMLEnvironment(org.eclipse.emf.ecore.EPackage.Registry registry, org.eclipse.emf.ecore.resource.ResourceSet rset, org.eclipse.emf.ecore.resource.Resource resource)
registry
- the Ecore package registry to userset
- the resource set to useresource
- my resource for persistenceprotected UMLEnvironment(Environment<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> parent)
parent
- my parent environmentMethod Detail |
---|
public EnvironmentFactory<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> getFactory()
Environment
EnvironmentFactory.createEnvironment(Environment)
protected void setFactory(EnvironmentFactory<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> factory)
factory
- my originating factorypublic org.eclipse.emf.ecore.EClassifier getEClassifier(org.eclipse.uml2.uml.Classifier type, java.lang.Object element)
element
as a context for finding profile
applications in the case that the classifier is a stereotype or some
other type in a Profile
. Finding the Ecore definition of a profile
type requires finding the actual applied version of the profile.
type
- a UML classifierelement
- an element in the context of which the OCL evaluation
is being performed
null
if not
foundpublic void setParent(Environment<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject> env)
Environment
null
if it was not already null
.
env
- my new parent environmentpublic OCLStandardLibrary<org.eclipse.uml2.uml.Classifier> getOCLStandardLibrary()
Environment
EnvironmentFactory
.
protected final org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
protected org.eclipse.uml2.uml.Package getUMLMetamodel()
public TypeResolver<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> getTypeResolver()
Environment
public OCLFactory getOCLFactory()
Environment
public UMLReflection<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint> getUMLReflection()
Environment
@Deprecated protected TypeResolver<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> createTypeResolver()
createTypeResolver(Resource)
method,
instead, handling the case where the resource is null
protected TypeResolver<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property> createTypeResolver(org.eclipse.emf.ecore.resource.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 org.eclipse.uml2.uml.Package lookupPackage(java.util.List<java.lang.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 org.eclipse.uml2.uml.Classifier lookupClassifier(java.util.List<java.lang.String> names)
Environment
names
- the qualified name
null
if not foundprotected void findNonNavigableAssociationEnds(org.eclipse.uml2.uml.Classifier classifier, java.lang.String name, java.util.List<org.eclipse.uml2.uml.Property> ends)
AbstractEnvironment
findNonNavigableAssociationEnds
in class AbstractEnvironment<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
classifier
- a classifier at an association endname
- the non-navigable end name to look forends
- collects the ends found by the subclass implementationprotected void findUnnamedAssociationEnds(org.eclipse.uml2.uml.Classifier classifier, java.lang.String name, java.util.List<org.eclipse.uml2.uml.Property> ends)
AbstractEnvironment
findUnnamedAssociationEnds
in class AbstractEnvironment<org.eclipse.uml2.uml.Package,org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Operation,org.eclipse.uml2.uml.Property,org.eclipse.uml2.uml.EnumerationLiteral,org.eclipse.uml2.uml.Parameter,org.eclipse.uml2.uml.State,org.eclipse.uml2.uml.CallOperationAction,org.eclipse.uml2.uml.SendSignalAction,org.eclipse.uml2.uml.Constraint,org.eclipse.uml2.uml.Class,org.eclipse.emf.ecore.EObject>
classifier
- a classifier at an association endname
- the initial-lower classifier name to look forends
- collects the ends found by the subclass implementationprotected boolean isUnnamed(org.eclipse.uml2.uml.Property associationEnd)
associationEnd
- an association end
public java.util.List<org.eclipse.uml2.uml.State> getStates(org.eclipse.uml2.uml.Classifier owner, java.util.List<java.lang.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 org.eclipse.uml2.uml.Property defineAttribute(org.eclipse.uml2.uml.Classifier owner, Variable<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Parameter> variable, org.eclipse.uml2.uml.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 org.eclipse.uml2.uml.Operation defineOperation(org.eclipse.uml2.uml.Classifier owner, java.lang.String name, org.eclipse.uml2.uml.Classifier type, java.util.List<Variable<org.eclipse.uml2.uml.Classifier,org.eclipse.uml2.uml.Parameter>> params, org.eclipse.uml2.uml.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 org.eclipse.uml2.uml.Constraint getDefinition(java.lang.Object feature)
Environment
feature
- a property or operation
null
if this feature is not defined by OCLpublic boolean isInPostcondition(OCLExpression<org.eclipse.uml2.uml.Classifier> exp)
Environment
exp
- an OCL expression
true
if it is in a postcondition constraint;
false
, otherwise (including case of no constraint at all)public FormattingHelper getFormatter()
getFormatter
in interface BasicEnvironment
getFormatter
in class AbstractBasicEnvironment
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |