public abstract class UpdateSketch extends Sketch
| Modifier and Type | Method and Description |
|---|---|
static UpdateSketchBuilder |
builder()
Returns a new builder
|
CompactSketch |
compact()
Converts this UpdateSketch to an ordered CompactSketch on the Java heap.
|
CompactSketch |
compact(boolean dstOrdered,
Memory dstMem)
Convert this UpdateSketch to a CompactSketch in the chosen form.
|
abstract ResizeFactor |
getResizeFactor()
Returns the configured ResizeFactor
|
boolean |
isCompact()
Returns true if this sketch is in compact form.
|
abstract boolean |
isEmpty()
|
boolean |
isOrdered()
Returns true if internal cache is ordered
|
abstract UpdateSketch |
rebuild()
Rebuilds the hash table to remove dirty values or to reduce the size
to nominal entries.
|
abstract void |
reset()
Resets this sketch back to a virgin empty state.
|
UpdateReturnState |
update(byte[] data)
Present this sketch with the given byte array.
|
UpdateReturnState |
update(char[] data)
Present this sketch with the given char array.
|
UpdateReturnState |
update(double datum)
Present this sketch with the given double (or float) datum.
|
UpdateReturnState |
update(int[] data)
Present this sketch with the given integer array.
|
UpdateReturnState |
update(long datum)
Present this sketch with a long.
|
UpdateReturnState |
update(long[] data)
Present this sketch with the given long array.
|
UpdateReturnState |
update(String datum)
Present this sketch with the given String.
|
getCountLessThanTheta, getCurrentBytes, getEstimate, getFamily, getLowerBound, getMaxCompactSketchBytes, getMaxUpdateSketchBytes, getRetainedEntries, getRetainedEntries, getSerializationVersion, getTheta, getUpperBound, heapify, heapify, isDirect, isEstimationMode, toByteArray, toString, toString, wrap, wrappublic abstract boolean isEmpty()
Sketchpublic boolean isCompact()
Sketchpublic boolean isOrdered()
Sketchpublic static final UpdateSketchBuilder builder()
public abstract void reset()
public CompactSketch compact(boolean dstOrdered, Memory dstMem)
This compacting process converts the hash table form of an UpdateSketch to a simple list of the valid hash values from the hash table. Any hash values equal to or greater than theta will be discarded. The number of valid values remaining in the Compact Sketch depends on a number of factors, but may be larger or smaller than Nominal Entries (or k). It will never exceed 2k. If it is critical to always limit the size to no more than k, then rebuild() should be called on the UpdateSketch prior to this.
dstOrdered - See Destination OrdereddstMem - See Destination Memory.public CompactSketch compact()
public abstract UpdateSketch rebuild()
public abstract ResizeFactor getResizeFactor()
public UpdateReturnState update(long datum)
datum - The given long datum.public UpdateReturnState update(double datum)
datum - The given double datum.public UpdateReturnState update(String datum)
Note: this will not produce the same output hash values as the update(char[])
method and will generally be a little slower depending on the complexity of the UTF8 encoding.
datum - The given String.public UpdateReturnState update(byte[] data)
data - The given byte array.public UpdateReturnState update(char[] data)
Note: this will not produce the same output hash values as the update(String)
method but will be a little faster as it avoids the complexity of the UTF8 encoding.
data - The given char array.public UpdateReturnState update(int[] data)
data - The given int array.public UpdateReturnState update(long[] data)
data - The given long array.Copyright © 2015–2017 Yahoo! Inc.. All rights reserved.