org.objectweb.medor.optim.jorm

Class JormLeafRewriter

Implemented Interfaces:
LeafRewriter, RewriteRule

public abstract class JormLeafRewriter
extends JormRule
implements LeafRewriter

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

JormLeafRewriter(String suffix)

Method Summary

QueryTreeField
addPrimitiveElement(QueryLeaf neo, PrimitiveElement pe, JormExtent extent)
protected void
addReference(NameDef nd, PNameField pnf, QueryNode qt, QueryLeaf specificQL, JormExtent extent)
boolean
canRewrite(QueryLeaf ql)
It returns true is the QueryLeaf can be rewrite by this LeafRewriter.
protected QueryLeaf
createQueryLeaf(JormExtent extent)
QueryTreeField
getField(QueryLeaf neo, PrimitiveElement pe, JormExtent extent)
protected String
getFieldName(String prefix, String nodeName)
protected String
getShortFieldName(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

Constructor Details

JormLeafRewriter

public JormLeafRewriter(String suffix)

Method Details

addPrimitiveElement

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


addReference

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


canRewrite

public boolean canRewrite(QueryLeaf ql)
It returns true is the QueryLeaf can be rewrite by this LeafRewriter.
Specified by:
canRewrite in interface LeafRewriter


createQueryLeaf

protected QueryLeaf createQueryLeaf(JormExtent extent)
            throws MedorException


getField

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


getFieldName

protected String getFieldName(String prefix,
                              String nodeName)


getShortFieldName

protected String getShortFieldName(String fn)


rewrite

public QueryTree rewrite(QueryLeaf ql)
            throws MedorException
It rewrites the QueryLeaf into a QueryTree.
Specified by:
rewrite in interface LeafRewriter


rewrite

public QueryTree rewrite(QueryTree qt,
                         QueryNode parent)
            throws MedorException
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 -