net.esper.eql.agg
Class DistinctValueAggregator

java.lang.Object
  extended by net.esper.eql.agg.DistinctValueAggregator
All Implemented Interfaces:
AggregationMethod

public class DistinctValueAggregator
extends Object
implements AggregationMethod

AggregationMethod for use on top of another aggregator that handles unique value aggregation (versus all-value aggregation) for the underlying aggregator.


Constructor Summary
DistinctValueAggregator(AggregationMethod inner, Class childType)
          Ctor.
 
Method Summary
 void enter(Object value)
          Apply the value as entering aggregation (entering window).
 Object getValue()
          Returns the current value held.
 Class getValueType()
          Returns the type of the current value.
 void leave(Object value)
          Apply the value as leaving aggregation (leaving window).
 AggregationMethod newAggregator(MethodResolutionService methodResolutionService)
          Make a new, initalized aggregation state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistinctValueAggregator

public DistinctValueAggregator(AggregationMethod inner,
                               Class childType)
Ctor.

Parameters:
inner - is the aggregator function computing aggregation values
childType - is the return type of the inner expression to aggregate, if any
Method Detail

enter

public void enter(Object value)
Description copied from interface: AggregationMethod
Apply the value as entering aggregation (entering window).

The value can be null since 'null' values may be counted as unique separate values.

Specified by:
enter in interface AggregationMethod
Parameters:
value - to add to aggregate

leave

public void leave(Object value)
Description copied from interface: AggregationMethod
Apply the value as leaving aggregation (leaving window).

The value can be null since 'null' values may be counted as unique separate values.

Specified by:
leave in interface AggregationMethod
Parameters:
value - to remove from aggregate

getValue

public Object getValue()
Description copied from interface: AggregationMethod
Returns the current value held.

Specified by:
getValue in interface AggregationMethod
Returns:
current value

getValueType

public Class getValueType()
Description copied from interface: AggregationMethod
Returns the type of the current value.

Specified by:
getValueType in interface AggregationMethod
Returns:
type of values held

newAggregator

public AggregationMethod newAggregator(MethodResolutionService methodResolutionService)
Description copied from interface: AggregationMethod
Make a new, initalized aggregation state.

Specified by:
newAggregator in interface AggregationMethod
Parameters:
methodResolutionService - for use in creating new aggregation method instances as a factory
Returns:
initialized copy of the aggregator