## org.eclipse.emf.ocl.query.impl
Class QueryImpl

    java.lang.Object
      org.eclipse.emf.common.notify.impl.BasicNotifierImpl
          org.eclipse.emf.ecore.impl.BasicEObjectImpl
              org.eclipse.emf.ecore.impl.EObjectImpl
                  org.eclipse.emf.ocl.query.impl.QueryImpl

All Implemented Interfaces:
  Notifier, EObject, InternalEObject, Query

    public class QueryImpl

extends EObjectImpl
implements Query

An implementation of the model object 'Query'.

The following features are implemented:

- `Extent Map`
- `Expression`

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
`BasicEObjectImpl.EPropertiesHolder, BasicEObjectImpl.EPropertiesHolderBaseImpl, BasicEObjectImpl.EPropertiesHolderImpl`

Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
`BasicNotifierImpl.EAdapterList<E extends Object & Adapter>`

Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
`InternalEObject.EStore`

Field Summary
`static String` `copyright`
`protected OCLExpression` `expression` The cached value of the '`Expression`' reference
`protected static Map` `EXTENT_MAP_EDEFAULT` The default value of the '`Extent Map`' attribute
`protected Map` `extentMap` The cached value of the '`Extent Map`' attribute

Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
`eAdapters, eContainer, eContainerFeatureID, EDELIVER, EDYNAMIC_CLASS, eFlags, ELAST_EOBJECT_FLAG, ELAST_NOTIFIER_FLAG, eProperties, EPROXY`

Fields inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
`EVIRTUAL_GET, EVIRTUAL_IS_SET, EVIRTUAL_NO_VALUE, EVIRTUAL_SET, EVIRTUAL_UNSET`

Fields inherited from interface org.eclipse.emf.ecore.InternalEObject
`EOPPOSITE_FEATURE_BASE`

Constructor Summary
`protected` `QueryImpl()`
`protected` `QueryImpl(OCLExpression expr)` Creates a query from an `OCLExpression` (constraint or query).
`protected` `QueryImpl(String qs)` Parses and validates the query according to the well-formedness rules.

Method Summary
`OCLExpression` `basicGetExpression()`
`boolean` `check(List objList)` Determines whether all of the input objects satisfy the query.
`boolean` `check(Object obj)` Evaluates the query on an object.
`Object` `eGet(int featureID, boolean resolve, boolean coreType)`
`boolean` `eIsSet(int featureID)`
`void` `eSet(int featureID, Object newValue)`
`protected EClass` `eStaticClass()`
`void` `eUnset(int featureID)`
`Object` `evaluate()` Evaluates the query.
`List` `evaluate(List objList)` Evaluates the query on the input list.
`Object` `evaluate(Object obj)` Evaluates the query on the object.
`EvaluationEnvironment` `getEvaluationEnvironment()` Obtains the evaluation environment that I use to evaluate OCL expressions.
`OCLExpression` `getExpression()`
`Map` `getExtentMap()`
`String` `queryText()` Translates the query back to an OCL text string.
`List` `reject(List objList)` Determines the subset of input objects that do not satisfy the query.
`EClassifier` `resultType()` Obtains the OCL result type of the query.
`List` `select(List objList)` Determines the subset of input objects that satisfy the query.
`void` `setEvaluationEnvironment(EvaluationEnvironment env)` Sets the evaluation environment that I use to evaluate OCL expressions.
`void` `setExtentMap(Map newExtentMap)`
`String` `toString()`
`protected void` `validate()` Validates me according to the rules for OCL well-formedness.

Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
`eAdapters, eBasicAdapters, eBasicProperties, eBasicSetContainer, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eIsProxy, eProperties, eSetClass, eSetDeliver, eSetProxyURI`

Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

