com.espertech.esper.client.util
Interface CountMinSketchAgent

All Known Implementing Classes:
CountMinSketchAgentStringUTF16

public interface CountMinSketchAgent

For use with Count-min sketch aggregation functions: The agent implementation encapsulates transformation of value objects to byte-array and back (when needed), and may override or provide custom behavior.


Method Summary
 void add(CountMinSketchAgentContextAdd ctx)
          Add a value to the Count-min sketch.
 java.lang.Long estimate(CountMinSketchAgentContextEstimate ctx)
          Return the estimated count for a given value.
 java.lang.Object fromBytes(CountMinSketchAgentContextFromBytes ctx)
          Return the value object for a given byte-array, for use with top-K.
 java.lang.Class[] getAcceptableValueTypes()
          Returns an array of types that the agent can handle, for validation purposes.
 

Method Detail

getAcceptableValueTypes

java.lang.Class[] getAcceptableValueTypes()
Returns an array of types that the agent can handle, for validation purposes. For example, an agent that accepts byte-array type values should return "new Class[] {String.class}". Interfaces and supertype classes can also be part of the class array.

Returns:
class array of acceptable type

add

void add(CountMinSketchAgentContextAdd ctx)
Add a value to the Count-min sketch. Implementations typically check for null value, convert the value object to a byte-array and invoke a method on the state object to add the byte-array value.

Parameters:
ctx - contains value to add as well as the state

estimate

java.lang.Long estimate(CountMinSketchAgentContextEstimate ctx)
Return the estimated count for a given value. Implementations typically check for null value, convert the value object to a byte-array and invoke a method on the state object to retrieve a count.

Parameters:
ctx - contains value to query as well as the state
Returns:
estimated count

fromBytes

java.lang.Object fromBytes(CountMinSketchAgentContextFromBytes ctx)
Return the value object for a given byte-array, for use with top-K. Implementations typically simply convert a byte-array into a value object.

Parameters:
ctx - value object and state
Returns:
value object

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com