net.sf.jagg
Class CountAggregator

java.lang.Object
  extended by net.sf.jagg.Aggregator
      extended by net.sf.jagg.CountAggregator

public class CountAggregator
extends Aggregator

This class represents the "count" aggregator over any values.

Since:
0.1.0
Author:
Randy Gettman

Field Summary
static java.lang.String COUNT_ALL
          Special pseudo-property indicating "count all", even nulls.
 
Fields inherited from class net.sf.jagg.Aggregator
PROP_SELF
 
Constructor Summary
CountAggregator(java.lang.String property)
          Constructs an CountAggregator that operates on the specified property.
 
Method Summary
 void init()
          Initialize the count to zero.
 void iterate(java.lang.Object value)
          Count the property if its value is non-null.
 void merge(Aggregator agg)
          Merge the given Aggregator into this one by adding the counts.
 CountAggregator replicate()
          Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.
 java.lang.Long terminate()
          Return the count.
 
Methods inherited from class net.sf.jagg.Aggregator
equals, getAggregator, getAggregator, getProperty, getValueFromProperty, hashCode, isInUse, setInUse, setProperty, terminateDoubleDouble, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COUNT_ALL

public static final java.lang.String COUNT_ALL
Special pseudo-property indicating "count all", even nulls.

See Also:
Constant Field Values
Constructor Detail

CountAggregator

public CountAggregator(java.lang.String property)
Constructs an CountAggregator that operates on the specified property.

Parameters:
property - Count this property's values.
Method Detail

replicate

public CountAggregator replicate()
Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.

Specified by:
replicate in class Aggregator
Returns:
An uninitialized copy of this Aggregator object.

init

public void init()
Initialize the count to zero.

Specified by:
init in class Aggregator

iterate

public void iterate(java.lang.Object value)
Count the property if its value is non-null. If the property is COUNT_ALL, then always count it, null or not.

Specified by:
iterate in class Aggregator
Parameters:
value - The value to aggregate.
See Also:
COUNT_ALL

merge

public void merge(Aggregator agg)
Merge the given Aggregator into this one by adding the counts.

Specified by:
merge in class Aggregator
Parameters:
agg - The Aggregator to merge into this one.

terminate

public java.lang.Long terminate()
Return the count.

Specified by:
terminate in class Aggregator
Returns:
The count as a Long.


Copyright © 2010-2013 jAgg Team. All Rights Reserved.