|
Cumulus4j API (1.0.1) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cumulus4j.store.query.eval.AbstractExpressionEvaluator<DyadicExpression>
org.cumulus4j.store.query.eval.NotExpressionEvaluator
public class NotExpressionEvaluator
Evaluator handling "!" (negation).
It is quite expensive to evaluate a negation (JDOQL "!") by first querying the normal (non-negated)
result and then negating it by querying ALL candidates and finally filtering the normal result
out. Therefore, we instead push the negation down the expression-evaluator-tree into the leafs.
Thus NotExpressionEvaluator
simply calls ResultDescriptor.negate()
and passes the negated
ResultDescriptor
down the evaluator-tree. All nodes in the tree therefore have to take this
negation-flag into account.
Example 1: Instead of querying the expensive expression "!( a > 5 && b <= 12 )", the cheaper equivalent "a <= 5 || b > 12" is used.
Example 2: Instead of "!( !( a > 5 && b <= 12 ) || c > 3 )" the equivalent "( a <= 5 || b > 12 ) && c <= 3" is executed.
See De Morgan's laws in wikipedia for details.
Constructor Summary | |
---|---|
NotExpressionEvaluator(QueryEvaluator queryEvaluator,
AbstractExpressionEvaluator<?> parent,
DyadicExpression expression)
|
Method Summary | |
---|---|
protected Set<Long> |
_queryResultDataEntryIDs(ResultDescriptor resultDescriptor)
Execute a query for the given resultDescriptor . |
Methods inherited from class org.cumulus4j.store.query.eval.AbstractExpressionEvaluator |
---|
_getResultSymbols, _queryResultObjects, getExpression, getFieldType, getLeft, getParent, getQueryEvaluator, getResultSymbols, getRight, queryResultDataEntryIDs, queryResultObjects, setLeft, setRight |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NotExpressionEvaluator(QueryEvaluator queryEvaluator, AbstractExpressionEvaluator<?> parent, DyadicExpression expression)
Method Detail |
---|
protected Set<Long> _queryResultDataEntryIDs(ResultDescriptor resultDescriptor)
AbstractExpressionEvaluator
resultDescriptor
. This method should contain
the concrete logic for AbstractExpressionEvaluator.queryResultDataEntryIDs(ResultDescriptor)
and must be implemented
by subclasses.
_queryResultDataEntryIDs
in class AbstractExpressionEvaluator<DyadicExpression>
resultDescriptor
- the descriptor specifying what candidates (usually "this" or a variable) the
caller is interested in as well as modifiers (e.g. negation
)
affecting the query.
dataEntryID
s that match the query
criteria for the specified resultSymbol
or null
, if the symbol is not
supported (this should be consistent with the implementation of AbstractExpressionEvaluator._getResultSymbols()
).AbstractExpressionEvaluator.queryResultDataEntryIDs(ResultDescriptor)
|
Cumulus4j API (1.0.1) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |