org.objectweb.medor.optim.lib

Class BasicQueryRewriter

Implemented Interfaces:
QueryRewriter, QueryTransformer, RuleConfiguration
Known Direct Subclasses:
JormQueryRewriter

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 List
rules

Constructor Summary

BasicQueryRewriter()
It builds a BasicQueryRewriter with no rule
BasicQueryRewriter(ArrayList rules)
It builds a BasicQueryRewriter with a ArrayList of rules specified in parameter.
BasicQueryRewriter(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)
List
getDefaultRules()
It adds the default Medor rules in this following order
      PushNotInExpressionRule
      PushSelectionRule
      DropUnusedProjFieldsRule
      DropUselessNodeRule
      GroupSameStoreRule
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.

Field Details

debug

protected boolean debug


log

protected Logger log


rules

protected List rules

Constructor Details

BasicQueryRewriter

public BasicQueryRewriter()
It builds a BasicQueryRewriter with no rule


BasicQueryRewriter

public BasicQueryRewriter(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(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 Details

addRule

public 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)
Specified by:
addRule in interface RuleConfiguration

Parameters:
rule - the rule to be added.


getDefaultRules

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


getRules

public List getRules()
Gives the List of rules in the configuration
Specified by:
getRules in interface RuleConfiguration

Returns:
the List of rules in the configuration


removeRule

public void removeRule(RewriteRule rule)
Deletes a rule from the configuration.
Specified by:
removeRule in interface RuleConfiguration

Parameters:
rule - the rule to be removed


setRuleConfiguration

public void setRuleConfiguration(RuleConfiguration config)
This method configures the QueryRewriter using a RuleConfiguration.
Specified by:
setRuleConfiguration in interface QueryRewriter


transform

public QueryTree transform(QueryTree qt)
            throws MedorException
This methods transforms a QueryTree into another QueryTree.
Specified by:
transform in interface QueryTransformer