com.espertech.esper.client.util
Class CountMinSketchAgentStringUTF16

java.lang.Object
  extended by com.espertech.esper.client.util.CountMinSketchAgentStringUTF16
All Implemented Interfaces:
CountMinSketchAgent

public class CountMinSketchAgentStringUTF16
extends java.lang.Object
implements CountMinSketchAgent

Count-min sketch agent that handles String-type values and uses UTF-16 encoding to transform strings to byte-array and back.


Constructor Summary
CountMinSketchAgentStringUTF16()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountMinSketchAgentStringUTF16

public CountMinSketchAgentStringUTF16()
Method Detail

getAcceptableValueTypes

public java.lang.Class[] getAcceptableValueTypes()
Description copied from interface: CountMinSketchAgent
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.

Specified by:
getAcceptableValueTypes in interface CountMinSketchAgent
Returns:
class array of acceptable type

add

public void add(CountMinSketchAgentContextAdd ctx)
Description copied from interface: CountMinSketchAgent
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.

Specified by:
add in interface CountMinSketchAgent
Parameters:
ctx - contains value to add as well as the state

estimate

public java.lang.Long estimate(CountMinSketchAgentContextEstimate ctx)
Description copied from interface: CountMinSketchAgent
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.

Specified by:
estimate in interface CountMinSketchAgent
Parameters:
ctx - contains value to query as well as the state
Returns:
estimated count

fromBytes

public java.lang.Object fromBytes(CountMinSketchAgentContextFromBytes ctx)
Description copied from interface: CountMinSketchAgent
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.

Specified by:
fromBytes in interface CountMinSketchAgent
Parameters:
ctx - value object and state
Returns:
value object

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