Package net.sf.ehcache.search.aggregator
Class Sum
- java.lang.Object
-
- net.sf.ehcache.search.aggregator.Sum
-
- All Implemented Interfaces:
AggregatorInstance<java.lang.Long>
public class Sum extends java.lang.Object implements AggregatorInstance<java.lang.Long>
Sums the resultsSum can be used with most numeric types
- Author:
- Greg Luck
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(java.lang.Object input)Add the given value to the aggregator functionjava.lang.NumberaggregateResult()Retrieve the final resultSumcreateClone()Create a clone of this aggregator, detaching from its resultAttributegetAttribute()Get the attribute to pass to aggregator
-
-
-
Constructor Detail
-
Sum
public Sum(Attribute<?> attribute)
- Parameters:
attribute-
-
-
Method Detail
-
createClone
public Sum createClone()
Create a clone of this aggregator, detaching from its result- Specified by:
createClonein interfaceAggregatorInstance<java.lang.Long>- Returns:
-
accept
public void accept(java.lang.Object input) throws AggregatorExceptionAdd the given value to the aggregator functionNOTE: null inputs are ignored
- Specified by:
acceptin interfaceAggregatorInstance<java.lang.Long>- Parameters:
input- a single input value- Throws:
AggregatorException- if the function cannot be computed, possibly due to unsupported types
-
aggregateResult
public java.lang.Number aggregateResult()
Retrieve the final resultNOTE: May return null if no input supplied
- Specified by:
aggregateResultin interfaceAggregatorInstance<java.lang.Long>- Returns:
- aggregate result
-
getAttribute
public Attribute getAttribute()
Get the attribute to pass to aggregator- Specified by:
getAttributein interfaceAggregatorInstance<java.lang.Long>- Returns:
- attribute to aggregate (null if no attribute is applicable to function)
-
-