|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An Environment stores the variables created while evaluating an OCL expression, including self. It also maintains the package, if the OCL package statement is used.
This interface is not intended to be implemented by clients "directly".
It is highly recommended to extend the EcoreEnvironment
class,
instead.
EcoreEnvironment
,
EnvironmentFactory
Field Summary | |
---|---|
static java.lang.String |
ANNOTATION_URI_BODY
Source URI of the annotation for the body expression of an operation. |
static java.lang.String |
ANNOTATION_URI_DEFINE
Source URI of the annotation for the expression defining an additional property or operation. |
static java.lang.String |
ANNOTATION_URI_DERIVE
Source URI of the annotation for the expression defining the derived value of a property. |
static java.lang.String |
ANNOTATION_URI_INIT
Source URI of the annotation for the expression defining the initial value of a property. |
Method Summary | |
---|---|
boolean |
addElement(java.lang.String name,
Variable elem,
boolean imp)
Adds a variable declaration to the environment. |
void |
deleteElement(java.lang.String name)
Removes a name when it goes out of scope. |
org.eclipse.emf.ecore.EClass |
getAssociationClass(org.eclipse.emf.ecore.EReference reference)
Obtains the association class that the specified reference represents, as an EClass , if any. |
org.eclipse.emf.ecore.EClassifier |
getContextClassifier()
Obtains the context classifier of this environment. |
org.eclipse.emf.ecore.EOperation |
getContextOperation()
Obtains the context operation of this environment, if it is an operation context. |
org.eclipse.emf.ecore.EStructuralFeature |
getContextProperty()
Obtains the context property of this environment, if it is a property context. |
java.lang.String |
getDescription(org.eclipse.emf.ecore.ENamedElement namedElement)
Obtains the user-presentable description of a named Ecore element. |
EnvironmentFactory |
getFactory()
Obtains the factory that created me, or an appropriate default factory if I was not created using a factory. |
org.eclipse.emf.common.util.EList |
getMemberEnds(org.eclipse.emf.ecore.EClass associationClass)
Obtains the ends of the specified association class as a list of EReference s. |
Environment |
getParent()
get the parent environment |
org.eclipse.emf.common.util.EList |
getQualifiers(org.eclipse.emf.ecore.EStructuralFeature property)
Gets the qualifiers of a property representing a UML association end. |
Variable |
getSelfVariable()
Gets the self variable, looking it up in a parent environment if necessary. |
org.eclipse.emf.common.util.EList |
getSignals(org.eclipse.emf.ecore.EClassifier owner)
Retrieves a list of all signal receptions defined by the specified owner classifier. |
java.lang.String |
getStateName(org.eclipse.emf.ecore.EObject state)
Obtains the simple name of the specified state (not the qualified name path). |
org.eclipse.emf.common.util.EList |
getStates(org.eclipse.emf.ecore.EClassifier owner,
java.util.List pathPrefix)
Retrieves a list of all possible states of the specified owner
whose paths are prefixed by the specified partial name. |
java.util.Collection |
getVariables()
Returns the Variable s registered in me explicitly. |
boolean |
isAssociationClass(org.eclipse.emf.ecore.EClass eclass)
Determines whether the specified eclass is an association
class. |
boolean |
isEmpty()
Is the environment empty? |
boolean |
isQuery(org.eclipse.emf.ecore.EOperation operation)
Determines whether the specified operation is a query
operation. |
Variable |
lookup(java.lang.String name)
returns the VariableDeclaration for a variable Looks in parent environment scope if not found in current scope. |
org.eclipse.emf.ecore.EClass |
lookupAssociationClassReference(org.eclipse.emf.ecore.EClassifier parent,
java.lang.String name)
Find reference in the specified class to the named association class. |
Variable |
lookupImplicitSourceForAssociationClass(java.lang.String name)
Return the variable declaration in namedElements which references the named association class. |
Variable |
lookupImplicitSourceForOperation(java.lang.String name,
org.eclipse.emf.common.util.EList params)
Return the Variable declaration in namedElements which contains the name as an EOperation. |
Variable |
lookupImplicitSourceForProperty(java.lang.String name)
Return the most appropriate matching variable to use as the implicit source of a call to the specified property. |
Variable |
lookupLocal(java.lang.String name)
Returns the VariableDeclaration for a variable name. |
org.eclipse.emf.ecore.EOperation |
lookupOperation(org.eclipse.emf.ecore.EClassifier owner,
java.lang.String name,
org.eclipse.emf.common.util.EList args)
Find the operation in the specified class. |
org.eclipse.emf.ecore.EPackage |
lookupPackage(java.util.List names)
Finds the EPackage corresponding to the path: name::... |
org.eclipse.emf.ecore.EClassifier |
lookupPathName(java.util.List names)
Finds the EClassifier corresponding to the path: name::... |
org.eclipse.emf.ecore.EStructuralFeature |
lookupProperty(org.eclipse.emf.ecore.EClassifier parent,
java.lang.String name)
Find a property defined or inherited by the specified classifier. |
org.eclipse.emf.ecore.EClass |
lookupSignal(org.eclipse.emf.ecore.EClassifier owner,
java.lang.String name,
org.eclipse.emf.common.util.EList args)
Find a received signal in the specified classifier. |
void |
setParent(Environment env)
Set the parent environment |
void |
setSelfVariable(Variable var)
Sets the "self" variable that is the implicit source of any attribute, association end, or operation call. |
Field Detail |
public static final java.lang.String ANNOTATION_URI_DEFINE
public static final java.lang.String ANNOTATION_URI_INIT
public static final java.lang.String ANNOTATION_URI_DERIVE
public static final java.lang.String ANNOTATION_URI_BODY
Method Detail |
public EnvironmentFactory getFactory()
EnvironmentFactory.createEnvironment(Environment)
public void setParent(Environment env)
env
- public Environment getParent()
public org.eclipse.emf.ecore.EClassifier getContextClassifier()
public org.eclipse.emf.ecore.EOperation getContextOperation()
null
if this is not an
operation environmentpublic org.eclipse.emf.ecore.EStructuralFeature getContextProperty()
null
if this is not a
property environmentpublic boolean isEmpty()
public Variable lookupLocal(java.lang.String name)
name
-
public Variable lookup(java.lang.String name)
name
-
public org.eclipse.emf.ecore.EPackage lookupPackage(java.util.List names)
null
.
names
- the path name
null
if not foundpublic org.eclipse.emf.ecore.EClassifier lookupPathName(java.util.List names)
names
-
public org.eclipse.emf.ecore.EOperation lookupOperation(org.eclipse.emf.ecore.EClassifier owner, java.lang.String name, org.eclipse.emf.common.util.EList args)
owner
- the owner type of the called operationname
- the name of the called operationargs
- the arguments (as OCLExpression
s) passed to the operation
null
if not foundpublic org.eclipse.emf.ecore.EStructuralFeature lookupProperty(org.eclipse.emf.ecore.EClassifier parent, java.lang.String name)
name
- the property name
null
if it could not be foundpublic org.eclipse.emf.ecore.EClass lookupAssociationClassReference(org.eclipse.emf.ecore.EClassifier parent, java.lang.String name)
parent
- the referencing class to searchname
- the association class name (with an initial lower case as
per the OCL convention)
null
if the specified
parent
classifier does not have any references
implemented by the named association classpublic org.eclipse.emf.common.util.EList getStates(org.eclipse.emf.ecore.EClassifier owner, java.util.List pathPrefix)
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.
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 java.lang.String getStateName(org.eclipse.emf.ecore.EObject state)
state
- representation of a UML state
public org.eclipse.emf.ecore.EClass lookupSignal(org.eclipse.emf.ecore.EClassifier owner, java.lang.String name, org.eclipse.emf.common.util.EList args)
owner
- the owner type of the signal receptionname
- the name of the signalargs
- the arguments (as OCLExpression
s) passed in the signal
null
if not foundpublic org.eclipse.emf.common.util.EList getSignals(org.eclipse.emf.ecore.EClassifier owner)
owner
classifier. This must include also signals
defined by supertypes of the owner.
owner
- the owner type of the signal receptions
EClass
es), or an empty list if nonepublic boolean isQuery(org.eclipse.emf.ecore.EOperation operation)
operation
is a query
operation.
operation
- an operation
public org.eclipse.emf.common.util.EList getQualifiers(org.eclipse.emf.ecore.EStructuralFeature property)
property
- a property of the model class
EStructuralFeature
s, or an
empty list if the property has no qualifierspublic boolean isAssociationClass(org.eclipse.emf.ecore.EClass eclass)
eclass
is an association
class.
eclass
- an Ecore class
public org.eclipse.emf.ecore.EClass getAssociationClass(org.eclipse.emf.ecore.EReference reference)
EClass
, if any. This gets the "class" aspect of the
association class, for which the reference represents the "association"
aspect.
reference
- a reference
null
if the reference
does not represent an association classpublic org.eclipse.emf.common.util.EList getMemberEnds(org.eclipse.emf.ecore.EClass associationClass)
EReference
s.
associationClass
- an EClass representing an association class
EReference
s representing its member ends (the
association roles)public boolean addElement(java.lang.String name, Variable elem, boolean imp)
name
- elem
- -- variable declarationimp
- -- is the variable implicit?
public void deleteElement(java.lang.String name)
name
- public java.util.Collection getVariables()
Variable
s registered in me explicitly.
public void setSelfVariable(Variable var)
var
- the "self" variablepublic Variable getSelfVariable()
null
if none (which should not
happen as there is always some classifier context)public Variable lookupImplicitSourceForProperty(java.lang.String name)
name
- the property name
public Variable lookupImplicitSourceForAssociationClass(java.lang.String name)
name
- the association class name to seek
null
if none
is foundpublic Variable lookupImplicitSourceForOperation(java.lang.String name, org.eclipse.emf.common.util.EList params) throws SemanticException
name
-
SemanticException
public java.lang.String getDescription(org.eclipse.emf.ecore.ENamedElement namedElement)
ETypedElement
(the user model name)
or the localized metaclass name of the underlying adapted element
in the case of an EClassifier
.
namedElement
- a named element obtained by adaptation of a user
model element
|
Copyright 2002, 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |