org.objectweb.medor.optim.lib
Class PushSelectionRule
java.lang.Object
org.objectweb.medor.optim.lib.BasicRule
org.objectweb.medor.optim.lib.PushSelectionRule
- All Implemented Interfaces:
- RewriteRule
- public class PushSelectionRule
- extends BasicRule
This class represents the rule to push selections down a QueryTree.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PushSelectionRule
public PushSelectionRule()
rewrite
public QueryTree rewrite(QueryTree qt,
QueryNode parent)
throws MedorException
- Description copied from interface:
RewriteRule
- This method applies a single rule.
It is typically called by the
QueryRewriter for applying the entire rewriting process.
- Parameters:
qt
- the QueryTree to be rewrittenparent
- the parent QueryNode for which modification of propagated
field, if they are replaced in the qt, should be done.
- Returns:
- the rewritten QueryTree
- Throws:
MedorException
rewriteExp
protected void rewriteExp(QueryTree qt,
Expression addedExp)
throws MedorException
- Throws:
MedorException
merge
public BasicRule.ModifiedExpression merge(Expression origin,
Expression addExp,
int op)
- It merges an source expresion with an additional expression.
- Parameters:
origin
- is the source expressionaddExp
- is the additionnal expression which will be merge with the
source.
- Returns:
- a ModifiedExpression instance. The 'isModified' field indicates
if the source expression has been modified ou replaced. The 'e' field
references the result of the merge.
extractMapFromExpression
public BasicRule.ModifiedExpression extractMapFromExpression(Expression e,
java.util.Map qt2e,
int op)
throws MedorException
- This methods does two things. It extracts the expressions which can be
moved to a QueryTree child. The extracted expression are grouped by
QueryTree child in the Map parameter.
- Parameters:
e
- is the expression in which sub expression could be extractedqt2e
- is a map result parameter which must be fill with the
the extractable sub expressions.
- Returns:
- a modifiedExpression instance. The 'isModified' field indicates
if the source expression has been modified ou replaced. The 'e' field
references the rest of the expression.
- Throws:
MedorException
isSameQT
public PushSelectionRule.SameQT isSameQT(Expression e)
throws MedorException
- It evaluates if inside an expression all QueryTreeField referenced in
FieldOperands come from the same QueryTree.
- Parameters:
e
- is the expression in which the FieldOperand field will be
searched
- Returns:
- a SameQt instance. The 'isSame' field indicates if in the
given expression all Fields are linked to the same QueryTree. If 'isSame'
is true, the 'qt' field is the QueryTree with which all fieldoperand of
expression are linked.
- Throws:
MedorException
goDownFieldOperand
public BasicRule.ModifiedExpression goDownFieldOperand(Expression e)
throws MedorException
- Throws:
MedorException