Top Description Inners Fields Constructors Methods
net.sf.ehcache.search.aggregator

public Class Sum

extends Object
implements AggregatorInstance<Long>
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.search.aggregator.AggregatorInstance
Imports
net.sf.ehcache.search.Attribute

Sums the results

Sum can be used with most numeric types

Author
Greg Luck

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract static class
Sum.Engine

Abstract super-class for all sum calculating engines.

Field Summary

Modifier and TypeField and Description
private final Attribute<?>
private Sum.Engine

Constructor Summary

AccessConstructor and Description
public
Sum(Attribute<?> attribute)

Method Summary

Modifier and TypeMethod and Description
public void
accept(Object
a single input value
input
)

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.accept.

Add the given value to the aggregator function

Note

null inputs are ignored

public Number
aggregateResult()

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.aggregateResult.

Retrieve the final result

Note

May return null if no input supplied

public Sum
createClone()

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.createClone.

Create a clone of this aggregator, detaching from its result
public Attribute<T>
getAttribute()

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.getAttribute.

Get the attribute to pass to aggregator
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeback to summary
private final Attribute<?> attribute
engineback to summary
private Sum.Engine engine

Constructor Detail

Sumback to summary
public Sum(Attribute<?> attribute)

Method Detail

acceptback to summary
public void accept(Object input) throws AggregatorException

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.accept.

Doc from net.sf.ehcache.search.aggregator.AggregatorInstance.accept.

Add the given value to the aggregator function

Note

null inputs are ignored

Parameters
input:Object

a single input value

Exceptions
AggregatorException:
if the function cannot be computed, possibly due to unsupported types
aggregateResultback to summary
public Number aggregateResult()

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.aggregateResult.

Doc from net.sf.ehcache.search.aggregator.AggregatorInstance.aggregateResult.

Retrieve the final result

Note

May return null if no input supplied

Returns:Number

aggregate result

createCloneback to summary
public Sum createClone()

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.createClone.

Doc from net.sf.ehcache.search.aggregator.AggregatorInstance.createClone.

Create a clone of this aggregator, detaching from its result

getAttributeback to summary
public Attribute<T> getAttribute()

Implements net.sf.ehcache.search.aggregator.AggregatorInstance.getAttribute.

Doc from net.sf.ehcache.search.aggregator.AggregatorInstance.getAttribute.

Get the attribute to pass to aggregator

Returns:Attribute<T>

attribute to aggregate (null if no attribute is applicable to function)

net.sf.ehcache.search.aggregator back to summary

pack-priv abstract Class Sum.Engine

extends Object
Class Inheritance
Known Direct Subclasses
net.sf.ehcache.search.aggregator.Sum.Engine.LongEngine, net.sf.ehcache.search.aggregator.Sum.Engine.FloatEngine, net.sf.ehcache.search.aggregator.Sum.Engine.DoubleEngine

Abstract super-class for all sum calculating engines.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Sum.Engine.DoubleEngine

A double based summing engine.

pack-priv static class
Sum.Engine.FloatEngine

A float based summing engine.

pack-priv static class
Sum.Engine.LongEngine

A long based summing engine.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
accept(Number
data value
input
)

Update the engine with the given value.

pack-priv static Sum.Engine

Returns:

type specific engine
create
(Number
initial value
value
)

Create a type specific engine using the given initial value.

pack-priv abstract Number

Returns:

engine result
result
()

Get the (current) result of this engine.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Engineback to summary
pack-priv Engine()

Method Detail

acceptback to summary
pack-priv abstract void accept(Number input) throws AggregatorException

Update the engine with the given value.

Parameters
input:Number

data value

createback to summary
pack-priv static Sum.Engine create(Number value)

Create a type specific engine using the given initial value.

Parameters
value:Number

initial value

Returns:Sum.Engine

type specific engine

resultback to summary
pack-priv abstract Number result()

Get the (current) result of this engine.

Returns:Number

engine result

