|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--saffron.opt.Rule
A Rule
transforms an expression into another. It has a list
of Operand
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(saffron.opt.RuleCall)
on each of them.
Field Summary | |
protected String |
description
Description of rule, must be unique within planner. |
(package private) Operand |
operand
Root of operand tree. |
(package private) Operand[] |
operands
Flattened list of operands. |
protected VolcanoPlanner |
planner
Current planner; set by VolcanoPlanner.addRule(saffron.opt.Rule) . |
Constructor Summary | |
Rule(Operand operand)
|
Method Summary | |
protected static Rel |
convert(Planner planner,
Rel 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(RuleCall 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 VolcanoPlanner planner
VolcanoPlanner.addRule(saffron.opt.Rule)
.
final Operand operand
Operand[] operands
protected String description
Constructor Detail |
public Rule(Operand operand)
Method Detail |
private static String guessDescription(String className)
VolcanoPlanner getPlanner()
VolcanoPlanner
.
public abstract void onMatch(RuleCall 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 RuleCall.transformTo(saffron.rel.Rel)
to
register the expression.
public String toString()
toString
in class Object
public CallingConvention getOutConvention()
protected static Rel convert(Planner planner, Rel 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |