saffron.rel.convert
Class ConverterRule

java.lang.Object
  |
  +--saffron.opt.Rule
        |
        +--saffron.rel.convert.ConverterRule
Direct Known Subclasses:
Aggregate.ConvertToJavaRule, Distinct.ConvertDistinctToJavaRule, FactoryConverterRule, Filter.ConvertToJavaRule, Filter.ConvertToPlanRule, Join.ConvertToJavaRule, Join.ConvertToPlanRule, OneRow.OneRowToJavaRule, Project.ConvertToJavaRule, Project.ConvertToPlanRule, TableAccess.ConvertToJavaRule, Union.ConvertToIteratorRule, Union.ConvertToJavaRule

public abstract class ConverterRule
extends Rule

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/main/saffron/rel/convert/ConverterRule.java#6 $
Author:
jhyde

Field Summary
 CallingConvention inConvention
           
 CallingConvention outConvention
           
 
Fields inherited from class saffron.opt.Rule
description, planner
 
Constructor Summary
ConverterRule(Class clazz, CallingConvention in, CallingConvention out, String description)
          Creates a ConverterRule
 
Method Summary
abstract  Rel convert(Rel 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(RuleCall call)
          This method is called every time the rule matches.
 
Methods inherited from class saffron.opt.Rule
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: Rule
Returns the calling convention of the result of firing this rule, null if not known.

Overrides:
getOutConvention in class Rule

convert

public abstract Rel convert(Rel 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(RuleCall call)
Description copied from class: Rule
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 RuleCall.transformTo(saffron.rel.Rel) to register the expression.

Specified by:
onMatch in class Rule

SourceForge.net_Logo