net.sf.ehcache.search.aggregator back to summary

pack-priv Class Sum.Engine.DoubleEngine

extends Engine
Class Inheritance

A double based summing engine.

Field Summary

Modifier and TypeField and Description
private double

Constructor Summary

AccessConstructor and Description
pack-priv
DoubleEngine(double
initial value
value
)

Creates a new instance starting with an initial value

Method Summary

Modifier and TypeMethod and Description
pack-priv void
accept(Number
data value
input
)

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Update the engine with the given value.
pack-priv Number
result()

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.result.

Get the (current) result of this engine.
Inherited from net.sf.ehcache.search.aggregator.Sum.Engine:
create

Field Detail

sumback to summary
private double sum

Constructor Detail

DoubleEngineback to summary
pack-priv DoubleEngine(double value)

Creates a new instance starting with an initial value

Parameters
value:double

initial value

Method Detail

acceptback to summary
pack-priv void accept(Number input) throws AggregatorException

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Doc from net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Update the engine with the given value.

Parameters
input:Number

data value

Annotations
@Override
resultback to summary
pack-priv Number result()

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.result.

Doc from net.sf.ehcache.search.aggregator.Sum.Engine.result.

Get the (current) result of this engine.

Returns:Number

engine result

Annotations
@Override
net.sf.ehcache.search.aggregator back to summary

pack-priv Class Sum.Engine.FloatEngine

extends Engine
Class Inheritance

A float based summing engine.

Field Summary

Modifier and TypeField and Description
private float

Constructor Summary

AccessConstructor and Description
pack-priv
FloatEngine(float
initial value
value
)

Creates a new instance starting with an initial value

Method Summary

Modifier and TypeMethod and Description
pack-priv void
accept(Number
data value
input
)

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Update the engine with the given value.
pack-priv Number
result()

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.result.

Get the (current) result of this engine.
Inherited from net.sf.ehcache.search.aggregator.Sum.Engine:
create

Field Detail

sumback to summary
private float sum

Constructor Detail

FloatEngineback to summary
pack-priv FloatEngine(float value)

Creates a new instance starting with an initial value

Parameters
value:float

initial value

Method Detail

acceptback to summary
pack-priv void accept(Number input) throws AggregatorException

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Doc from net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Update the engine with the given value.

Parameters
input:Number

data value

Annotations
@Override
resultback to summary
pack-priv Number result()

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.result.

Doc from net.sf.ehcache.search.aggregator.Sum.Engine.result.

Get the (current) result of this engine.

Returns:Number

engine result

Annotations
@Override
net.sf.ehcache.search.aggregator back to summary

pack-priv Class Sum.Engine.LongEngine

extends Engine
Class Inheritance

A long based summing engine.

Field Summary

Modifier and TypeField and Description
private long

Constructor Summary

AccessConstructor and Description
pack-priv
LongEngine(long
initial value
value
)

Creates a new instance starting with an initial value

Method Summary

Modifier and TypeMethod and Description
pack-priv void
accept(Number
data value
input
)

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Update the engine with the given value.
pack-priv Number
result()

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.result.

Get the (current) result of this engine.
Inherited from net.sf.ehcache.search.aggregator.Sum.Engine:
create

Field Detail

sumback to summary
private long sum

Constructor Detail

LongEngineback to summary
pack-priv LongEngine(long value)

Creates a new instance starting with an initial value

Parameters
value:long

initial value

Method Detail

acceptback to summary
pack-priv void accept(Number input) throws AggregatorException

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Doc from net.sf.ehcache.search.aggregator.Sum.Engine.accept.

Update the engine with the given value.

Parameters
input:Number

data value

Annotations
@Override
resultback to summary
pack-priv Number result()

Implements abstract net.sf.ehcache.search.aggregator.Sum.Engine.result.

Doc from net.sf.ehcache.search.aggregator.Sum.Engine.result.

Get the (current) result of this engine.

Returns:Number

engine result

Annotations
@Override