org.objectweb.medor.optim.lib
Class BasicQueryRewriter

java.lang.Object
  extended byorg.objectweb.medor.optim.lib.BasicQueryRewriter
All Implemented Interfaces:
QueryRewriter, QueryTransformer, RuleConfiguration

public class BasicQueryRewriter
extends java.lang.Object
implements QueryRewriter, RuleConfiguration

This class implements the QueryRewriter interface AND also the RuleConfiguration interface (the aim is to optimize the number of object). The addDefaultRiles permits to assign the default rules in the right order.

Author:
S. Chassande-Barrioz

Field Summary
protected  boolean debug
           
protected  Logger log
           
protected  java.util.List rules
           
 
Constructor Summary
BasicQueryRewriter()
          It builds a BasicQueryRewriter with no rule
BasicQueryRewriter(java.util.ArrayList rules)
          It builds a BasicQueryRewriter with a ArrayList of rules specified in parameter.
BasicQueryRewriter(java.util.Collection rules)
          It builds a BasicQueryRewriter with a Collection of rules specified in parameter.
 
Method Summary
 void addRule(RewriteRule rule)
          Adds a rule to a configuration, together with parameters such as the number of times the rules is applied (once, saturation)
 java.util.List getDefaultRules()
          It adds the default Medor rules in this following order PushNotInExpressionRule PushSelectionRule DropUnusedProjFieldsRule DropUselessNodeRule GroupSameStoreRule
 java.util.List getRules()
          Gives the List of rules in the configuration
 void removeRule(RewriteRule rule)
          Deletes a rule from the configuration.
 void setRuleConfiguration(RuleConfiguration config)
          This method configures the QueryRewriter using a RuleConfiguration.
 QueryTree transform(QueryTree qt)
          This methods transforms a QueryTree into another QueryTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rules

protected java.util.List rules

log

protected Logger log

debug

protected boolean debug
Constructor Detail

BasicQueryRewriter

public BasicQueryRewriter()
It builds a BasicQueryRewriter with no rule


BasicQueryRewriter

public BasicQueryRewriter(java.util.ArrayList rules)
It builds a BasicQueryRewriter with a ArrayList of rules specified in parameter.

Parameters:
rules - is the list of rules for this configuration

BasicQueryRewriter

public BasicQueryRewriter(java.util.Collection rules)
It builds a BasicQueryRewriter with a Collection of rules specified in parameter.

Parameters:
rules - is the list of rules for this configuration
Method Detail

getDefaultRules

public java.util.List getDefaultRules()
It adds the default Medor rules in this following order
      PushNotInExpressionRule
      PushSelectionRule
      DropUnusedProjFieldsRule
      DropUselessNodeRule
      GroupSameStoreRule


setRuleConfiguration

public void setRuleConfiguration(RuleConfiguration config)
Description copied from interface: QueryRewriter
This method configures the QueryRewriter using a RuleConfiguration.

Specified by:
setRuleConfiguration in interface QueryRewriter

transform

public QueryTree transform(QueryTree qt)
                    throws MedorException
Description copied from interface: QueryTransformer
This methods transforms a QueryTree into another QueryTree.

Specified by:
transform in interface QueryTransformer
Throws:
MedorException

addRule

public void addRule(RewriteRule rule)
Description copied from interface: RuleConfiguration
Adds a rule to a configuration, together with parameters such as the number of times the rules is applied (once, saturation)

Specified by:
addRule in interface RuleConfiguration
Parameters:
rule - the rule to be added.

removeRule

public void removeRule(RewriteRule rule)
Description copied from interface: RuleConfiguration
Deletes a rule from the configuration.

Specified by:
removeRule in interface RuleConfiguration
Parameters:
rule - the rule to be removed

getRules

public java.util.List getRules()
Description copied from interface: RuleConfiguration
Gives the List of rules in the configuration

Specified by:
getRules in interface RuleConfiguration
Returns:
the List of rules in the configuration