## org.eclipse.emf.ocl.internal.parser
Class ReverseCompatibilityEnvironment

    java.lang.Object
      org.eclipse.emf.ocl.parser.EcoreEnvironment
          org.eclipse.emf.ocl.internal.parser.ReverseCompatibilityEnvironment

All Implemented Interfaces:
  Environment, PersistentEnvironment

    public class ReverseCompatibilityEnvironment

extends EcoreEnvironment

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

### addElement

    public boolean addElement(String name,
                              Variable elem,
                              boolean imp)

  Description copied from class: `EcoreEnvironment`
  Adds a variable declaration to the environment. If the name is null, then a new unique temporary name is generated.

  Specified by:
    `addElement` in interface `Environment`
  Overrides:
    `addElement` in class `EcoreEnvironment`
    `elem` - -- variable declaration
    `imp` - -- is the variable implicit?
  Returns:
    - boolean

### deleteElement

    public void deleteElement(String name)

  Description copied from class: `EcoreEnvironment`
  Removes a name when it goes out of scope.

  Specified by:
    `deleteElement` in interface `Environment`
  Overrides:
    `deleteElement` in class `EcoreEnvironment`

### getAssociationClass

    public EClass getAssociationClass(EReference reference)

  Description copied from class: `EcoreEnvironment`
  Obtains the association class that the specified reference represents, as an `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.

  Specified by:
    `getAssociationClass` in interface `Environment`
  Overrides:
    `getAssociationClass` in class `EcoreEnvironment`
  Parameters:
    `reference` - a reference
  Returns:
    the association class, or `null` if the reference does not represent an association class

### getContextClassifier

    public EClassifier getContextClassifier()

  Description copied from interface: `Environment`
  Obtains the context classifier of this environment.

  Specified by:
    `getContextClassifier` in interface `Environment`
  Overrides:
    `getContextClassifier` in class `EcoreEnvironment`
  Returns:
    the context classifier

### getContextOperation

    public EOperation getContextOperation()

  Description copied from interface: `Environment`
  Obtains the context operation of this environment, if it is an operation context.

  Specified by:
    `getContextOperation` in interface `Environment`
  Overrides:
    `getContextOperation` in class `EcoreEnvironment`
  Returns:
    the context operation, or `null` if this is not an operation environment

### getContextProperty

    public EStructuralFeature getContextProperty()

  Description copied from interface: `Environment`
  Obtains the context property of this environment, if it is a property context.

  Specified by:
    `getContextProperty` in interface `Environment`
  Overrides:
    `getContextProperty` in class `EcoreEnvironment`
  Returns:
    the context property, or `null` if this is not a property environment

### getDescription

    public String getDescription(ENamedElement namedElement)

  Description copied from class: `EcoreEnvironment`
  Default implementation just gets the name of the named element's `eClass` or, if it is an `ETypedElement`, the name of its type.

  Specified by:
    `getDescription` in interface `Environment`
  Overrides:
    `getDescription` in class `EcoreEnvironment`
  Parameters:
    `namedElement` - a named element obtained by adaptation of a user model element
  Returns:
    the named element's description

### getMemberEnds

    public EList getMemberEnds(EClass associationClass)

  Description copied from class: `EcoreEnvironment`
  Obtains the ends of the specified association class as a list of `EReference`s. Note that an environment that correctly supports association classes would need to supply appropriately annotated `EClass`es.

  Specified by:
    `getMemberEnds` in interface `Environment`
  Overrides:
    `getMemberEnds` in class `EcoreEnvironment`
  Parameters:
    `associationClass` - an EClass representing an association class
  Returns:
    the `EReference`s representing its member ends (the association roles)

### getQualifiers

    public EList getQualifiers(EStructuralFeature property)

  Description copied from class: `EcoreEnvironment`
  Gets the qualifiers of an association end. Note that an environment that correctly supports association end qualifiers would need to supply appropriately annotated `EReference`s.

  Specified by:
    `getQualifiers` in interface `Environment`
  Overrides:
    `getQualifiers` in class `EcoreEnvironment`
  Parameters:
    `property` - a property of the model class
  Returns:
    the qualifiers (as a list of `EStructuralFeature`s, or an empty list if the property has no qualifiers

### getSelfVariable

    public Variable getSelfVariable()

  Description copied from interface: `Environment`
  Gets the self variable, looking it up in a parent environment if necessary.

  Specified by:
    `getSelfVariable` in interface `Environment`
  Overrides:
    `getSelfVariable` in class `EcoreEnvironment`
  Returns:
    the self variable, or `null` if none (which should not happen as there is always some classifier context)

### getSignals

    public EList getSignals(EClassifier owner)

  Description copied from class: `EcoreEnvironment`
  By default, return an empty list because Ecore does not support the modeling of signals.

  Specified by:
    `getSignals` in interface `Environment`
  Overrides:
    `getSignals` in class `EcoreEnvironment`
  Parameters:
    `owner` - the owner type of the signal receptions
  Returns:
    the available signals (as `EClass`es), or an empty list if none

### getStateName

    public String getStateName(EObject state)

  Description copied from class: `EcoreEnvironment`
  Ecore does not model states, so this method returns null. Environments that support UML states must override this implementation.

  Specified by:
    `getStateName` in interface `Environment`
  Overrides:
    `getStateName` in class `EcoreEnvironment`
  Parameters:
    `state` - representation of a UML state
  Returns:
    its simple name

### getStates

    public EList getStates(EClassifier owner,
                           List pathPrefix)

  Description copied from class: `EcoreEnvironment`
  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. 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.

  Specified by:
    `getStates` in interface `Environment`
  Overrides:
    `getStates` in class `EcoreEnvironment`
  Parameters:
    `owner` - the classifier for which states are being sought. Can be `null` in the case of an oclIsInState() call on an implicit target
    `pathPrefix` - partial path name of the states being sought. This can be empty to find the first level of state names
  Returns:
    the list of all possible states directly contained in the namespace indicated by the path prefix (i.e., only one level of state nesting)

### getVariables

    public Collection getVariables()

  Description copied from interface: `Environment`
  Returns the `Variable`s registered in me explicitly.

  Specified by:
    `getVariables` in interface `Environment`
  Overrides:
    `getVariables` in class `EcoreEnvironment`
  Returns:
    my variable declarations

### isAssociationClass

    public boolean isAssociationClass(EClass eclass)

  Description copied from class: `EcoreEnvironment`
  Determines whether the specified `eclass` is an association class. Note that an environment that correctly supports association classes would need to supply appropriately annotated `EClass`es.

  Specified by:
    `isAssociationClass` in interface `Environment`
  Overrides:
    `isAssociationClass` in class `EcoreEnvironment`
  Parameters:
    `eclass` - an Ecore class
  Returns:
    whether it is an association class

### isEmpty

    public boolean isEmpty()

  Description copied from class: `EcoreEnvironment`
  Is the environment empty?

  Specified by:
    `isEmpty` in interface `Environment`
  Overrides:
    `isEmpty` in class `EcoreEnvironment`
  Returns:
    boolean

### isQuery

    public boolean isQuery(EOperation operation)

  Description copied from class: `EcoreEnvironment`
  Determines whether the specified `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.

  Specified by:
    `isQuery` in interface `Environment`
  Overrides:
    `isQuery` in class `EcoreEnvironment`
  Parameters:
    `operation` - an operation
  Returns:
    whether it is a query operation. An `EOperation` that is not annotated is considered to be a query by default

