Cumulus4j API
(1.1.0)

Package org.cumulus4j.store.query.eval

Evaluators actually doing the query work.

See:
          Description

Class Summary
AbstractExpressionEvaluator<X extends Expression> Abstract base class for all Expression evaluators.
AndExpressionEvaluator Evaluator handling the boolean operation "&&" (AND).
ComparisonExpressionEvaluator Evaluator handling the comparisons ==, <, <=, >, >=.
ExpressionHelper Series of helper methods for processing expressions.
ExpressionHelper.ContainsConstantResolver Resolve Collection.contains(Object) with the argument being a concrete value (a 'constant').
ExpressionHelper.ContainsVariableResolver Resolve Collection.contains(Object) with the argument being a query variable.
InvokeExpressionEvaluator Evaluator handling method invocations like Collection.contains(...).
LiteralEvaluator Evaluator representing literals.
NotExpressionEvaluator Evaluator handling "!" (negation).
OrExpressionEvaluator Evaluator handling the boolean operation "||" (OR).
ParameterExpressionEvaluator Evaluator representing query parameters.
PrimaryExpressionEvaluator Evaluator representing PrimaryExpressions.
PrimaryExpressionResolver Abstract base class for easy resolving of PrimaryExpressions.
ResultDescriptor Descriptor specifying what kind of result is expected when a query is executed.
SubqueryExpressionEvaluator Evaluator handling a sub-query.
VariableExpressionEvaluator Evaluator representing variables.
 

Package org.cumulus4j.store.query.eval Description

Evaluators actually doing the query work.

DataNucleus gives the query implementation a tree composed of Expressions. This tree is nothing more than an object-oriented representation of the query to be executed. In order to actually query data, there needs to be evaluation logic applying the Expression to the Cumulus4j data structure. This logic is implemented in subclasses of AbstractExpressionEvaluator.

The expression-evaluators are instantiated and arranged to form a tree just like DataNucleus' Expression tree. Thus for each node in the expression-tree, there is a corresponding node in the expression-evaluator-tree.

To query data via this expression-evaluator-tree, there are two methods available: AbstractExpressionEvaluator.queryResultDataEntryIDs(ResultDescriptor) and AbstractExpressionEvaluator.queryResultObjects(ResultDescriptor). The 2nd method calls the first method and then resolves the persistable objects for the resulting dataEntryIDs. Since the first method does not resolve persistable objects but only their internal IDs, it is much faster than the 2nd method. queryResultDataEntryIDs(ResultDescriptor) is thus used internally within the tree to resolve sub-trees (partial results).

For example, the AndExpressionEvaluator first resolves the left and the right result-dataEntryIDs and then intersects these two sets.

queryResultObjects(ResultDescriptor) is usually only called in the root-node of the tree at the end of the query process.

In order to resolve variables, the expression-evaluator-tree is not only able to query one single result (the main query candidate, i.e. "this"), but the caller can tell it what result it should query. This is done by passing a ResultDescriptor to the query methods.


Cumulus4j API
(1.1.0)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.