public abstract class Sketch extends Object
| Modifier and Type | Method and Description |
|---|---|
int |
getCountLessThanTheta(double theta)
Gets the number of hash values less than the given theta.
|
int |
getCurrentBytes(boolean compact)
Returns the number of storage bytes required for this Sketch in its current state.
|
double |
getEstimate()
Gets the unique count estimate.
|
abstract Family |
getFamily()
Returns the Family that this sketch belongs to
|
double |
getLowerBound(int numStdDev)
Gets the approximate lower error bound given the specified number of Standard Deviations.
|
static int |
getMaxCompactSketchBytes(int numberOfEntries)
Returns the maximum number of storage bytes required for a CompactSketch with the given
number of actual entries.
|
static int |
getMaxUpdateSketchBytes(int nomEntries)
Returns the maximum number of storage bytes required for an UpdateSketch with the given
number of nominal entries (power of 2).
|
int |
getRetainedEntries()
Returns the number of valid entries that have been retained by the sketch.
|
abstract int |
getRetainedEntries(boolean valid)
Returns the number of entries that have been retained by the sketch.
|
static int |
getSerializationVersion(Memory mem)
Returns the serialization version from the given Memory
|
double |
getTheta()
Gets the value of theta as a double with a value between zero and one
|
double |
getUpperBound(int numStdDev)
Gets the approximate upper error bound given the specified number of Standard Deviations.
|
static Sketch |
heapify(Memory srcMem)
Heapify takes the sketch image in Memory and instantiates an on-heap
Sketch using the
Default Update Seed.
|
static Sketch |
heapify(Memory srcMem,
long seed)
Heapify takes the sketch image in Memory and instantiates an on-heap
Sketch using the given seed.
|
abstract boolean |
isCompact()
Returns true if this sketch is in compact form.
|
abstract boolean |
isDirect()
Returns true if this sketch accesses its internal data using the Memory package
|
abstract boolean |
isEmpty()
|
boolean |
isEstimationMode()
Returns true if the sketch is Estimation Mode (as opposed to Exact Mode).
|
abstract boolean |
isOrdered()
Returns true if internal cache is ordered
|
abstract byte[] |
toByteArray()
Serialize this sketch to a byte array form.
|
String |
toString()
Returns a human readable summary of the sketch.
|
String |
toString(boolean sketchSummary,
boolean dataDetail,
int width,
boolean hexMode)
Gets a human readable listing of contents and summary of the given sketch.
|
static Sketch |
wrap(Memory srcMem)
Wrap takes the sketch image in Memory and refers to it directly.
|
static Sketch |
wrap(Memory srcMem,
long seed)
Wrap takes the sketch image in Memory and refers to it directly.
|
public double getEstimate()
public double getLowerBound(int numStdDev)
numStdDev - See Number of Standard Deviationspublic int getRetainedEntries()
public abstract int getRetainedEntries(boolean valid)
valid - if true, returns the number of valid entries, which are less than theta and used
for estimation.
Otherwise, return the number of all entries, valid or not, that are currently in the internal
sketch cache.public double getTheta()
public int getCountLessThanTheta(double theta)
theta - the given theta as a double between zero and one.public double getUpperBound(int numStdDev)
numStdDev - See Number of Standard Deviationspublic abstract boolean isEmpty()
public boolean isEstimationMode()
public abstract byte[] toByteArray()
public abstract Family getFamily()
public String toString()
public String toString(boolean sketchSummary, boolean dataDetail, int width, boolean hexMode)
sketchSummary - If true the sketch summary will be output at the end.dataDetail - If true, includes all valid hash values in the sketch.width - The number of columns of hash values. Default is 8.hexMode - If true, hashes will be output in hex.public static Sketch heapify(Memory srcMem)
srcMem - an image of a Sketch where the image seed hash matches the default seed hash.
See Memorypublic static Sketch heapify(Memory srcMem, long seed)
srcMem - an image of a Sketch where the image seed hash matches the given seed hash.
See Memoryseed - See Update Hash Seed.
Compact sketches store a 16-bit hash of the seed, but not the seed itself.public static Sketch wrap(Memory srcMem)
Util.DEFAULT_UPDATE_SEED.
Default Update Seed.srcMem - an image of a Sketch where the image seed hash matches the default seed hash.
See Memorypublic static Sketch wrap(Memory srcMem, long seed)
srcMem - an image of a Sketch where the image seed hash matches the given seed hash.
See Memoryseed - See Update Hash Seed.
Compact sketches store a 16-bit hash of the seed, but not the seed itself.public int getCurrentBytes(boolean compact)
compact - if true, returns the bytes required for compact form.
If this sketch is already in compact form this parameter is ignored.public static int getMaxCompactSketchBytes(int numberOfEntries)
numberOfEntries - the actual number of entries stored with the CompactSketch.public static int getMaxUpdateSketchBytes(int nomEntries)
nomEntries - Nominal Entres
This will become the ceiling power of 2 if it is not.public static int getSerializationVersion(Memory mem)
mem - the sketch Memorypublic abstract boolean isCompact()
public abstract boolean isOrdered()
public abstract boolean isDirect()
Copyright © 2015–2017 Yahoo! Inc.. All rights reserved.