public class QueryImpl<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> extends java.lang.Object implements Query<C,CLS,E>, ProblemAware
The following features are implemented:
Constructor and Description |
---|
QueryImpl(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment,
OCLExpression<C> expr,
java.util.Map<CLS,? extends java.util.Set<? extends E>> extentMap) |
Modifier and Type | Method and Description |
---|---|
boolean |
check(java.util.List<?> objList)
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<?> objList)
Evaluates the query on the input list.
|
java.lang.Object |
evaluate(java.lang.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).
|
java.util.Map<CLS,? extends java.util.Set<? extends E>> |
getExtentMap()
Obtains the mapping of classes to their extents (sets of all instances).
|
org.eclipse.emf.common.util.Diagnostic |
getProblems()
Retrieves the problems available on this problem aware object
|
java.lang.String |
queryText()
Translates the query back to an OCL text string.
|
<T> java.util.List<T> |
reject(java.util.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> java.util.List<T> |
select(java.util.List<T> objList)
Determines the subset of input objects that satisfy the query.
|
java.lang.String |
toString() |
public QueryImpl(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment, OCLExpression<C> expr, java.util.Map<CLS,? extends java.util.Set<? extends E>> extentMap)
environment
- expr
- extentMap
- may be null
, in which case I will use my
evaluation environment to create a dynamic extent mappublic java.util.Map<CLS,? extends java.util.Set<? extends E>> getExtentMap()
Query
getExtentMap
in interface Query<C,CLS,E>
OCL.setExtentMap(java.util.Map<CLS, ? extends java.util.Set<? extends E>>)
public OCLExpression<C> getExpression()
Query
getExpression
in interface Query<C,CLS,E>
public java.lang.Object evaluate(java.lang.Object obj)
Query
evaluate
in interface Query<C,CLS,E>
obj
- an Object
EObject
s, Java objects, a mixture, or even null
.
In any case, the results conform to the expression's
result typeQuery.evaluate()
,
Query.evaluate(List)
,
Query.resultType()
public java.lang.Object evaluate()
Query
allInstances()
exclusively for evaluation.evaluate
in interface Query<C,CLS,E>
EObject
s, Java objects, a mixture, or even null
.
In any case, the results conform to the expression's
result typeQuery.resultType()
public boolean check(java.lang.Object obj)
Query
public java.util.List<?> evaluate(java.util.List<?> objList)
Query
evaluate
in interface Query<C,CLS,E>
objList
- a list of objects to evaluate the query onobjects
. 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 typeQuery.evaluate(Object)
,
Query.resultType()
public boolean check(java.util.List<?> objList)
Query
public <T> java.util.List<T> select(java.util.List<T> objList)
Query
public <T> java.util.List<T> reject(java.util.List<T> objList)
Query
public C resultType()
Query
Boolean
.resultType
in interface Query<C,CLS,E>
public java.lang.String queryText()
Query
public EvaluationEnvironment<C,O,P,CLS,E> getEvaluationEnvironment()
Query
getEvaluationEnvironment
in interface Query<C,CLS,E>
public org.eclipse.emf.common.util.Diagnostic getProblems()
ProblemAware
getProblems
in interface ProblemAware
null
in case that no problems are available.public java.lang.String toString()
toString
in class java.lang.Object