net.sf.farrago.fennel.calc
Class CalcRexImplementorTableImpl.MinMaxCalcRexImplementor

java.lang.Object
  extended by net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.AbstractCalcRexAggImplementor
      extended by net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.MinMaxCalcRexImplementor
All Implemented Interfaces:
CalcRexAggImplementor
Enclosing class:
CalcRexImplementorTableImpl

private static class CalcRexImplementorTableImpl.MinMaxCalcRexImplementor
extends CalcRexImplementorTableImpl.AbstractCalcRexAggImplementor

Implementation of the MIN and MAX aggregate function, SqlStdOperatorTable.sumOperator.


Field Summary
private  SqlAggFunction function
           
 
Constructor Summary
CalcRexImplementorTableImpl.MinMaxCalcRexImplementor(SqlAggFunction function)
           
 
Method Summary
 void implementAdd(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to add a new value to an aggregation.
 void implementDrop(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to implement this call, and returns the register which holds the result.
 void implementInitAdd(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to initialize and add a new value to an aggregation.
 void implementInitialize(RexCall call, CalcReg accumulatorRegister, RexToCalcTranslator translator)
          Generates instructions to initialize an accumulator for a call to this aggregate function, and returns the register which holds the accumulator.
private  boolean isMin()
           
 
Methods inherited from class net.sf.farrago.fennel.calc.CalcRexImplementorTableImpl.AbstractCalcRexAggImplementor
canImplement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

function

private final SqlAggFunction function
Constructor Detail

CalcRexImplementorTableImpl.MinMaxCalcRexImplementor

public CalcRexImplementorTableImpl.MinMaxCalcRexImplementor(SqlAggFunction function)
Method Detail

isMin

private boolean isMin()

implementInitialize

public void implementInitialize(RexCall call,
                                CalcReg accumulatorRegister,
                                RexToCalcTranslator translator)
Description copied from interface: CalcRexAggImplementor
Generates instructions to initialize an accumulator for a call to this aggregate function, and returns the register which holds the accumulator.

For example, for SUM(x), this method generates O s8; V 0; T; MOVE O0, C0; and returns the O0 register.

Parameters:
call - The call to the aggregate function to be implemented
accumulatorRegister - The accumulator register to be populated
translator - Calculator code generator

implementInitAdd

public void implementInitAdd(RexCall call,
                             CalcReg accumulatorRegister,
                             RexToCalcTranslator translator)
Description copied from interface: CalcRexAggImplementor
Generates instructions to initialize and add a new value to an aggregation. This could call implementInitialize followed by implementAdd

Specified by:
implementInitAdd in interface CalcRexAggImplementor
Overrides:
implementInitAdd in class CalcRexImplementorTableImpl.AbstractCalcRexAggImplementor
Parameters:
call - The call to the aggregate function to be implemented
accumulatorRegister - The accumulator register
translator - Calculator code generator

implementAdd

public void implementAdd(RexCall call,
                         CalcReg accumulatorRegister,
                         RexToCalcTranslator translator)
Description copied from interface: CalcRexAggImplementor
Generates instructions to add a new value to an aggregation.

For example, for SUM(x), this method generates I s8; O s8; T; ADD O0, I0;.

Parameters:
call - The call to the aggregate function to be implemented
accumulatorRegister - The accumulator register
translator - Calculator code generator

implementDrop

public void implementDrop(RexCall call,
                          CalcReg accumulatorRegister,
                          RexToCalcTranslator translator)
Description copied from interface: CalcRexAggImplementor
Generates instructions to implement this call, and returns the register which holds the result.

For example, for SUM(x), this method generates I s8; O s8; T; SUB O0, I0;

Parameters:
call - The call to the aggregate function to be implemented.
accumulatorRegister - The accumulator register
translator - Calculator code generator