org.eclipse.emf.facet.efacet.core.query

## Interface IQueryCollectionImplementation

All Superinterfaces:
  IQueryImplementation

    public interface IQueryCollectionImplementation
    extends IQueryImplementation

This interface can be implemented by EMF Facet query implementations that want to handle multiple evaluation themselves, presumably to improve the performance of the evaluation.

If only `IQueryImplementation` is implemented, then the framework will perform multiple-evaluation by calling the single evaluation multiple times, which may be slow in the case of high-latency implementations.

Since:
  0.2

### Method Summary

All Methods Instance Methods Abstract Methods
`java.util.List<? extends ETypedElementResult>` `getValues(Query query, ETypedElement eTypedElement, java.util.Collection<? extends EObject> sources, java.util.List<ParameterValue> arguments)` This method must be implemented by each sub-class to evaluate a query on a collection of elements.
`void` `setValues(Query query, DerivedTypedElement feature, java.util.Collection<? extends EObject> sources, java.util.List<ParameterValue> arguments, java.util.List<? extends java.lang.Object> newValues)` This method must be implemented by each sub-class to set the values of a collection of elements.

### Methods inherited from interface org.eclipse.emf.facet.efacet.core.query.IQueryImplementation

`getValue, isCheckResultType, setValue`

### Method Detail

#### getValues

    java.util.List<? extends ETypedElementResult> getValues(Query query,
                                                            ETypedElement eTypedElement,
                                                            java.util.Collection<? extends EObject> sources,
                                                            java.util.List<ParameterValue> arguments)
                                                     throws DerivedTypedElementException

This method must be implemented by each sub-class to evaluate a query on a collection of elements. The query should be evaluated on each of the elements in the given collection.

This method should throw a `DerivedTypedElementException` only if the eTypedElement is an incorrect `DerivedTypedElement`. But it must not throw an exception if the evaluation of one element fails. Instead, it must set the exception on the corresponding result (`ETypedElementResult.setException(Throwable)`).

Parameters:
  `query` - The query to evaluate
  `eTypedElement` - The feature or operation to get on the sources
  `sources` - The model elements on which the feature or operation is evaluated using the query
  `arguments` - The parameter values for the eTypedElement (in the case of a `FacetOperation`); can be `null`
Returns:
  the result :
  - a list of `ETypedElementPrimitiveTypeResult` if the eTypedElement is single-valued and returns a primitive type
  - a list of `ETypedElementPrimitiveTypeListResult` if the eTypedElement is multi-valued and returns a primitive type
  - a list of `ETypedElementEObjectResult` if the eTypedElement is single-valued and returns a model element
  - a list of `ETypedElementEObjectListResult` if the eTypedElement is multi-valued and returns model elements
Throws:
  `DerivedTypedElementException` - if the given derivedTypedElement is incorrect

#### setValues

    void setValues(Query query,
                   DerivedTypedElement feature,
                   java.util.Collection<? extends EObject> sources,
                   java.util.List<ParameterValue> arguments,
                   java.util.List<? extends java.lang.Object> newValues)
            throws DerivedTypedElementException

This method must be implemented by each sub-class to set the values of a collection of elements. The query should be used to set the value of each of the elements in the given collection.

Parameters:
  `query` - The query to evaluate
  `feature` - The derived typed element to set
  `sources` - The model elements on which the query is evaluated
  `arguments` - The parameter values for the derived typed element (in the case of a `FacetOperation`); can be `null`
  `newValues` - the new values for the sources; the size of this list must match the size of the list of sources
Throws:
  `DerivedTypedElementException` - if the given derivedTypedElement is incorrect
  `DerivedTypedElementEvaluationException` - if the query could not be evaluated correctly
  `java.lang.IllegalArgumentException` - if the given list of values does not match the list of sources