|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.saffron.opt.VolcanoRule
A VolcanoRule
transforms an expression into another. It has a
list of RuleOperand
s, which determine whether the rule can be
applied to a particular section of the tree.
The optimizer figures out which rules are applicable, then calls onMatch(net.sf.saffron.opt.VolcanoRuleCall)
on each of them.
Field Summary | |
protected String |
description
Description of rule, must be unique within planner. |
(package private) RuleOperand |
operand
Root of operand tree. |
(package private) RuleOperand[] |
operands
Flattened list of operands. |
protected VolcanoPlanner |
planner
Current planner; set by VolcanoPlanner.addRule(net.sf.saffron.opt.VolcanoRule) . |
Constructor Summary | |
VolcanoRule(RuleOperand operand)
|
Method Summary | |
protected static SaffronRel |
convert(SaffronPlanner planner,
SaffronRel rel,
CallingConvention toConvention)
Converts a relational expression to a given calling convention, if it is not already of that convention. |
CallingConvention |
getOutConvention()
Returns the calling convention of the result of firing this rule, null if not known. |
(package private) VolcanoPlanner |
getPlanner()
Returns the current VolcanoPlanner . |
private static String |
guessDescription(String className)
|
abstract void |
onMatch(VolcanoRuleCall call)
This method is called every time the rule matches. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected String description
protected VolcanoPlanner planner
VolcanoPlanner.addRule(net.sf.saffron.opt.VolcanoRule)
.
final RuleOperand operand
RuleOperand[] operands
Constructor Detail |
public VolcanoRule(RuleOperand operand)
Method Detail |
public abstract void onMatch(VolcanoRuleCall call)
call.rels
holds
the set of relational expressions which match the operands to the
rule; call.rels[0]
is the root expression.
Typically a rule would check that the nodes are valid matches, creates
a new expression, then calls back VolcanoRuleCall.transformTo(net.sf.saffron.rel.SaffronRel)
to register the expression.
public CallingConvention getOutConvention()
public String toString()
toString
in class Object
protected static SaffronRel convert(SaffronPlanner planner, SaffronRel rel, CallingConvention toConvention)
The stubborn
parameter controls how hard we try. Using
true
causes an expression explosion. If the expression
you are converting appears as an operand of the rule, it is safe to
use stubborn
= false
: if the operand is
transformed to another type, the rule will be invoked again.
planner
- Plannerrel
- Relexp to converttoConvention
- Desired calling convention
VolcanoPlanner getPlanner()
VolcanoPlanner
.
private static String guessDescription(String className)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |