Cumulus4j API
(1.1.0)

org.cumulus4j.store.query.eval
Class ResultDescriptor

java.lang.Object
  extended by org.cumulus4j.store.query.eval.ResultDescriptor

public class ResultDescriptor
extends Object

Descriptor specifying what kind of result is expected when a query is executed. This contains the information what candidates a query should search (usually "this" or a variable) as well as modifiers affecting the query (e.g. negation).

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

Constructor Summary
ResultDescriptor(Symbol symbol, Class<?> resultType)
          Create a ResultDescriptor.
ResultDescriptor(Symbol symbol, Class<?> resultType, FieldMeta fieldMeta, ClassMeta classMeta)
          Create a ResultDescriptor.
 
Method Summary
 boolean equals(Object obj)
           
 ClassMeta getClassMeta()
           
 FieldMeta getFieldMeta()
          Get the FieldMeta to query, if there is no FCO candidate.
 Class<?> getResultType()
          Get the type of the searched candidates.
 Symbol getSymbol()
          Get the symbol specifying what candidates are searched.
 int hashCode()
           
 boolean isNegated()
           Whether the result is the negation of the actual criteria.
 ResultDescriptor negate()
          Create a negation of this ResultDescriptor.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultDescriptor

public ResultDescriptor(Symbol symbol,
                        Class<?> resultType)
Create a ResultDescriptor.

Parameters:
symbol - the symbol; must not be null.
resultType - the type of the searched candidates. This can be null, if Symbol.getValueType() is not null. If Symbol.getValueType() is not null, this argument is ignored.

ResultDescriptor

public ResultDescriptor(Symbol symbol,
                        Class<?> resultType,
                        FieldMeta fieldMeta,
                        ClassMeta classMeta)
Create a ResultDescriptor.

Parameters:
symbol - the symbol; must not be null.
resultType - the type of the searched candidates. This can be null, if Symbol.getValueType() is not null. If Symbol.getValueType() is not null, this argument is ignored.
fieldMeta - the field to be queried, if there is no FCO candidate. Must be null, if an FCO is searched.
classMeta - TODO
Method Detail

getSymbol

public Symbol getSymbol()
Get the symbol specifying what candidates are searched.

Returns:
the symbol; never null.

getResultType

public Class<?> getResultType()
Get the type of the searched candidates. Note, that they might be instances of a subclass.

Returns:
the type; never null.

getClassMeta

public ClassMeta getClassMeta()

getFieldMeta

public FieldMeta getFieldMeta()
Get the FieldMeta to query, if there is no FCO candidate. For example, when querying for a joined Set<String>.contains(variable). This is null when querying for an FCO (then the context is clear from the symbol).

Returns:
the FieldMeta to query or null.

isNegated

public boolean isNegated()

Whether the result is the negation of the actual criteria.

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 negate() and passes the negated ResultDescriptor down the evaluator-tree. All nodes in the tree therefore have to take this flag into account.

Returns:
whether the result is the negation of the actual criteria.

negate

public ResultDescriptor negate()
Create a negation of this ResultDescriptor. The result will be a copy of this instance with all fields having the same value except for the negated flag which will have the opposite value.

Returns:
a negation of this ResultDescriptor.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

Cumulus4j API
(1.1.0)

Copyright © 2013 NightLabs Consulting GmbH. All Rights Reserved.