org.objectweb.medor.optim.lib

Class PushNotInExpressionRule

Implemented Interfaces:
RewriteRule

public class PushNotInExpressionRule
extends BasicRule

This class is a RewriteRule implementation which vists a tree of QueryTree in order to push the not operator in the filters.

Somes examples:

Author:
S. Chassande-Barrioz

Nested Class Summary

Nested classes/interfaces inherited from class org.objectweb.medor.optim.lib.BasicRule

BasicRule.ModifiedExpression

Field Summary

Fields inherited from class org.objectweb.medor.optim.lib.BasicRule

debug, log

Constructor Summary

PushNotInExpressionRule()

Method Summary

BasicRule.ModifiedExpression
pushNotInExpression(Expression e, boolean hasANot)
This recursive method push the Not operator in an expression.
QueryTree
rewrite(QueryTree qt, QueryNode _parent)
It modifies the expressions used as filter in a (tree of) QueryTree by pushing the not operator.

Methods inherited from class org.objectweb.medor.optim.lib.BasicRule

replaceUsage, rewrite

Constructor Details

PushNotInExpressionRule

public PushNotInExpressionRule()

Method Details

pushNotInExpression

public BasicRule.ModifiedExpression pushNotInExpression(Expression e,
                                                        boolean hasANot)
            throws MedorException
This recursive method push the Not operator in an expression.

Parameters:
e - the current expression inside which the not operator must be pushed
hasANot - is boolean which indicates if a not is currently being push

Throws:
MedorException - if the expression is mal formed.


rewrite

public QueryTree rewrite(QueryTree qt,
                         QueryNode _parent)
            throws MedorException
It modifies the expressions used as filter in a (tree of) QueryTree by pushing the not operator. Somes examples: !(a && b) is replaced by (!a || !b) !(a > b) is replaced by (a <= b) !(a = b) is replaced by (a != b) ...
Specified by:
rewrite in interface RewriteRule

Parameters:
qt - is the query on which the rule must be applied

Throws:
MedorException - if filters are malforrmed