org.objectweb.medor.optim.jorm
Class JormLeafRewriter

java.lang.Object
  extended byorg.objectweb.medor.optim.lib.BasicRule
      extended byorg.objectweb.medor.optim.jorm.JormRule
          extended byorg.objectweb.medor.optim.jorm.JormLeafRewriter
All Implemented Interfaces:
LeafRewriter, RewriteRule

public abstract class JormLeafRewriter
extends JormRule
implements LeafRewriter

Author:
S. Chassande-Barrioz

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
JormLeafRewriter(java.lang.String suffix)
           
 
Method Summary
abstract  QueryTreeField addPrimitiveElement(QueryLeaf neo, PrimitiveElement pe, JormExtent extent)
           
protected  void addReference(NameDef nd, PNameField pnf, QueryNode qt, QueryLeaf specificQL, JormExtent extent)
           
abstract  boolean canRewrite(QueryLeaf ql)
          It returns true is the QueryLeaf can be rewrite by this LeafRewriter.
protected abstract  QueryLeaf createQueryLeaf(JormExtent extent)
           
 QueryTreeField getField(QueryLeaf neo, PrimitiveElement pe, JormExtent extent)
           
protected  java.lang.String getFieldName(java.lang.String prefix, java.lang.String nodeName)
           
protected  java.lang.String getShortFieldName(java.lang.String fn)
           
 QueryTree rewrite(QueryLeaf ql)
          It rewrites the QueryLeaf into a QueryTree.
 QueryTree rewrite(QueryTree qt, QueryNode parent)
          This method applies a single rule.
 
Methods inherited from class org.objectweb.medor.optim.jorm.JormRule
getClassMapping, getGenClassMapping, getJORMFieldName, getPEM, getPNCOperand, getPrimitiveElement
 
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

JormLeafRewriter

public JormLeafRewriter(java.lang.String suffix)
Method Detail

canRewrite

public abstract boolean canRewrite(QueryLeaf ql)
Description copied from interface: LeafRewriter
It returns true is the QueryLeaf can be rewrite by this LeafRewriter.

Specified by:
canRewrite in interface LeafRewriter

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.

Specified by:
rewrite in interface RewriteRule
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

rewrite

public QueryTree rewrite(QueryLeaf ql)
                  throws MedorException
Description copied from interface: LeafRewriter
It rewrites the QueryLeaf into a QueryTree.

Specified by:
rewrite in interface LeafRewriter
Throws:
MedorException

createQueryLeaf

protected abstract QueryLeaf createQueryLeaf(JormExtent extent)
                                      throws MedorException
Throws:
MedorException

addPrimitiveElement

public abstract QueryTreeField addPrimitiveElement(QueryLeaf neo,
                                                   PrimitiveElement pe,
                                                   JormExtent extent)
                                            throws MedorException
Throws:
MedorException

getField

public QueryTreeField getField(QueryLeaf neo,
                               PrimitiveElement pe,
                               JormExtent extent)
                        throws MedorException
Throws:
MedorException

addReference

protected void addReference(NameDef nd,
                            PNameField pnf,
                            QueryNode qt,
                            QueryLeaf specificQL,
                            JormExtent extent)
                     throws MedorException
Throws:
MedorException

getFieldName

protected java.lang.String getFieldName(java.lang.String prefix,
                                        java.lang.String nodeName)

getShortFieldName

protected java.lang.String getShortFieldName(java.lang.String fn)