net.sf.saffron.oj.rel
Class BuiltinAggregation.Count

java.lang.Object
  |
  +--net.sf.saffron.oj.rel.BuiltinAggregation
        |
        +--net.sf.saffron.oj.rel.BuiltinAggregation.Count
All Implemented Interfaces:
Aggregation
Enclosing class:
BuiltinAggregation

static class BuiltinAggregation.Count
extends BuiltinAggregation

Count is an aggregator which returns the number of rows which have gone into it. With one argument (or more), it returns the number of rows for which that argument (or all) is not null.


Nested Class Summary
 
Nested classes inherited from class net.sf.saffron.oj.rel.BuiltinAggregation
BuiltinAggregation.Count, BuiltinAggregation.MinMax, BuiltinAggregation.Sum
 
Field Summary
(package private)  OJClass[] argTypes
           
(package private) static OJClass type
           
 
Constructor Summary
(package private) BuiltinAggregation.Count()
           
 
Method Summary
 boolean canMerge()
          Whether this aggregation can merge together two accumulators.
(package private)  String getName()
           
 OJClass[] getParameterTypes()
           
 OJClass getReturnType()
           
 OJClass[] getStartParameterTypes()
           
 void implementNext(RelImplementor implementor, SaffronRel rel, Expression accumulator, int[] args)
          Generates (into the current statement list, gleaned by calling implementor's RelImplementor.getStatementList() method) the piece of code which gets called each time an extra row is seen.
 Expression implementResult(Expression accumulator)
          Generates the expression which gets called when a total is complete.
 Expression implementStart(RelImplementor implementor, SaffronRel rel, int[] args)
          Generates the expression which gets called when a new total is created.
 
Methods inherited from class net.sf.saffron.oj.rel.BuiltinAggregation
count, count, count, count, create, getParameterTypes, getReturnType, implementMerge, implementStartAndNext, lookup, max, max, max, min, min, min, sum, sum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

static final OJClass type

argTypes

OJClass[] argTypes
Constructor Detail

BuiltinAggregation.Count

BuiltinAggregation.Count()
Method Detail

getParameterTypes

public OJClass[] getParameterTypes()
Specified by:
getParameterTypes in class BuiltinAggregation

getReturnType

public OJClass getReturnType()
Specified by:
getReturnType in class BuiltinAggregation

getStartParameterTypes

public OJClass[] getStartParameterTypes()

canMerge

public boolean canMerge()
Description copied from interface: Aggregation
Whether this aggregation can merge together two accumulators. count can (you just add the accumulators); avg and Nth cannot.

Specified by:
canMerge in interface Aggregation
Overrides:
canMerge in class BuiltinAggregation

implementNext

public void implementNext(RelImplementor implementor,
                          SaffronRel rel,
                          Expression accumulator,
                          int[] args)
Description copied from interface: Aggregation
Generates (into the current statement list, gleaned by calling implementor's RelImplementor.getStatementList() method) the piece of code which gets called each time an extra row is seen. For sum(x), this looks like ((net.sf.saffron.runtime.Holder.int_Holder) accumulator).value += x.

Parameters:
implementor - a callback object which knows how to generate things
rel - the relational expression which is generating this code
accumulator - the expression which holds the total
args - the ordinals of the fields of the child row which are arguments to this aggregation

implementResult

public Expression implementResult(Expression accumulator)
Description copied from interface: Aggregation
Generates the expression which gets called when a total is complete. For sum(x), this looks like ((saffron.runtime.Holder.int_Holder) accumulator).value.


implementStart

public Expression implementStart(RelImplementor implementor,
                                 SaffronRel rel,
                                 int[] args)
Description copied from interface: Aggregation
Generates the expression which gets called when a new total is created. For sum(x), this looks like new saffron.runtime.Holder.int_Holder(0).


getName

String getName()
Specified by:
getName in class BuiltinAggregation

SourceForge.net_Logo