## org.eclipse.emf.ocl.parser
Interface Environment

All Known Subinterfaces:
  PersistentEnvironment

All Known Implementing Classes:
  EcoreEnvironment, ReverseCompatibilityEnvironment

Deprecated. Use the `Environment` interface, instead.

    @Deprecated
    public interface Environment

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.

See Also:
  `EcoreEnvironment`, `EnvironmentFactory`

Field Summary
`static String` `ANNOTATION_URI_BODY` Deprecated. Source URI of the annotation for the body expression of an operation.
`static String` `ANNOTATION_URI_DEFINE` Deprecated. Source URI of the annotation for the expression defining an additional property or operation.
`static String` `ANNOTATION_URI_DERIVE` Deprecated. Source URI of the annotation for the expression defining the derived value of a property.
`static String` `ANNOTATION_URI_INIT` Deprecated. Source URI of the annotation for the expression defining the initial value of a property.

Method Summary
`boolean` `addElement(String name, Variable elem, boolean exp)` Deprecated. Adds a variable declaration to the environment.
`void` `deleteElement(String name)` Deprecated. Removes a name when it goes out of scope.
`EClass` `getAssociationClass(EReference reference)` Deprecated. Obtains the association class that the specified reference represents, as an `EClass`, if any.
`EClassifier` `getContextClassifier()` Deprecated. Obtains the context classifier of this environment.
`EOperation` `getContextOperation()` Deprecated. Obtains the context operation of this environment, if it is an operation context.
`EStructuralFeature` `getContextProperty()` Deprecated. Obtains the context property of this environment, if it is a property context.
`String` `getDescription(ENamedElement namedElement)` Deprecated. Obtains the user-presentable description of a named Ecore element.
`EnvironmentFactory` `getFactory()` Deprecated. Obtains the factory that created me, or an appropriate default factory if I was not created using a factory.
`EList` `getMemberEnds(EClass associationClass)` Deprecated. Obtains the ends of the specified association class as a list of `EReference`s.
`Environment` `getParent()` Deprecated. get the parent environment
`EList` `getQualifiers(EStructuralFeature property)` Deprecated. Gets the qualifiers of a property representing a UML association end.
`Variable` `getSelfVariable()` Deprecated. Gets the self variable, looking it up in a parent environment if necessary.
`EList` `getSignals(EClassifier owner)` Deprecated. Retrieves a list of all signal receptions defined by the specified `owner` classifier.
`String` `getStateName(EObject state)` Deprecated. Obtains the simple name of the specified state (not the qualified name path).
`EList` `getStates(EClassifier owner, List pathPrefix)` Deprecated. Retrieves a list of all possible states of the specified `owner` whose paths are prefixed by the specified partial name.
`Collection` `getVariables()` Deprecated. Returns the `Variable`s registered in me explicitly.
`boolean` `isAssociationClass(EClass eclass)` Deprecated. Determines whether the specified `eclass` is an association class.
`boolean` `isEmpty()` Deprecated. Is the environment empty?
`boolean` `isQuery(EOperation operation)` Deprecated. Determines whether the specified `operation` is a query operation.
`Variable` `lookup(String name)` Deprecated. returns the VariableDeclaration for a variable Looks in parent environment scope if not found in current scope.
`EClass` `lookupAssociationClassReference(EClassifier parent, String name)` Deprecated. Find reference in the specified class to the named association class.
`Variable` `lookupImplicitSourceForAssociationClass(String name)` Deprecated. Return the variable declaration in namedElements which references the named association class.
`Variable` `lookupImplicitSourceForOperation(String name, EList params)` Deprecated. Return the Variable declaration in namedElements which contains the name as an EOperation.
`Variable` `lookupImplicitSourceForProperty(String name)` Deprecated. Return the most appropriate matching variable to use as the implicit source of a call to the specified property.
`Variable` `lookupLocal(String name)` Deprecated. Returns the VariableDeclaration for a variable name.
`EOperation` `lookupOperation(EClassifier owner, String name, EList args)` Deprecated. Find the operation in the specified class.
`EPackage` `lookupPackage(List names)` Deprecated. Finds the EPackage corresponding to the path: name::...
`EClassifier` `lookupPathName(List names)` Deprecated. Finds the EClassifier corresponding to the path: name::...
`EStructuralFeature` `lookupProperty(EClassifier owner, String name)` Deprecated. Find a property defined or inherited by the specified classifier.
`EClass` `lookupSignal(EClassifier owner, String name, EList args)` Deprecated. Find a received signal in the specified classifier.
`void` `setParent(Environment env)` Deprecated. Set the parent environment
`void` `setSelfVariable(Variable var)` Deprecated. Sets the "self" variable that is the implicit source of any attribute, association end, or operation call.

