org.objectweb.medor.optim.jorm
Class JormGoUpDecodeRule

java.lang.Object
  extended byorg.objectweb.medor.optim.lib.BasicRule
      extended byorg.objectweb.medor.optim.jorm.JormGoUpDecodeRule
All Implemented Interfaces:
RewriteRule

public class JormGoUpDecodeRule
extends BasicRule

The aim of this rule is to remove comparaisons between PNames and move up the Decode operators (i.e. SinglePName and CompositePName) at the root of the QueryTree.

This rule is applied in one shot on the tree.

The Decode operators (SinglePName and CompositePName) are produced by the JormLeafRewriter rule.

Author:
S. Chassande-Barrioz
See Also:
JormLeafRewriter

Nested Class Summary
 
Nested classes 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
JormGoUpDecodeRule()
           
 
Method Summary
 java.util.Map goUpDecode(QueryNode qn, boolean isRoot)
          This recursive method performs the real work of the rule.
 QueryTree rewrite(QueryTree qt, QueryNode _parent)
          Rewrites a QueryTree by removing comparisons between PNames and moving up the Decode operators at the root of the QueryTree.
 
Methods inherited from class org.objectweb.medor.optim.lib.BasicRule
replaceUsage, rewrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JormGoUpDecodeRule

public JormGoUpDecodeRule()
Method Detail

rewrite

public QueryTree rewrite(QueryTree qt,
                         QueryNode _parent)
                  throws MedorException
Rewrites a QueryTree by removing comparisons between PNames and moving up the Decode operators at the root of the QueryTree.

It relies on the goUpDecode method to perform the real work.

Parameters:
qt - the QueryTree to be rewritten
_parent - 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

goUpDecode

public java.util.Map goUpDecode(QueryNode qn,
                                boolean isRoot)
                         throws MedorException
This recursive method performs the real work of the rule.

Parameters:
qn - is the QueryNode on which the rule must be applied.
isRoot - is a boolean which indicates if the qn is the root of the QueryTree.
Returns:
a map with the following characteristics:
  • key = an old projected field of a child. The old field is a PName decode or a Propagated field.
  • value = A map of composite field name associated to the new projected fields of the child. These fields replace the PName identifier. They are the PName fields. (key=composite fname, value=field)
Throws:
MedorException