`eAddVirtualValue, eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eComputeVirtualValuesCapacity, eContainer, eContainingFeature, eContainmentFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicClass, eDynamicFeature, eDynamicFeatureID, eDynamicGet, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInverseRemove, eDynamicIsSet, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eHasSettings, eInternalResource, eInverseAdd, eInverseAdd, eInverseRemove, eInverseRemove, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eRemoveVirtualValue, eResolveProxy, eResource, eSet, eSetDirectResource, eSetResource, eSetStore, eSetting, eSettingDelegate, eSettings, eSetVirtualIndexBits, eSetVirtualValue, eSetVirtualValues, eStaticFeatureCount, eStore, eUnset, eURIFragmentSegment, eVirtualBitCount, eVirtualGet, eVirtualGet, eVirtualIndex, eVirtualIndexBits, eVirtualIsSet, eVirtualSet, eVirtualUnset, eVirtualValue, eVirtualValues`

Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
`eNotificationRequired, eNotify`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.eclipse.emf.ecore.EObject
`eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eIsProxy, eIsSet, eResource, eSet, eUnset`

Methods inherited from interface org.eclipse.emf.common.notify.Notifier
`eAdapters, eDeliver, eNotify, eSetDeliver`

Methods inherited from interface org.eclipse.emf.ecore.InternalEObject
`eNotificationRequired`

Field Detail

### copyright

    public static final String copyright

  See Also:
    Constant Field Values

### EXTENT_MAP_EDEFAULT

    protected static final Map EXTENT_MAP_EDEFAULT

  The default value of the '`Extent Map`' attribute.

  See Also:
    `getExtentMap()`

### extentMap

    protected Map extentMap

  The cached value of the '`Extent Map`' attribute.

  See Also:
    `getExtentMap()`

### expression

    protected OCLExpression expression

  The cached value of the '`Expression`' reference.

  See Also:
    `getExpression()`

Constructor Detail

### QueryImpl

    protected QueryImpl()

### QueryImpl

    protected QueryImpl(String qs)
                 throws ParserException

  Parses and validates the query according to the well-formedness rules. The query string must be of the form "context a::b::c inv: oclexpression" or, optionally, "package a::b context c inv: oclexpression endpackage".

  Parameters:
    `qs` - the query string
  Throws:
    `ParserException` - in case of a parser error

### QueryImpl

    protected QueryImpl(OCLExpression expr)
                 throws SemanticException

  Creates a query from an `OCLExpression` (constraint or query). The query is validated according to OCL well-formedness rules.

  Parameters:
    `expr` - the ocl expression
  Throws:
    `SemanticException` - in case of well-formedness problems

Method Detail

### eStaticClass

    protected EClass eStaticClass()

  Overrides:
    `eStaticClass` in class `EObjectImpl`

### getExtentMap

    public Map getExtentMap()

  Specified by:
    `getExtentMap` in interface `Query`
  Returns:
    the map of classifiers (`EClassifier`) to their extents (`List`)
  See Also:
    `Query.setExtentMap(Map)`

### setExtentMap

    public void setExtentMap(Map newExtentMap)

  Specified by:
    `setExtentMap` in interface `Query`
  Parameters:
    `newExtentMap` - a map of classifiers (`EClassifier`) to their extents (`List`)
  See Also:
    `Query.getExtentMap()`

### getExpression

    public OCLExpression getExpression()

  Specified by:
    `getExpression` in interface `Query`
  Returns:
    the value of the 'Expression' reference.
  See Also:
    `QueryPackage.getQuery_Expression()`

### basicGetExpression

    public OCLExpression basicGetExpression()

### evaluate

    public Object evaluate(Object obj)

  Description copied from interface: `Query`
  Evaluates the query on the object.

  Specified by:
    `evaluate` in interface `Query`
  Parameters:
    `obj` - an `Object`
  Returns:
    the result of the query, which may be one or more `EObject`s, Java objects, a mixture, or even `null`. In any case, the results conform to the expression's result type
  See Also:
    `Query.evaluate()`, `Query.evaluate(List)`, `Query.resultType()`

### evaluate

    public Object evaluate()

  Description copied from interface: `Query`
  Evaluates the query. This method is used when there is no 'self' context required by the query. Either the query is constant, or uses `allInstances()` exclusively for evaluation.

  Specified by:
    `evaluate` in interface `Query`
  Returns:
    the result of the query, which may be one or more `EObject`s, Java objects, a mixture, or even `null`. In any case, the results conform to the expression's result type
  See Also:
    `Query.resultType()`