Field Detail

### ANNOTATION_URI_DEFINE

    static final String ANNOTATION_URI_DEFINE

  Deprecated.
  Source URI of the annotation for the expression defining an additional property or operation.

  See Also:
    Constant Field Values

### ANNOTATION_URI_INIT

    static final String ANNOTATION_URI_INIT

  Deprecated.
  Source URI of the annotation for the expression defining the initial value of a property.

  See Also:
    Constant Field Values

### ANNOTATION_URI_DERIVE

    static final String ANNOTATION_URI_DERIVE

  Deprecated.
  Source URI of the annotation for the expression defining the derived value of a property.

  See Also:
    Constant Field Values

### ANNOTATION_URI_BODY

    static final String ANNOTATION_URI_BODY

  Deprecated.
  Source URI of the annotation for the body expression of an operation.

  See Also:
    Constant Field Values

Method Detail

### getFactory

    EnvironmentFactory getFactory()

  Deprecated.
  Obtains the factory that created me, or an appropriate default factory if I was not created using a factory. This factory can be used to create nested environments within me.

  Returns:
    my originating factory
  See Also:
    `EnvironmentFactory.createEnvironment(Environment)`

### setParent

    void setParent(Environment env)

  Deprecated.
  Set the parent environment

  Parameters:
    `env` -

### getParent

    Environment getParent()

  Deprecated.
  get the parent environment

  Returns:
    Environment

### getContextClassifier

    EClassifier getContextClassifier()

  Deprecated.
  Obtains the context classifier of this environment.

  Returns:
    the context classifier

### getContextOperation

    EOperation getContextOperation()

  Deprecated.
  Obtains the context operation of this environment, if it is an operation context.

  Returns:
    the context operation, or `null` if this is not an operation environment

### getContextProperty

    EStructuralFeature getContextProperty()

  Deprecated.
  Obtains the context property of this environment, if it is a property context.

  Returns:
    the context property, or `null` if this is not a property environment

### isEmpty

    boolean isEmpty()

  Deprecated.
  Is the environment empty?

  Returns:
    boolean

### lookupLocal

    Variable lookupLocal(String name)

  Deprecated.
  Returns the VariableDeclaration for a variable name. Does not look in parent environment scopes.

  Parameters:
    `name` -
  Returns:
    VariableDeclaration

### lookup

    Variable lookup(String name)

  Deprecated.
  returns the VariableDeclaration for a variable Looks in parent environment scope if not found in current scope.

  Parameters:
    `name` -
  Returns:
    VariableDeclaration

### lookupPackage

    EPackage lookupPackage(List names)

  Deprecated.
  Finds the EPackage corresponding to the path: name::...::name If no EPackage is found, return `null`.

  Parameters:
    `names` - the path name
  Returns:
    the package, or `null` if not found

### lookupPathName

    EClassifier lookupPathName(List names)

  Deprecated.
  Finds the EClassifier corresponding to the path: name::...::name If no EClassifier is found, return null.

  Parameters:
    `names` -
  Returns:
    EClassifier

### lookupOperation

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

  Deprecated.
  Find the operation in the specified class.

  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

### lookupProperty

    EStructuralFeature lookupProperty(EClassifier owner,
                                      String name)

  Deprecated.
  Find a property defined or inherited by the specified classifier.

  Parameters:
    `owner` - 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

### lookupAssociationClassReference

    EClass lookupAssociationClassReference(EClassifier parent,
                                           String name)

  Deprecated.
  Find reference in the specified class to the named association class.

  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

