U
- Type of the value, which is passed to update method of a SummaryS
- Type of the UpdatableSummary<U>public class UpdatableSketch<U,S extends UpdatableSummary<U>> extends Sketch<S>
PREAMBLE_LONGS
Constructor and Description |
---|
UpdatableSketch(int nomEntries,
int lgResizeFactor,
float samplingProbability,
SummaryFactory<S> summaryFactory)
This is to create a new instance of an UpdatableQuickSelectSketch.
|
UpdatableSketch(org.apache.datasketches.memory.Memory srcMem,
SummaryDeserializer<S> deserializer,
SummaryFactory<S> summaryFactory)
This is to create an instance of a sketch given a serialized form
|
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(byte[] key,
U value)
Updates this sketch with a byte[] key and U value.
|
void |
update(double key,
U value)
Updates this sketch with a double key and U value.
|
void |
update(int[] key,
U value)
Updates this sketch with a int[] key and U value.
|
void |
update(long[] key,
U value)
Updates this sketch with a long[] key and U value.
|
void |
update(long key,
U value)
Updates this sketch with a long key and U value.
|
void |
update(String key,
U value)
Updates this sketch with a String key and U value.
|
getEstimate, getEstimate, getLowerBound, getLowerBound, getTheta, getThetaLong, getUpperBound, getUpperBound, isEmpty, isEstimationMode, toString
public UpdatableSketch(int nomEntries, int lgResizeFactor, float samplingProbability, SummaryFactory<S> summaryFactory)
nomEntries
- Nominal number of entries. Forced to the nearest power of 2 greater than
or equal to the given value.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 ProbabilitysummaryFactory
- An instance of a SummaryFactory.public UpdatableSketch(org.apache.datasketches.memory.Memory srcMem, SummaryDeserializer<S> deserializer, SummaryFactory<S> summaryFactory)
srcMem
- Memory object with data of a serialized UpdatableSketchdeserializer
- instance of SummaryDeserializersummaryFactory
- instance of SummaryFactorypublic void update(long key, U value)
key
- The given long keyvalue
- The given U valuepublic void update(double key, U value)
key
- The given double keyvalue
- The given U valuepublic void update(String key, U value)
key
- The given String keyvalue
- The given U valuepublic void update(byte[] key, U value)
key
- The given byte[] keyvalue
- The given U valuepublic void update(int[] key, U value)
key
- The given int[] keyvalue
- The given U valuepublic void update(long[] key, U value)
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.