|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--saffron.BuiltinAggregation
BuiltinAggregation is a basic aggregator for which special code
is generated.
| Nested Class Summary | |
(package private) static class |
BuiltinAggregation.Count
Count is an aggregator which returns the number of rows
which have gone into it. |
(package private) static class |
BuiltinAggregation.MinMax
MinMax implements the "min" and "max" aggregator functions,
returning the returns the smallest/largest of the values which go into
it. |
(package private) static class |
BuiltinAggregation.Sum
Sum is an aggregator which returns the sum of the values
which go into it. |
| Constructor Summary | |
BuiltinAggregation()
|
|
| Method Summary | |
boolean |
canMerge()
Whether this aggregation can merge together two accumulators. |
static int |
count()
|
static int |
count(double v)
|
static int |
count(int v)
|
static int |
count(Object v)
|
static BuiltinAggregation |
create(String name,
OJClass[] argTypes)
Creates a BuiltinAggregation with a given name and argument
types. |
(package private) abstract String |
getName()
|
void |
implementMerge(Implementor implementor,
Rel rel,
Expression accumulator,
Expression otherAccumulator)
Generates (into the current statement list, gleaned by calling implementor's Implementor.getStatementList() method) code to merge two
accumulators. |
Expression |
implementStartAndNext(Implementor implementor,
Rel rel,
int[] args)
This is a default implementation of Aggregation.implementStartAndNext(saffron.opt.Implementor, saffron.rel.Rel, int[]); particular derived classes may do
better. |
static OJMethod |
lookup(String name,
OJClass[] argTypes)
Returns the builtin aggregator with a given name, if there is one. |
static double |
max(double v)
|
static double |
max(int v)
|
static int |
max(Object v)
|
static double |
min(double v)
|
static double |
min(int v)
|
static int |
min(Object v)
|
static double |
sum(double v)
|
static int |
sum(int v)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface saffron.rel.Aggregation |
getParameterTypes, getReturnType, implementNext, implementResult, implementStart |
| Constructor Detail |
public BuiltinAggregation()
| Method Detail |
abstract String getName()
public static BuiltinAggregation create(String name,
OJClass[] argTypes)
BuiltinAggregation with a given name and argument
types.
public boolean canMerge()
Aggregationcount can (you just add the accumulators);
avg and Nth cannot.
canMerge in interface Aggregation
public Expression implementStartAndNext(Implementor implementor,
Rel rel,
int[] args)
Aggregation.implementStartAndNext(saffron.opt.Implementor, saffron.rel.Rel, int[]); particular derived classes may do
better.
implementStartAndNext in interface Aggregation
public void implementMerge(Implementor implementor,
Rel rel,
Expression accumulator,
Expression otherAccumulator)
Aggregationimplementor's Implementor.getStatementList() method) code to merge two
accumulators. For sum(x), this looks like
((saffron.runtime.Holder.int_Holder) accumulator).value +=
((saffron.runtime.Holder.int_Holder) other).value.
The method is only called if Aggregation.canMerge() returns
true.
implementMerge in interface Aggregationimplementor - a callback object which knows how to generate thingsrel - the relational expression which is generating this codeaccumulator - the expression which holds the totalotherAccumulator - accumulator to merge in
public static OJMethod lookup(String name,
OJClass[] argTypes)
public static int count()
public static int count(Object v)
public static int count(int v)
public static int count(double v)
public static int sum(int v)
public static double sum(double v)
public static int min(Object v)
public static double min(int v)
public static double min(double v)
public static int max(Object v)
public static double max(int v)
public static double max(double v)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||