### check

    public boolean check(Object obj)

  Description copied from interface: `Query`
  Evaluates the query on an object. The query must be a boolean valued constraint.

  Specified by:
    `check` in interface `Query`
  Parameters:
    `obj` - an `Object` or `null` if the query does not require an OCL 'self' context
  Returns:
    boolean `true` or `false` according to whether the constraint is met
  See Also:
    `Query.check(List)`

### evaluate

    public List evaluate(List objList)

  Description copied from interface: `Query`
  Evaluates the query on the input list. The results are returned in a corresponding list of results.

  Specified by:
    `evaluate` in interface `Query`
  Parameters:
    `objList` - a list of objects to evaluate the query on
  Returns:
    a list of results, corresponding one-for-one with the `objects`. Note that result elements may, themselves, be collections of multiple results for a single input object. In any case, the results conform to the expression's result type
  See Also:
    `Query.evaluate(Object)`, `Query.resultType()`

### check

    public boolean check(List objList)

  Description copied from interface: `Query`
  Determines whether all of the input objects satisfy the query. The query must be a boolean-valued constraint.

  Specified by:
    `check` in interface `Query`
  Parameters:
    `objList` - a list of objects to evaluate the constraint on
  Returns:
    `true` if all of the `objects` satisfy the constraint (including the trivial case of an empty input list); `false`, otherwise
  See Also:
    `Query.check(Object)`

### select

    public List select(List objList)

  Description copied from interface: `Query`
  Determines the subset of input objects that satisfy the query. The query must be a boolean valued constraint.

  Specified by:
    `select` in interface `Query`
  Parameters:
    `objList` - a list of objects to evaluate the constraint on
  Returns:
    the subset (possibly empty) of the `objects` that satisfy the constraint

### reject

    public List reject(List objList)

  Description copied from interface: `Query`
  Determines the subset of input objects that do not satisfy the query. The query must be a boolean valued constraint.

  Specified by:
    `reject` in interface `Query`
  Parameters:
    `objList` - a list of objects to evaluate the constraint on
  Returns:
    the subset (possibly empty) of the `objects` that do not satisfy the constraint

### resultType

    public EClassifier resultType()

  Description copied from interface: `Query`
  Obtains the OCL result type of the query. This may be an `EClassifier` in the user metamodel, or it may represent a core Java language type (such as `Boolean` in the case of constraints) or an OCL data type.

  Specified by:
    `resultType` in interface `Query`
  Returns:
    the query's result type

### queryText

    public String queryText()

  Description copied from interface: `Query`
  Translates the query back to an OCL text string.

  Specified by:
    `queryText` in interface `Query`
  Returns:
    the text of the OCL query expression

### eGet

    public Object eGet(int featureID,
                       boolean resolve,
                       boolean coreType)

  Specified by:
    `eGet` in interface `InternalEObject`
  Overrides:
    `eGet` in class `BasicEObjectImpl`

### eSet

    public void eSet(int featureID,
                     Object newValue)

  Specified by:
    `eSet` in interface `InternalEObject`
  Overrides:
    `eSet` in class `BasicEObjectImpl`

### eUnset

    public void eUnset(int featureID)

  Specified by:
    `eUnset` in interface `InternalEObject`
  Overrides:
    `eUnset` in class `BasicEObjectImpl`

### eIsSet

    public boolean eIsSet(int featureID)

  Specified by:
    `eIsSet` in interface `InternalEObject`
  Overrides:
    `eIsSet` in class `BasicEObjectImpl`

### validate

    protected void validate()

  Validates me according to the rules for OCL well-formedness.

### setEvaluationEnvironment

    public void setEvaluationEnvironment(EvaluationEnvironment env)

  Description copied from interface: `Query`
  Sets the evaluation environment that I use to evaluate OCL expressions.

  Specified by:
    `setEvaluationEnvironment` in interface `Query`
  Parameters:
    `env` - my environment

### getEvaluationEnvironment

    public EvaluationEnvironment getEvaluationEnvironment()

  Description copied from interface: `Query`
  Obtains the evaluation environment that I use to evaluate OCL expressions.

  Specified by:
    `getEvaluationEnvironment` in interface `Query`
  Returns:
    my environment

### toString

    public String toString()

  Overrides:
    `toString` in class `BasicEObjectImpl`

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