public final class SingleItemSketch extends CompactSketch
| Modifier and Type | Method and Description |
|---|---|
static SingleItemSketch |
create(byte[] data)
Create this sketch with the given byte array.
|
static SingleItemSketch |
create(byte[] data,
long seed)
Create this sketch with the given byte array and a seed.
|
static SingleItemSketch |
create(char[] data)
Create this sketch with the given char array.
|
static SingleItemSketch |
create(char[] data,
long seed)
Create this sketch with the given char array and a seed.
|
static SingleItemSketch |
create(double datum)
Create this sketch with the given double (or float) datum.
|
static SingleItemSketch |
create(double datum,
long seed)
Create this sketch with the given double (or float) datum and a seed.
|
static SingleItemSketch |
create(int[] data)
Create this sketch with the given integer array.
|
static SingleItemSketch |
create(int[] data,
long seed)
Create this sketch with the given integer array and a seed.
|
static SingleItemSketch |
create(long datum)
Create this sketch with a long.
|
static SingleItemSketch |
create(long[] data)
Create this sketch with the given long array.
|
static SingleItemSketch |
create(long[] data,
long seed)
Create this sketch with the given long array and a seed.
|
static SingleItemSketch |
create(long datum,
long seed)
Create this sketch with a long and a seed.
|
static SingleItemSketch |
create(String datum)
Create this sketch with the given String.
|
static SingleItemSketch |
create(String datum,
long seed)
Create this sketch with the given String and a seed.
|
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.
|
double |
getLowerBound(int numStdDev)
Gets the approximate lower error bound given the specified number of Standard Deviations.
|
int |
getRetainedEntries(boolean valid)
Returns the number of entries that have been retained by the sketch.
|
long |
getThetaLong()
Gets the value of theta as a long
|
double |
getUpperBound(int numStdDev)
Gets the approximate upper error bound given the specified number of Standard Deviations.
|
boolean |
hasMemory()
Returns true if this sketch's data structure is backed by Memory or WritableMemory.
|
static SingleItemSketch |
heapify(org.apache.datasketches.memory.Memory srcMem)
Creates a SingleItemSketch on the heap given a SingleItemSketch Memory image and assumes the
DEFAULT_UPDATE_SEED.
|
static SingleItemSketch |
heapify(org.apache.datasketches.memory.Memory srcMem,
long seed)
Creates a SingleItemSketch on the heap given a SingleItemSketch Memory image and a seed.
|
boolean |
isDirect()
Returns true if the this sketch's internal data structure is backed by direct (off-heap)
Memory.
|
boolean |
isEmpty()
|
boolean |
isOrdered()
Returns true if internal cache is ordered
|
HashIterator |
iterator()
Returns a HashIterator that can be used to iterate over the retained hash values of the
Theta sketch.
|
byte[] |
toByteArray()
Serialize this sketch to a byte array form.
|
compact, compact, getFamily, isCompactgetMaxCompactSketchBytes, getMaxUpdateSketchBytes, getRetainedEntries, getSerializationVersion, getTheta, isEstimationMode, isSameResource, toString, toString, toString, toString, wrap, wrappublic static SingleItemSketch heapify(org.apache.datasketches.memory.Memory srcMem)
srcMem - the Memory to be heapified. It must be a least 16 bytes.public static SingleItemSketch heapify(org.apache.datasketches.memory.Memory srcMem, long seed)
srcMem - the Memory to be heapifiedseed - a given hash seedpublic static SingleItemSketch create(long datum)
datum - The given long datum.public static SingleItemSketch create(double datum)
datum - The given double datum.public static SingleItemSketch create(String datum)
Note: this will not produce the same hash values as the create(char[])
method and will generally be a little slower depending on the complexity of the UTF8 encoding.
datum - The given String.public static SingleItemSketch create(byte[] data)
data - The given byte array.public static SingleItemSketch create(char[] data)
Note: this will not produce the same output hash values as the create(String)
method but will be a little faster as it avoids the complexity of the UTF8 encoding.
data - The given char array.public static SingleItemSketch create(int[] data)
data - The given int array.public static SingleItemSketch create(long[] data)
data - The given long array.public static SingleItemSketch create(long datum, long seed)
datum - The given long datum.seed - used to hash the given value.public static SingleItemSketch create(double datum, long seed)
datum - The given double datum.seed - used to hash the given value.public static SingleItemSketch create(String datum, long seed)
Note: this will not produce the same output hash values as the create(char[])
method and will generally be a little slower depending on the complexity of the UTF8 encoding.
datum - The given String.seed - used to hash the given value.public static SingleItemSketch create(byte[] data, long seed)
data - The given byte array.seed - used to hash the given value.public static SingleItemSketch create(char[] data, long seed)
Note: this will not produce the same output hash values as the create(String)
method but will be a little faster as it avoids the complexity of the UTF8 encoding.
data - The given char array.seed - used to hash the given value.public static SingleItemSketch create(int[] data, long seed)
data - The given int array.seed - used to hash the given value.public static SingleItemSketch create(long[] data, long seed)
data - The given long array.seed - used to hash the given value.public int getCountLessThanTheta(double theta)
SketchgetCountLessThanTheta in class Sketchtheta - the given theta as a double between zero and one.public int getCurrentBytes(boolean compact)
SketchgetCurrentBytes in class Sketchcompact - if true, returns the bytes required for compact form.
If this sketch is already in compact form this parameter is ignored.public double getEstimate()
SketchgetEstimate in class Sketchpublic HashIterator iterator()
Sketchpublic double getLowerBound(int numStdDev)
SketchgetLowerBound in class SketchnumStdDev - See Number of Standard Deviationspublic int getRetainedEntries(boolean valid)
SketchgetRetainedEntries in class Sketchvalid - 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 long getThetaLong()
SketchgetThetaLong in class Sketchpublic double getUpperBound(int numStdDev)
SketchgetUpperBound in class SketchnumStdDev - See Number of Standard Deviationspublic boolean hasMemory()
Sketchpublic boolean isDirect()
Sketchpublic boolean isEmpty()
Sketchpublic boolean isOrdered()
Sketchpublic byte[] toByteArray()
SketchtoByteArray in class SketchCopyright © 2015–2020 The Apache Software Foundation. All rights reserved.