Count
CountAggregate 实现了“全部计数”聚合。
类定义
public static class CountAggregate implements Aggregate
{
public void initialize(Object val)
{
count = 1;
}
public void accumulate(Object val)
{
count += 1;
}
public Object result()
{
return new Long(count);
}
public void merge(Aggregate other)
{
count += ((CountAggregate)other).count;
}
long count;
}