net.sf.saffron.rel.convert
Class ConverterRule

java.lang.Object
  |
  +--net.sf.saffron.opt.VolcanoRule
        |
        +--net.sf.saffron.rel.convert.ConverterRule
Direct Known Subclasses:
FactoryConverterRule, OJPlannerFactory.AggregateToJavaRule, OJPlannerFactory.DistinctToJavaRule, OJPlannerFactory.FilterToJavaRule, OJPlannerFactory.JoinToJavaRule, OJPlannerFactory.OneRowToIteratorRule, OJPlannerFactory.OneRowToJavaRule, OJPlannerFactory.ProjectToIteratorRule, OJPlannerFactory.ProjectToJavaRule, OJPlannerFactory.TableAccessToJavaRule, OJPlannerFactory.UnionToIteratorRule, OJPlannerFactory.UnionToJavaRule

public abstract class ConverterRule
extends VolcanoRule

Abstract base class for a rule which converts from one calling convention to another without changing semantics.

Since:
May 5, 2003
Version:
$Id: //open/saffron/src/net/sf/saffron/rel/convert/ConverterRule.java#3 $
Author:
jhyde

Field Summary
 CallingConvention inConvention
           
 CallingConvention outConvention
           
 
Fields inherited from class net.sf.saffron.opt.VolcanoRule
description, planner
 
Constructor Summary
ConverterRule(Class clazz, CallingConvention in, CallingConvention out, String description)
          Creates a ConverterRule
 
Method Summary
abstract  SaffronRel convert(SaffronRel rel)
           
 CallingConvention getOutConvention()
          Returns the calling convention of the result of firing this rule, null if not known.
 boolean isGuaranteed()
          Returns true if this rule can convert any relational expression of the input convention.
 void onMatch(VolcanoRuleCall call)
          This method is called every time the rule matches.
 
Methods inherited from class net.sf.saffron.opt.VolcanoRule
convert, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inConvention

public final CallingConvention inConvention

outConvention

public final CallingConvention outConvention
Constructor Detail

ConverterRule

public ConverterRule(Class clazz,
                     CallingConvention in,
                     CallingConvention out,
                     String description)
Creates a ConverterRule

Pre-condition:
in != null, out != null
Method Detail

getOutConvention

public CallingConvention getOutConvention()
Description copied from class: VolcanoRule
Returns the calling convention of the result of firing this rule, null if not known.

Overrides:
getOutConvention in class VolcanoRule

convert

public abstract SaffronRel convert(SaffronRel rel)

isGuaranteed

public boolean isGuaranteed()
Returns true if this rule can convert any relational expression of the input convention.

The union-to-java converter, for example, is not guaranteed, because it only works on unions.


onMatch

public void onMatch(VolcanoRuleCall call)
Description copied from class: VolcanoRule
This method is called every time the rule matches. At the time that this method is called, 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.

Specified by:
onMatch in class VolcanoRule

SourceForge.net_Logo