Package org.apache.datasketches.tuple
Class UpdatableSketchBuilder<U,S extends UpdatableSummary<U>>
- java.lang.Object
-
- org.apache.datasketches.tuple.UpdatableSketchBuilder<U,S>
-
- Type Parameters:
U
- Type of update valueS
- Type of Summary
public class UpdatableSketchBuilder<U,S extends UpdatableSummary<U>> extends Object
For building a new generic tuple UpdatableSketch
-
-
Constructor Summary
Constructors Constructor Description UpdatableSketchBuilder(SummaryFactory<S> summaryFactory)
Creates an instance of UpdatableSketchBuilder with default parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdatableSketch<U,S>
build()
Returns an UpdatableSketch with the current configuration of this Builder.void
reset()
Resets the Nominal Entries, Resize Factor and Sampling Probability to their default values.UpdatableSketchBuilder<U,S>
setNominalEntries(int nomEntries)
This is to set the nominal number of entries.UpdatableSketchBuilder<U,S>
setResizeFactor(ResizeFactor resizeFactor)
This is to set the resize factor.UpdatableSketchBuilder<U,S>
setSamplingProbability(float samplingProbability)
This is to set sampling probability.
-
-
-
Constructor Detail
-
UpdatableSketchBuilder
public UpdatableSketchBuilder(SummaryFactory<S> summaryFactory)
Creates an instance of UpdatableSketchBuilder with default parameters- Parameters:
summaryFactory
- An instance of SummaryFactory.
-
-
Method Detail
-
setNominalEntries
public UpdatableSketchBuilder<U,S> setNominalEntries(int nomEntries)
This is to set the nominal number of entries.- Parameters:
nomEntries
- Nominal number of entries. Forced to the nearest power of 2 greater than or equal to the given value.- Returns:
- this UpdatableSketchBuilder
-
setResizeFactor
public UpdatableSketchBuilder<U,S> setResizeFactor(ResizeFactor resizeFactor)
This is to set the resize factor. Value of X1 means that the maximum capacity is allocated from the start. Default resize factor is X8.- Parameters:
resizeFactor
- value of X1, X2, X4 or X8- Returns:
- this UpdatableSketchBuilder
-
setSamplingProbability
public UpdatableSketchBuilder<U,S> setSamplingProbability(float samplingProbability)
This is to set sampling probability. Default probability is 1.- Parameters:
samplingProbability
- sampling probability from 0 to 1- Returns:
- this UpdatableSketchBuilder
-
build
public UpdatableSketch<U,S> build()
Returns an UpdatableSketch with the current configuration of this Builder.- Returns:
- an UpdatableSketch
-
reset
public void reset()
Resets the Nominal Entries, Resize Factor and Sampling Probability to their default values. The assignment of U and S remain the same.
-
-