public class IntegerSketch extends UpdatableSketch<Integer,IntegerSummary>
PREAMBLE_LONGS
Constructor and Description |
---|
IntegerSketch(int lgK,
IntegerSummary.Mode mode)
Constructs this sketch with given lgK.
|
IntegerSketch(int lgK,
int lgResizeFactor,
float samplingProbability,
IntegerSummary.Mode mode)
Creates this sketch with the following parameters:
|
IntegerSketch(org.apache.datasketches.memory.Memory mem,
IntegerSummary.Mode mode)
Constructs this sketch from a Memory image, which must be from an IntegerSketch, and
usually with data.
|
Modifier and Type | Method and Description |
---|---|
CompactSketch<S> |
compact()
Converts the current state of the sketch into a compact sketch
|
int |
getCurrentCapacity()
Get current capacity
|
int |
getLgK()
Get log_base2 of Nominal Entries
|
int |
getNominalEntries()
Get configured nominal number of entries
|
ResizeFactor |
getResizeFactor()
Get configured resize factor
|
int |
getRetainedEntries() |
float |
getSamplingProbability()
Get configured sampling probability
|
protected void |
insertSummary(int index,
S summary) |
SketchIterator<S> |
iterator()
Returns a SketchIterator
|
void |
reset()
Resets this sketch an empty state.
|
byte[] |
toByteArray()
This is to serialize an instance to a byte array.
|
void |
trim()
Rebuilds reducing the actual number of entries to the nominal number of entries if needed
|
void |
update(long key,
Integer value)
Updates this sketch with a long key and U value.
|
void |
update(String key,
Integer value)
Updates this sketch with a String key and U value.
|
update, update, update, update
getEstimate, getEstimate, getLowerBound, getLowerBound, getTheta, getThetaLong, getUpperBound, getUpperBound, isEmpty, isEstimationMode, toString
public IntegerSketch(int lgK, IntegerSummary.Mode mode)
lgK
- Log_base2 of Nominal Entries.
See Nominal Entriesmode
- The IntegerSummary mode to be usedpublic IntegerSketch(int lgK, int lgResizeFactor, float samplingProbability, IntegerSummary.Mode mode)
lgK
- Log_base2 of Nominal Entries.lgResizeFactor
- log2(resizeFactor) - value from 0 to 3:
0 - no resizing (max size allocated), 1 - double internal hash table each time it reaches a threshold 2 - grow four times 3 - grow eight times (default)
samplingProbability
- See Sampling Probabilitymode
- The IntegerSummary mode to be usedpublic IntegerSketch(org.apache.datasketches.memory.Memory mem, IntegerSummary.Mode mode)
mem
- the given Memorymode
- The IntegerSummary mode to be usedpublic void update(String key, Integer value)
UpdatableSketch
update
in class UpdatableSketch<Integer,IntegerSummary>
key
- The given String keyvalue
- The given U valuepublic void update(long key, Integer value)
UpdatableSketch
update
in class UpdatableSketch<Integer,IntegerSummary>
key
- The given long keyvalue
- The given U valuepublic int getRetainedEntries()
getRetainedEntries
in class Sketch<S extends Summary>
public int getNominalEntries()
public int getLgK()
public float getSamplingProbability()
public int getCurrentCapacity()
public ResizeFactor getResizeFactor()
public void trim()
public void reset()
public CompactSketch<S> compact()
public byte[] toByteArray()
Sketch
toByteArray
in class Sketch<S extends Summary>
protected void insertSummary(int index, S summary)
public SketchIterator<S> iterator()
Sketch
Copyright © 2015–2021 The Apache Software Foundation. All rights reserved.