org.eigenbase.rex
Class RexShuttle

java.lang.Object
  extended by org.eigenbase.rex.RexShuttle
All Implemented Interfaces:
RexVisitor<RexNode>
Direct Known Subclasses:
CalcRelSplitter.InputToCommonExprConverter, FarragoReduceExpressionsRule.RexReplacer, FarragoReduceValuesRule.MyRexShuttle, LcsRemoveRidExprRule.RidExprConverter, ReduceDecimalsRule.DecimalShuttle, RelDecorrelator.DecorrelateRexShuttle, RelDecorrelator.RemoveCorrelationRexShuttle, RelOptUtil.InputReferencedVisitor, RelOptUtil.RexInputConverter, RelOptUtil.VariableUsedVisitor, RelStructuredTypeFlattener.RewriteRexShuttle, RemoveIsNotDistinctFromRule.RemoveIsNotDistinctFromRexShuttle, RexCopier, RexPermutationShuttle, RexPermuteInputsShuttle, RexProgram.ExpansionShuttle, RexProgramBuilder.RegisterShuttle, RexProgramBuilder.UpdateRefShuttle, SqlToRelConverter.HistogramShuttle

public class RexShuttle
extends Object
implements RexVisitor<RexNode>

Passes over a row-expression, calling a handler method for each node, appropriate to the type of the node.

Like RexVisitor, this is an instance of the Visitor Pattern. Use RexShuttle if you would like your methods to return a value.

Since:
Nov 26, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rex/RexShuttle.java#18 $
Author:
jhyde

Constructor Summary
RexShuttle()
           
 
Method Summary
<T extends RexNode>
boolean
apply(List<T> exprList)
          Applies this shuttle to each expression in a list.
 RexNode apply(RexNode expr)
          Applies this shuttle to an expression, or returns null if the expression is null.
protected  RexNode[] visitArray(RexNode[] exprs, boolean[] update)
          Visits each of an array of expressions and returns an array of the results.
 RexNode visitCall(RexCall call)
           
 RexNode visitCorrelVariable(RexCorrelVariable variable)
           
 RexNode visitDynamicParam(RexDynamicParam dynamicParam)
           
 RexNode visitFieldAccess(RexFieldAccess fieldAccess)
           
 RexNode visitInputRef(RexInputRef inputRef)
           
 RexNode visitLiteral(RexLiteral literal)
           
 RexNode visitLocalRef(RexLocalRef localRef)
           
 RexNode visitOver(RexOver over)
           
 RexNode visitRangeRef(RexRangeRef rangeRef)
           
 RexWindow visitWindow(RexWindow window)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RexShuttle

public RexShuttle()
Method Detail

visitOver

public RexNode visitOver(RexOver over)
Specified by:
visitOver in interface RexVisitor<RexNode>

visitWindow

public RexWindow visitWindow(RexWindow window)

visitCall

public RexNode visitCall(RexCall call)
Specified by:
visitCall in interface RexVisitor<RexNode>

visitArray

protected RexNode[] visitArray(RexNode[] exprs,
                               boolean[] update)
Visits each of an array of expressions and returns an array of the results.

Parameters:
exprs - Array of expressions
update - If not null, sets this to true if any of the expressions was modified
Returns:
Array of visited expressions

visitCorrelVariable

public RexNode visitCorrelVariable(RexCorrelVariable variable)
Specified by:
visitCorrelVariable in interface RexVisitor<RexNode>

visitFieldAccess

public RexNode visitFieldAccess(RexFieldAccess fieldAccess)
Specified by:
visitFieldAccess in interface RexVisitor<RexNode>

visitInputRef

public RexNode visitInputRef(RexInputRef inputRef)
Specified by:
visitInputRef in interface RexVisitor<RexNode>

visitLocalRef

public RexNode visitLocalRef(RexLocalRef localRef)
Specified by:
visitLocalRef in interface RexVisitor<RexNode>

visitLiteral

public RexNode visitLiteral(RexLiteral literal)
Specified by:
visitLiteral in interface RexVisitor<RexNode>

visitDynamicParam

public RexNode visitDynamicParam(RexDynamicParam dynamicParam)
Specified by:
visitDynamicParam in interface RexVisitor<RexNode>

visitRangeRef

public RexNode visitRangeRef(RexRangeRef rangeRef)
Specified by:
visitRangeRef in interface RexVisitor<RexNode>

apply

public final <T extends RexNode> boolean apply(List<T> exprList)
Applies this shuttle to each expression in a list.

Returns:
whether any of the expressions changed

apply

public final RexNode apply(RexNode expr)
Applies this shuttle to an expression, or returns null if the expression is null.