|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.ocl.parser.EcoreEnvironment
org.eclipse.emf.ocl.internal.parser.ReverseCompatibilityEnvironment
public class ReverseCompatibilityEnvironment
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.emf.ocl.parser.EcoreEnvironment |
---|
EcoreEnvironment.Access |
Field Summary |
---|
Fields inherited from interface org.eclipse.emf.ocl.parser.Environment |
---|
ANNOTATION_URI_BODY, ANNOTATION_URI_DEFINE, ANNOTATION_URI_DERIVE, ANNOTATION_URI_INIT |
Method Summary | |
---|---|
boolean |
addElement(String name,
Variable elem,
boolean imp)
Adds a variable declaration to the environment. |
void |
deleteElement(String name)
Removes a name when it goes out of scope. |
EClass |
getAssociationClass(EReference reference)
Obtains the association class that the specified reference represents, as an EClass , if any. |
EClassifier |
getContextClassifier()
Obtains the context classifier of this environment. |
EOperation |
getContextOperation()
Obtains the context operation of this environment, if it is an operation context. |
EStructuralFeature |
getContextProperty()
Obtains the context property of this environment, if it is a property context. |
String |
getDescription(ENamedElement namedElement)
Default implementation just gets the name of the named element's eClass or, if it is an
ETypedElement , the name of its type. |
EList |
getMemberEnds(EClass associationClass)
Obtains the ends of the specified association class as a list of EReference s. |
EList |
getQualifiers(EStructuralFeature property)
Gets the qualifiers of an association end. |
Variable |
getSelfVariable()
Gets the self variable, looking it up in a parent environment if necessary. |
EList |
getSignals(EClassifier owner)
By default, return an empty list because Ecore does not support the modeling of signals. |
String |
getStateName(EObject state)
Ecore does not model states, so this method returns null. |
EList |
getStates(EClassifier owner,
List pathPrefix)
Obtains the states matching the specified path prefix in the owner type by trying the EcoreEnvironment.collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List, java.util.List) method on it and, recursively, its
supertypes to find all matches. |
Collection |
getVariables()
Returns the Variable s registered in me explicitly. |
boolean |
isAssociationClass(EClass eclass)
Determines whether the specified eclass is an association
class. |
boolean |
isEmpty()
Is the environment empty? |
boolean |
isQuery(EOperation operation)
Determines whether the specified operation is a query
operation. |
Variable |
lookup(String name)
returns the VariableDeclaration for a variable Looks in parent environment scope if not found in current scope. |
EClass |
lookupAssociationClassReference(EClassifier parent,
String name)
Find reference in the specified class to the named association class. |
Variable |
lookupImplicitSourceForAssociationClass(String name)
Return the variable declaration in namedElements which references the named association class. |
Variable |
lookupImplicitSourceForOperation(String name,
EList params)
Return the Variable declaration in namedElements which contains the name as an EOperation. |
Variable |
lookupImplicitSourceForProperty(String name)
Return the most appropriate matching variable to use as the implicit source of a call to the specified property. |
Variable |
lookupLocal(String name)
Returns the VariableDeclaration for a variable name. |
EOperation |
lookupOperation(EClassifier owner,
String name,
EList args)
Find the operation in the specified class. |
EPackage |
lookupPackage(List names)
Finds the EPackage corresponding to the path: name::... |
EClassifier |
lookupPathName(List names)
Finds the EClassifier corresponding to the path: name::... |
EStructuralFeature |
lookupProperty(EClassifier parent,
String name)
Find a property defined or inherited by the specified classifier. |
EClass |
lookupSignal(EClassifier owner,
String name,
EList args)
Find a received signal in the specified classifier. |
void |
setSelfVariable(Variable var)
Sets the "self" variable that is the implicit source of any attribute, association end, or operation call. |
Methods inherited from class org.eclipse.emf.ocl.parser.EcoreEnvironment |
---|
collectStates, createTypeResolver, findPackage, findPackage, getFactory, getOCLCollectionType, getOCLType, getOCLType, getParent, getTypeResolver, initialLower, setContextOperation, setContextProperty, setFactory, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean addElement(String name, Variable elem, boolean imp)
EcoreEnvironment
addElement
in interface Environment
addElement
in class EcoreEnvironment
elem
- --
variable declarationimp
- --
is the variable implicit?
public void deleteElement(String name)
EcoreEnvironment
deleteElement
in interface Environment
deleteElement
in class EcoreEnvironment
public EClass getAssociationClass(EReference reference)
EcoreEnvironment
EClass
, if any. This gets the "class" aspect of the
association class, for which the reference represents the "association"
aspect. Note that an environment that correctly supports association
classes would need to supply appropriately annotated EReference
s.
getAssociationClass
in interface Environment
getAssociationClass
in class EcoreEnvironment
reference
- a reference
null
if the reference
does not represent an association classpublic EClassifier getContextClassifier()
Environment
getContextClassifier
in interface Environment
getContextClassifier
in class EcoreEnvironment
public EOperation getContextOperation()
Environment
getContextOperation
in interface Environment
getContextOperation
in class EcoreEnvironment
null
if this is not an
operation environmentpublic EStructuralFeature getContextProperty()
Environment
getContextProperty
in interface Environment
getContextProperty
in class EcoreEnvironment
null
if this is not a
property environmentpublic String getDescription(ENamedElement namedElement)
EcoreEnvironment
eClass
or, if it is an
ETypedElement
, the name of its type.
getDescription
in interface Environment
getDescription
in class EcoreEnvironment
namedElement
- a named element obtained by adaptation of a user
model element
public EList getMemberEnds(EClass associationClass)
EcoreEnvironment
EReference
s. Note that an environment that correctly supports
association classes would need to supply appropriately annotated
EClass
es.
getMemberEnds
in interface Environment
getMemberEnds
in class EcoreEnvironment
associationClass
- an EClass representing an association class
EReference
s representing its member ends (the
association roles)public EList getQualifiers(EStructuralFeature property)
EcoreEnvironment
EReference
s.
getQualifiers
in interface Environment
getQualifiers
in class EcoreEnvironment
property
- a property of the model class
EStructuralFeature
s, or an
empty list if the property has no qualifierspublic Variable getSelfVariable()
Environment
getSelfVariable
in interface Environment
getSelfVariable
in class EcoreEnvironment
null
if none (which should not
happen as there is always some classifier context)public EList getSignals(EClassifier owner)
EcoreEnvironment
getSignals
in interface Environment
getSignals
in class EcoreEnvironment
owner
- the owner type of the signal receptions
EClass
es), or an empty list if nonepublic String getStateName(EObject state)
EcoreEnvironment
getStateName
in interface Environment
getStateName
in class EcoreEnvironment
state
- representation of a UML state
public EList getStates(EClassifier owner, List pathPrefix)
EcoreEnvironment
EcoreEnvironment.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
EcoreEnvironment.collectStates(org.eclipse.emf.ecore.EClassifier, java.util.List, java.util.List)
method.
getStates
in interface Environment
getStates
in class EcoreEnvironment
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 Collection getVariables()
Environment
Variable
s registered in me explicitly.
getVariables
in interface Environment
getVariables
in class EcoreEnvironment
public boolean isAssociationClass(EClass eclass)
EcoreEnvironment
eclass
is an association
class. Note that an environment that correctly supports association
classes would need to supply appropriately annotated EClass
es.
isAssociationClass
in interface Environment
isAssociationClass
in class EcoreEnvironment
eclass
- an Ecore class
public boolean isEmpty()
EcoreEnvironment
isEmpty
in interface Environment
isEmpty
in class EcoreEnvironment
public boolean isQuery(EOperation operation)
EcoreEnvironment
operation
is a query
operation. Note that an environment that correctly supports query
operations would need to supply appropriately annotated
EOperation
s or otherwise override this method.
isQuery
in interface Environment
isQuery
in class EcoreEnvironment
operation
- an operation
EOperation
that
is not annotated is considered to be a query by defaultpublic Variable lookup(String name)
EcoreEnvironment
lookup
in interface Environment
lookup
in class EcoreEnvironment
public EClass lookupAssociationClassReference(EClassifier parent, String name)
Environment
lookupAssociationClassReference
in interface Environment
lookupAssociationClassReference
in class EcoreEnvironment
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 Variable lookupImplicitSourceForAssociationClass(String name)
Environment
lookupImplicitSourceForAssociationClass
in interface Environment
lookupImplicitSourceForAssociationClass
in class EcoreEnvironment
name
- the association class name to seek
null
if none
is foundpublic Variable lookupImplicitSourceForOperation(String name, EList params) throws SemanticException
Environment
lookupImplicitSourceForOperation
in interface Environment
lookupImplicitSourceForOperation
in class EcoreEnvironment
SemanticException
public Variable lookupImplicitSourceForProperty(String name)
Environment
lookupImplicitSourceForProperty
in interface Environment
lookupImplicitSourceForProperty
in class EcoreEnvironment
name
- the property name
public Variable lookupLocal(String name)
EcoreEnvironment
lookupLocal
in interface Environment
lookupLocal
in class EcoreEnvironment
public EOperation lookupOperation(EClassifier owner, String name, EList args)
Environment
lookupOperation
in interface Environment
lookupOperation
in class EcoreEnvironment
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 EPackage lookupPackage(List names)
Environment
null
.
lookupPackage
in interface Environment
lookupPackage
in class EcoreEnvironment
names
- the path name
null
if not foundpublic EClassifier lookupPathName(List names)
EcoreEnvironment
lookupPathName
in interface Environment
lookupPathName
in class EcoreEnvironment
public EStructuralFeature lookupProperty(EClassifier parent, String name)
Environment
lookupProperty
in interface Environment
lookupProperty
in class EcoreEnvironment
parent
- the owner of the property that we are looking for, or
null
to find an implicit owner typename
- the property name
null
if it could not be foundpublic EClass lookupSignal(EClassifier owner, String name, EList args)
Environment
lookupSignal
in interface Environment
lookupSignal
in class EcoreEnvironment
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 void setSelfVariable(Variable var)
Environment
setSelfVariable
in interface Environment
setSelfVariable
in class EcoreEnvironment
var
- the "self" variable
|
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 |