net.sourceforge.nite.search.rewriter
Class DefaultConditionDistributor

java.lang.Object
  extended by net.sourceforge.nite.search.rewriter.ConditionDistributorTemplate
      extended by net.sourceforge.nite.search.rewriter.DefaultConditionDistributor
All Implemented Interfaces:
ParserTreeConstants, ConditionDistributor, RewriterConstants

public class DefaultConditionDistributor
extends ConditionDistributorTemplate

This implementation first creates skeleton subqueries without conditions, for any undeclared variables; orders them by the summed frequencies of the variables declared in each; then distributes the remaining conditions by placing them as early as possible in the sequence of subqueries. If it is impossible to place a condition C in a subquery which a) declares a variable used in the condition; b) has no condition; and c) along with its predecessors declares all the variables required by C; then two subqueries must be collapsed into one. This is a simple way of avoiding a potential circular dependency between the and declarations in the correct order,

Author:
nmayo@inf.ed.ac.uk

Field Summary
 
Fields inherited from interface net.sourceforge.nite.search.ParserTreeConstants
JJTCONDITION, JJTLOGICAL, jjtNodeName, JJTQUERY, JJTSIMPLEQUERY
 
Fields inherited from interface net.sourceforge.nite.search.rewriter.RewriterConstants
BREAK_LINE, TEST_QUERIES
 
Constructor Summary
DefaultConditionDistributor(java.util.List conds, java.util.Hashtable vars)
          Initialise the class with a set of minimal conditions.
 
Method Summary
 void distributeRemainingConditions()
          Distribute the conditions and variable declarations across a new set of SimpleQueries, returning the resultant complex query.
 
Methods inherited from class net.sourceforge.nite.search.rewriter.ConditionDistributorTemplate
createSkeletonDeclarations, distribute, getTypes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConditionDistributor

public DefaultConditionDistributor(java.util.List conds,
                                   java.util.Hashtable vars)
Initialise the class with a set of minimal conditions. These may be atomic conditions or groupings of conditions.

Parameters:
conds - a List of MinimalCondition objects representing SimpleNodes which should be distributed
vars - a Hashtable mapping each variable name to a List of types
Method Detail

distributeRemainingConditions

public void distributeRemainingConditions()
Distribute the conditions and variable declarations across a new set of SimpleQueries, returning the resultant complex query.

Parameters:
orderingScheme - a DeclarationOrderingScheme to use in ordering subqueries