### getStates

    EList getStates(EClassifier owner,
                    List pathPrefix)

  Deprecated.
  Retrieves a list of all possible states of the specified `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.

  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)

### getStateName

    String getStateName(EObject state)

  Deprecated.
  Obtains the simple name of the specified state (not the qualified name path).

  Parameters:
    `state` - representation of a UML state
  Returns:
    its simple name

### lookupSignal

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

  Deprecated.
  Find a received signal in the specified classifier.

  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

### getSignals

    EList getSignals(EClassifier owner)

  Deprecated.
  Retrieves a list of all signal receptions defined by the specified `owner` classifier. This must include also signals defined by supertypes of the owner.

  Parameters:
    `owner` - the owner type of the signal receptions
  Returns:
    the available signals (as `EClass`es), or an empty list if none

### isQuery

    boolean isQuery(EOperation operation)

  Deprecated.
  Determines whether the specified `operation` is a query operation.

  Parameters:
    `operation` - an operation
  Returns:
    whether it is a query operation

### getQualifiers

    EList getQualifiers(EStructuralFeature property)

  Deprecated.
  Gets the qualifiers of a property representing a UML association end.

  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

### isAssociationClass

    boolean isAssociationClass(EClass eclass)

  Deprecated.
  Determines whether the specified `eclass` is an association class.

  Parameters:
    `eclass` - an Ecore class
  Returns:
    whether it is an association class

### getAssociationClass

    EClass getAssociationClass(EReference reference)

  Deprecated.
  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.

  Parameters:
    `reference` - a reference
  Returns:
    the association class, or `null` if the reference does not represent an association class

### getMemberEnds

    EList getMemberEnds(EClass associationClass)

  Deprecated.
  Obtains the ends of the specified association class as a list of `EReference`s.

  Parameters:
    `associationClass` - an EClass representing an association class
  Returns:
    the `EReference`s representing its member ends (the association roles)

### addElement

    boolean addElement(String name,
                       Variable elem,
                       boolean exp)

  Deprecated.
  Adds a variable declaration to the environment. If the name is null, then a new unique temporary name is generated.

  Parameters:
    `name` -
    `elem` - -- variable declaration
    `exp` - -- is the variable explicit?
  Returns:
    - boolean

### deleteElement

    void deleteElement(String name)

  Deprecated.
  Removes a name when it goes out of scope.

  Parameters:
    `name` -

### getVariables

    Collection getVariables()

  Deprecated.
  Returns the `Variable`s registered in me explicitly.

  Returns:
    my variable declarations

### setSelfVariable

    void setSelfVariable(Variable var)

  Deprecated.
  Sets the "self" variable that is the implicit source of any attribute, association end, or operation call.

  Parameters:
    `var` - the "self" variable

### getSelfVariable

    Variable getSelfVariable()

  Deprecated.
  Gets the self variable, looking it up in a parent environment if necessary.

  Returns:
    the self variable, or `null` if none (which should not happen as there is always some classifier context)

### lookupImplicitSourceForProperty

    Variable lookupImplicitSourceForProperty(String name)

  Deprecated.
  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.

  Parameters:
    `name` - the property name
  Returns:
    the matching variable

### lookupImplicitSourceForAssociationClass

    Variable lookupImplicitSourceForAssociationClass(String name)

  Deprecated.
  Return the variable declaration in namedElements which references the named association class. Variables are returned based on inner-most scope first.

  Parameters:
    `name` - the association class name to seek
  Returns:
    the matching variable declaration, or `null` if none is found

### lookupImplicitSourceForOperation

    Variable lookupImplicitSourceForOperation(String name,
                                              EList params)
                                              throws SemanticException

  Deprecated.
  Return the Variable declaration in namedElements which contains the name as an EOperation. Variables are returned based on inner-most scope first.

  Parameters:
    `name` -
  Returns:
    the matching variable declaration
  Throws:
    `SemanticException`

### getDescription

    String getDescription(ENamedElement namedElement)

  Deprecated.
  Obtains the user-presentable description of a named Ecore element. For example, this might be the type name of an `ETypedElement` (the user model name) or the localized metaclass name of the underlying adapted element in the case of an `EClassifier`.

  Parameters:
    `namedElement` - a named element obtained by adaptation of a user model element
  Returns:
    the named element's description

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