## org.eclipse.ocl.internal.evaluation
Class QueryImpl<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

    java.lang.Object
      org.eclipse.ocl.internal.evaluation.QueryImpl<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

All Implemented Interfaces:
  Query<C,CLS,E>, ProblemAware

    public class QueryImpl<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

extends Object
implements Query<C,CLS,E>, ProblemAware

An implementation of the model object 'Query'.

The following features are implemented:

- `Extent Map`
- `Expression`

Constructor Summary
`QueryImpl(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment, OCLExpression<C> expr, Map<CLS,? extends Set<? extends E>> extentMap)`

Method Summary
`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` `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<C,O,P,CLS,E>` `getEvaluationEnvironment()` Obtains the evaluation environment that I use to evaluate OCL expressions.
`OCLExpression<C>` `getExpression()` Obtains the expression that I evaluate (or check as a boolean constraint).
`Map<CLS,? extends Set<? extends E>>` `getExtentMap()` Obtains the mapping of classes to their extents (sets of all instances).
`Diagnostic` `getProblems()` Retrieves the problems available on this problem aware object
`String` `queryText()` Translates the query back to an OCL text string.

`

`<T> List<T>`

`

`reject(List<T> objList)`
Determines the subset of input objects that do not satisfy the query.

`C` `resultType()` Obtains the OCL result type of the query.

`

`<T> List<T>`

`

`select(List<T> objList)`
Determines the subset of input objects that satisfy the query.

`String` `toString()`

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

Constructor Detail

### QueryImpl

    public QueryImpl(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment,
                     OCLExpression<C> expr,
                     Map<CLS,? extends Set<? extends E>> extentMap)

Parameters:
  `environment` -
  `expr` -
  `extentMap` - may be `null`, in which case I will use my evaluation environment to create a dynamic extent map

Method Detail

### getExtentMap

    public Map<CLS,? extends Set<? extends E>> getExtentMap()

  Description copied from interface: `Query`
  Obtains the mapping of classes to their extents (sets of all instances).

  Specified by:
    `getExtentMap` in interface `Query<C,CLS,E>`
  Returns:
    the map of classes to their extents
  See Also:
    `OCL.setExtentMap(java.util.Map<CLS, ? extends java.util.Set<? extends E>>)`

### getExpression

    public OCLExpression<C> getExpression()

  Description copied from interface: `Query`
  Obtains the expression that I evaluate (or check as a boolean constraint).

  Specified by:
    `getExpression` in interface `Query<C,CLS,E>`
  Returns:
    my OCL expression

### evaluate

    public Object evaluate(Object obj)

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

  Specified by:
    `evaluate` in interface `Query<C,CLS,E>`
  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<C,CLS,E>`
  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<C,CLS,E>`
  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<C,CLS,E>`
  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<C,CLS,E>`
  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 <T> List<T> select(List<T> 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<C,CLS,E>`
  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 <T> List<T> reject(List<T> 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<C,CLS,E>`
  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 C resultType()

  Description copied from interface: `Query`
  Obtains the OCL result type of the query. This may be a classifier in the user model, or it may represent a pre-defined OCL data type such as `Boolean`.

  Specified by:
    `resultType` in interface `Query<C,CLS,E>`
  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<C,CLS,E>`
  Returns:
    the text of the OCL query expression

### getEvaluationEnvironment

    public EvaluationEnvironment<C,O,P,CLS,E> getEvaluationEnvironment()

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

  Specified by:
    `getEvaluationEnvironment` in interface `Query<C,CLS,E>`
  Returns:
    my environment

### getProblems

    public Diagnostic getProblems()

  Description copied from interface: `ProblemAware`
  Retrieves the problems available on this problem aware object

  Specified by:
    `getProblems` in interface `ProblemAware`
  Returns:
    the diagnostic object representing the problems or `null` in case that no problems are available.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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