org.objectweb.medor.eval.lib
Class SelectEvaluator

java.lang.Object
  extended byorg.objectweb.medor.eval.lib.AbstractQueryEvaluator
      extended byorg.objectweb.medor.eval.lib.SelectEvaluator
All Implemented Interfaces:
QueryEvaluator
Direct Known Subclasses:
MedorEvaluator

public class SelectEvaluator
extends AbstractQueryEvaluator

This class is a simple evaluator of query tree for data fetching. Its supports the data prefetching (loading additional data for next needs).

Author:
S.Chassande-Barrioz

Field Summary
protected  long cacheSize
          The cache size for each node evaluator
protected  NodeEvaluatorFactory nodeEvaluatorFactory
          The factory of node evaluator (QueryNode evaluator)
protected  java.util.Stack queryTreeStack
          The query tree to evalued, stored as a stack
 
Fields inherited from class org.objectweb.medor.eval.lib.AbstractQueryEvaluator
query, wrapperFactory
 
Constructor Summary
SelectEvaluator(QueryTree query, long cacheSize)
           
 
Method Summary
 TupleCollection evaluate(ParameterOperand[] parameters, ConnectionResources resources, java.util.Map evaluationMDMap)
          First, it allocates a tree of Evaluator (Wrapper or NodeEvaluator) for the query tree associated to this evaluator.
 TupleCollection evaluate(ParameterOperand[] parameters, ConnectionResources resources, PrefetchBuffer prefetchBuffer, java.util.Map evalMDMap)
          Launch the evaluation of a query.
 long getCacheSize()
           
 ConnectionResources getRequiredConnectionResources()
           
protected  void toStack(QueryTree qt, java.util.Stack pile)
           
 
Methods inherited from class org.objectweb.medor.eval.lib.AbstractQueryEvaluator
getMemoryTupleCollection, getQueryTree, getWrapperFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeEvaluatorFactory

protected NodeEvaluatorFactory nodeEvaluatorFactory
The factory of node evaluator (QueryNode evaluator)


queryTreeStack

protected java.util.Stack queryTreeStack
The query tree to evalued, stored as a stack


cacheSize

protected long cacheSize
The cache size for each node evaluator

Constructor Detail

SelectEvaluator

public SelectEvaluator(QueryTree query,
                       long cacheSize)
                throws EvaluationException
Method Detail

toStack

protected void toStack(QueryTree qt,
                       java.util.Stack pile)
                throws EvaluationException
Throws:
EvaluationException

getRequiredConnectionResources

public ConnectionResources getRequiredConnectionResources()

getCacheSize

public long getCacheSize()
Returns:
the cache size used in different node of the QueryNode tree.

evaluate

public TupleCollection evaluate(ParameterOperand[] parameters,
                                ConnectionResources resources,
                                java.util.Map evaluationMDMap)
                         throws EvaluationException
First, it allocates a tree of Evaluator (Wrapper or NodeEvaluator) for the query tree associated to this evaluator. In a second step it launches the evalution of the query.

Parameters:
parameters - is the array of parameters
resources - is the holder of connection used by the wrapper to access the data support.
evaluationMDMap - contains a map associating an EvaluationMetaData object to each of the query nodes of the query tree currently associated to the QueryEvaluator.
Throws:
EvaluationException

evaluate

public TupleCollection evaluate(ParameterOperand[] parameters,
                                ConnectionResources resources,
                                PrefetchBuffer prefetchBuffer,
                                java.util.Map evalMDMap)
                         throws EvaluationException
Description copied from interface: QueryEvaluator
Launch the evaluation of a query. This method is able to prefetch data of the query in a prefetch buffer.

Parameters:
parameters - is a ConnectionResources containing associations between the DataStore names used in the QueryTree and the connection objects to use for the evaluation.
prefetchBuffer - is the prefetchBuffer instance where buffer data must be put. If this field is null, then no data prefetching mus be done.
resources - is a ConnectionResources containing associations between the DataStore names used in the QueryTree and the connection objects to use for the evaluation.It can be null.
Throws:
EvaluationException