saffron.ext
Class Nth

java.lang.Object
  |
  +--saffron.ext.Nth
All Implemented Interfaces:
AggregationExtender

public class Nth
extends Object
implements AggregationExtender

Nth is an example of a custom aggregation. It returns the the nth of a set of rows, or returns null (0 for a primitive type) if there are not that many rows. It implements the overloaded T aggregate(T) method for T = {int, double, Object}. There is a start, next, and result method for each.

Since:
11 February, 2002
Version:
$Id: //open/saffron/src/main/saffron/ext/Nth.java#1 $
Author:
jhyde

Nested Class Summary
private static class Nth.Holder_double
           
private static class Nth.Holder_int
           
private static class Nth.Holder_Object
           
 
Field Summary
private  int n
           
 
Fields inherited from interface saffron.AggregationExtender
METHOD_AGGREGATE, METHOD_MERGE, METHOD_NEXT, METHOD_RESULT, METHOD_START
 
Constructor Summary
Nth(int n)
           
 
Method Summary
 double aggregate(double value)
           
 int aggregate(int value)
           
 Object aggregate(Object value)
           
 Object next(double value, Object accumulator)
           
 Object next(int value, Object accumulator)
           
 Object next(Object value, Object accumulator)
           
 double result(double value, Object accumulator)
           
 int result(int value, Object accumulator)
           
 Object result(Object value, Object accumulator)
           
 Object start(double value)
           
 Object start(int value)
           
 Object start(Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

n

private int n
Constructor Detail

Nth

public Nth(int n)
Method Detail

aggregate

public int aggregate(int value)

start

public Object start(int value)

next

public Object next(int value,
                   Object accumulator)

result

public int result(int value,
                  Object accumulator)

aggregate

public double aggregate(double value)

start

public Object start(double value)

next

public Object next(double value,
                   Object accumulator)

result

public double result(double value,
                     Object accumulator)

aggregate

public Object aggregate(Object value)

start

public Object start(Object value)

next

public Object next(Object value,
                   Object accumulator)

result

public Object result(Object value,
                     Object accumulator)

SourceForge.net_Logo