### lookup

    public Variable lookup(String name)

  Description copied from class: `EcoreEnvironment`
  returns the VariableDeclaration for a variable Looks in parent environment scope if not found in current scope.

  Specified by:
    `lookup` in interface `Environment`
  Overrides:
    `lookup` in class `EcoreEnvironment`
  Returns:
    VariableDeclaration

### lookupAssociationClassReference

    public EClass lookupAssociationClassReference(EClassifier parent,
                                                  String name)

  Description copied from interface: `Environment`
  Find reference in the specified class to the named association class.

  Specified by:
    `lookupAssociationClassReference` in interface `Environment`
  Overrides:
    `lookupAssociationClassReference` in class `EcoreEnvironment`
  Parameters:
    `parent` - the referencing class to search
    `name` - the association class name (with an initial lower case as per the OCL convention)
  Returns:
    the association class, or `null` if the specified `parent` classifier does not have any references implemented by the named association class

### lookupImplicitSourceForAssociationClass

    public Variable lookupImplicitSourceForAssociationClass(String name)

  Description copied from interface: `Environment`
  Return the variable declaration in namedElements which references the named association class. Variables are returned based on inner-most scope first.

  Specified by:
    `lookupImplicitSourceForAssociationClass` in interface `Environment`
  Overrides:
    `lookupImplicitSourceForAssociationClass` in class `EcoreEnvironment`
  Parameters:
    `name` - the association class name to seek
  Returns:
    the matching variable declaration, or `null` if none is found

