saffron
Class BuiltinAggregation.MinMax
java.lang.Object
  |
  +--saffron.BuiltinAggregation
        |
        +--saffron.BuiltinAggregation.MinMax
- All Implemented Interfaces: 
- Aggregation
- Enclosing class:
- BuiltinAggregation
- static class BuiltinAggregation.MinMax- extends BuiltinAggregation
MinMax implements the "min" and "max" aggregator functions,
 returning the returns the smallest/largest of the values which go into
 it. There are 3 forms:
 - sum(primitive type)
- values are compared using <
- sum(Comparable)
- values are compared using Comparable.compareTo(java.lang.Object)
- sum(Comparator,Object)
- the Comparator.compare(java.lang.Object, java.lang.Object)method of the comparator
     is used to compare pairs of objects. The comparator is a startup
     argument, and must therefore be constant for the duration of the
     aggregation.
 
 
 
 
 
| Methods inherited from class saffron.BuiltinAggregation | 
| count, count, count, count, create, 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 | 
 
argTypes
private OJClass[] argTypes
isMin
private boolean isMin
kind
private int kind
MINMAX_INVALID
static final int MINMAX_INVALID
- See Also:
- Constant Field Values
MINMAX_PRIMITIVE
static final int MINMAX_PRIMITIVE
- See Also:
- Constant Field Values
MINMAX_COMPARABLE
static final int MINMAX_COMPARABLE
- See Also:
- Constant Field Values
MINMAX_COMPARATOR
static final int MINMAX_COMPARATOR
- See Also:
- Constant Field Values
BuiltinAggregation.MinMax
BuiltinAggregation.MinMax(OJClass[] argTypes,
                          boolean isMin)
getKind
static int getKind(OJClass[] argTypes)
- 
 
getName
String getName()
- 
- Specified by:
- getNamein class- BuiltinAggregation
 
- 
 
canMerge
public boolean canMerge()
- Description copied from interface: Aggregation
- Whether this aggregation can merge together two
 accumulators. countcan (you just add the accumulators);avgandNthcannot.
 
- 
- Specified by:
- canMergein interface- Aggregation
- Overrides:
- canMergein class- BuiltinAggregation
 
- 
 
getReturnType
public OJClass getReturnType()
- 
 
getStartParameterTypes
public OJClass[] getStartParameterTypes()
- 
 
getParameterTypes
public OJClass[] getParameterTypes()
- 
 
implementStart
public Expression implementStart(Implementor implementor,
                                 Rel 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 likenew
 saffron.runtime.Holder.int_Holder(0).
 
- 
 
implementNext
public void implementNext(Implementor implementor,
                          Rel rel,
                          Expression accumulator,
                          int[] args)
- Description copied from interface: Aggregation
- Generates (into the current statement list, gleaned by calling
 implementor'sImplementor.getStatementList()method) the piece of code
 which gets called each time an extra row is seen. Forsum(x), this looks like((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.
 
-