org.eclipse.emf.ocl.query
Interface Query

All Superinterfaces:
org.eclipse.emf.ecore.EObject, org.eclipse.emf.common.notify.Notifier
All Known Implementing Classes:
QueryImpl

public interface Query
extends org.eclipse.emf.ecore.EObject

An OCL constraint or query. The query is validated for correctness when it is created. The query can subsequently be evaluated on a single object or on multiple objects in one operation.


Field Summary
static java.lang.String copyright
           
 
Method Summary
 boolean check(java.util.List objects)
          Determines whether all of the input objects satisfy the query.
 boolean check(java.lang.Object obj)
          Evaluates the query on an object.
 java.lang.Object evaluate()
          Evaluates the query.
 java.util.List evaluate(java.util.List objects)
          Evaluates the query on the input list.
 java.lang.Object evaluate(java.lang.Object obj)
          Evaluates the query on the object.
 EvaluationEnvironment getEvaluationEnvironment()
          Obtains the evaluation environment that I use to evaluate OCL expressions.
 OCLExpression getExpression()
          Returns the value of the 'Expression' reference
 java.util.Map getExtentMap()
          Obtains the mapping of EClassifiers representing OCL types to their extents (set of all instances).
 java.lang.String queryText()
          Translates the query back to an OCL text string.
 java.util.List reject(java.util.List objects)
          Determines the subset of input objects that do not satisfy the query.
 org.eclipse.emf.ecore.EClassifier resultType()
          Obtains the OCL result type of the query.
 java.util.List select(java.util.List objects)
          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(java.util.Map extentMap)
          Sets the mapping of EClassifiers representing OCL types to their extents (set of all instances).
 
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
 

Field Detail

copyright

public static final java.lang.String copyright

See Also:
Constant Field Values
Method Detail

setEvaluationEnvironment

public void setEvaluationEnvironment(EvaluationEnvironment env)
Sets the evaluation environment that I use to evaluate OCL expressions.

Parameters:
env - my environment

getEvaluationEnvironment

public EvaluationEnvironment getEvaluationEnvironment()
Obtains the evaluation environment that I use to evaluate OCL expressions.

Returns:
my environment

evaluate

public java.lang.Object evaluate(java.lang.Object obj)
Evaluates the query on the object.

Parameters:
obj - an Object
Returns:
the result of the query, which may be one or more EObjects, 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 java.lang.Object evaluate()
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.

Returns:
the result of the query, which may be one or more EObjects, 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(java.lang.Object obj)
Evaluates the query on an object. The query must be a boolean valued constraint.

Returns:
boolean true or false according to whether the constraint is met
See Also:
Query.check(List)

evaluate

public java.util.List evaluate(java.util.List objects)
Evaluates the query on the input list. The results are returned in a corresponding list of results.

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:
#evaluate(EObject), Query.resultType()

check

public boolean check(java.util.List objects)
Determines whether all of the input objects satisfy the query. The query must be a boolean-valued constraint.

Parameters:
objects - 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:
#check(EObject)

select

public java.util.List select(java.util.List objects)
Determines the subset of input objects that satisfy the query. The query must be a boolean valued constraint.

Returns:
the subset (possibly empty) of the objects that satisfy the constraint

reject

public java.util.List reject(java.util.List objects)
Determines the subset of input objects that do not satisfy the query. The query must be a boolean valued constraint.

Returns:
the subset (possibly empty) of the objects that do not satisfy the constraint

resultType

public org.eclipse.emf.ecore.EClassifier resultType()
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.

Returns:
the query's result type

queryText

public java.lang.String queryText()
Translates the query back to an OCL text string.

Returns:
the text of the OCL query expression

getExtentMap

public java.util.Map getExtentMap()
Obtains the mapping of EClassifiers representing OCL types to their extents (set of all instances).

Returns:
the map of classifiers (EClassifier) to their extents (List)
See Also:
Query.setExtentMap(Map)

getExpression

public OCLExpression getExpression()
Returns the value of the 'Expression' reference.

If the meaning of the 'Expression' reference isn't clear, there really should be more of a description here...

Returns:
the value of the 'Expression' reference.
See Also:
QueryPackage.getQuery_Expression()

setExtentMap

public void setExtentMap(java.util.Map extentMap)
Sets the mapping of EClassifiers representing OCL types to their extents (set of all instances).

Parameters:
extentMap - a map of classifiers (EClassifier) to their extents (List)
See Also:
Query.getExtentMap()

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