Cumulus4j API
(1.1.1)

org.cumulus4j.store.query.eval
Class AndExpressionEvaluator

java.lang.Object
  extended by org.cumulus4j.store.query.eval.AbstractExpressionEvaluator<DyadicExpression>
      extended by org.cumulus4j.store.query.eval.AndExpressionEvaluator

public class AndExpressionEvaluator
extends AbstractExpressionEvaluator<DyadicExpression>

Evaluator handling the boolean operation "&&" (AND).

Cumulus4j encrypts as much as possible and keeps a minimum of plain-text indexes. The plain-text-indexes index each field separately. This is a compromise between security and searchability. As the index contains only plain-text field-values without any plain-text context (the context is encrypted), it provides the advantage of high security, but at the same time it is not possible to query an AND operation directly in the underlying database.

Instead, the AND operation is performed by first querying all dataEntryIDs of the left and the right side and then intersecting these two Set<Long> in memory.

If the ResultDescriptor indicates a negation, this evaluator delegates to the OrExpressionEvaluator, because a query like "!( a > 5 && b <= 12 )" is internally converted to "a <= 5 || b > 12" for performance reasons. See NotExpressionEvaluator as well as De Morgan's laws in wikipedia for details.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de
See Also:
OrExpressionEvaluator

Constructor Summary
AndExpressionEvaluator(OrExpressionEvaluator negatedExpressionEvaluator)
           
AndExpressionEvaluator(QueryEvaluator queryEvaluator, AbstractExpressionEvaluator<?> parent, DyadicExpression expression)
           
 
Method Summary
protected  Set<Long> _queryResultDataEntryIDs(ResultDescriptor resultDescriptor)
          Execute a query for the given resultDescriptor.
protected  Set<Long> _queryResultDataEntryIDsIgnoringNegation(ResultDescriptor resultDescriptor)
           
 AbstractExpressionEvaluator<? extends Expression> getLeft()
          Get the left branch in the tree structure.
 AbstractExpressionEvaluator<? extends Expression> getRight()
          Get the right branch in the tree structure.
 
Methods inherited from class org.cumulus4j.store.query.eval.AbstractExpressionEvaluator
_getResultSymbols, _queryResultObjects, getExpression, getFieldType, getParent, getQueryEvaluator, getResultSymbols, queryResultDataEntryIDs, queryResultObjects, setLeft, setRight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndExpressionEvaluator

public AndExpressionEvaluator(QueryEvaluator queryEvaluator,
                              AbstractExpressionEvaluator<?> parent,
                              DyadicExpression expression)

AndExpressionEvaluator

public AndExpressionEvaluator(OrExpressionEvaluator negatedExpressionEvaluator)
Method Detail

getLeft

public AbstractExpressionEvaluator<? extends Expression> getLeft()
Description copied from class: AbstractExpressionEvaluator
Get the left branch in the tree structure.

Overrides:
getLeft in class AbstractExpressionEvaluator<DyadicExpression>
Returns:
the left branch in the tree structure or null if there is none.
See Also:
AbstractExpressionEvaluator.setLeft(AbstractExpressionEvaluator), AbstractExpressionEvaluator.getRight()

getRight

public AbstractExpressionEvaluator<? extends Expression> getRight()
Description copied from class: AbstractExpressionEvaluator
Get the right branch in the tree structure.

Overrides:
getRight in class AbstractExpressionEvaluator<DyadicExpression>
Returns:
the right branch in the tree structure or null if there is none.
See Also:
AbstractExpressionEvaluator.setRight(AbstractExpressionEvaluator), AbstractExpressionEvaluator.getLeft()

_queryResultDataEntryIDs

protected Set<Long> _queryResultDataEntryIDs(ResultDescriptor resultDescriptor)
Description copied from class: AbstractExpressionEvaluator
Execute a query for the given resultDescriptor. This method should contain the concrete logic for AbstractExpressionEvaluator.queryResultDataEntryIDs(ResultDescriptor) and must be implemented by subclasses.

Specified by:
_queryResultDataEntryIDs in class AbstractExpressionEvaluator<DyadicExpression>
Parameters:
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.
Returns:
those dataEntryIDs 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()).
See Also:
AbstractExpressionEvaluator.queryResultDataEntryIDs(ResultDescriptor)

_queryResultDataEntryIDsIgnoringNegation

protected Set<Long> _queryResultDataEntryIDsIgnoringNegation(ResultDescriptor resultDescriptor)

Cumulus4j API
(1.1.1)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.