### lookupImplicitSourceForOperation

    public Variable lookupImplicitSourceForOperation(String name,
                                                     EList params)
                                              throws SemanticException

  Description copied from interface: `Environment`
  Return the Variable declaration in namedElements which contains the name as an EOperation. Variables are returned based on inner-most scope first.

  Specified by:
    `lookupImplicitSourceForOperation` in interface `Environment`
  Overrides:
    `lookupImplicitSourceForOperation` in class `EcoreEnvironment`
  Returns:
    the matching variable declaration
  Throws:
    `SemanticException`

### lookupImplicitSourceForProperty

    public Variable lookupImplicitSourceForProperty(String name)

  Description copied from interface: `Environment`
  Return the most appropriate matching variable to use as the implicit source of a call to the specified property. Variables are returned based on inner-most scope first.

  Specified by:
    `lookupImplicitSourceForProperty` in interface `Environment`
  Overrides:
    `lookupImplicitSourceForProperty` in class `EcoreEnvironment`
  Parameters:
    `name` - the property name
  Returns:
    the matching variable

### lookupLocal

    public Variable lookupLocal(String name)

  Description copied from class: `EcoreEnvironment`
  Returns the VariableDeclaration for a variable name. Does not look in parent environment scopes.

  Specified by:
    `lookupLocal` in interface `Environment`
  Overrides:
    `lookupLocal` in class `EcoreEnvironment`
  Returns:
    VariableDeclaration

### lookupOperation

    public EOperation lookupOperation(EClassifier owner,
                                      String name,
                                      EList args)

  Description copied from interface: `Environment`
  Find the operation in the specified class.

  Specified by:
    `lookupOperation` in interface `Environment`
  Overrides:
    `lookupOperation` in class `EcoreEnvironment`
  Parameters:
    `owner` - the owner type of the called operation
    `name` - the name of the called operation
    `args` - the arguments (as `OCLExpression`s) passed to the operation
  Returns:
    the matching operation, or `null` if not found

### lookupPackage

    public EPackage lookupPackage(List names)

  Description copied from interface: `Environment`
  Finds the EPackage corresponding to the path: name::...::name If no EPackage is found, return `null`.

  Specified by:
    `lookupPackage` in interface `Environment`
  Overrides:
    `lookupPackage` in class `EcoreEnvironment`
  Parameters:
    `names` - the path name
  Returns:
    the package, or `null` if not found

### lookupPathName

    public EClassifier lookupPathName(List names)

  Description copied from class: `EcoreEnvironment`
  Finds the EClassifier corresponding to the path: name::...::name If no EClassifier is found, return null.

  Specified by:
    `lookupPathName` in interface `Environment`
  Overrides:
    `lookupPathName` in class `EcoreEnvironment`
  Returns:
    EClassifier

### lookupProperty

    public EStructuralFeature lookupProperty(EClassifier parent,
                                             String name)

  Description copied from interface: `Environment`
  Find a property defined or inherited by the specified classifier.

  Specified by:
    `lookupProperty` in interface `Environment`
  Overrides:
    `lookupProperty` in class `EcoreEnvironment`
  Parameters:
    `parent` - the owner of the property that we are looking for, or `null` to find an implicit owner type
    `name` - the property name
  Returns:
    the property, or `null` if it could not be found

### lookupSignal

    public EClass lookupSignal(EClassifier owner,
                               String name,
                               EList args)

  Description copied from interface: `Environment`
  Find a received signal in the specified classifier.

  Specified by:
    `lookupSignal` in interface `Environment`
  Overrides:
    `lookupSignal` in class `EcoreEnvironment`
  Parameters:
    `owner` - the owner type of the signal reception
    `name` - the name of the signal
    `args` - the arguments (as `OCLExpression`s) passed in the signal
  Returns:
    the matching signal, or `null` if not found

### setSelfVariable

    public void setSelfVariable(Variable var)

  Description copied from interface: `Environment`
  Sets the "self" variable that is the implicit source of any attribute, association end, or operation call.

  Specified by:
    `setSelfVariable` in interface `Environment`
  Overrides:
    `setSelfVariable` in class `EcoreEnvironment`
  Parameters:
    `var` - the "self" variable

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.