Package org.apache.datasketches.quantiles

# Class DoublesSketchBuilder

java.lang.Object
org.apache.datasketches.quantiles.DoublesSketchBuilder

public class DoublesSketchBuilder extends Object
For building a new quantiles DoublesSketch.

Author:
  Lee Rhodes

## Constructor Summary

Constructors
Constructor
Description
`DoublesSketchBuilder()`
Constructor for a new DoublesSketchBuilder.

## Method Summary

Modifier and Type
Method
Description
`UpdateDoublesSketch`
`build()`
Returns an UpdateDoublesSketch with the current configuration of this Builder.
`UpdateDoublesSketch`
`build(org.apache.datasketches.memory.WritableMemory dstMem)`
Returns a quantiles UpdateDoublesSketch with the current configuration of this builder and the specified backing destination Memory store.
`int`
`getK()`
Gets the current configured k
`DoublesSketchBuilder`
`setK(int k)`
Sets the parameter k that determines the accuracy and size of the sketch.
`String`
`toString()`
Creates a human readable string that describes the current configuration of this builder.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DoublesSketchBuilder

public DoublesSketchBuilder()
Constructor for a new DoublesSketchBuilder. The default configuration is

- k: 128. This produces a normalized rank error of about 1.7%
- Memory: null

## Method Details

### setK

public DoublesSketchBuilder setK(int k)
Sets the parameter k that determines the accuracy and size of the sketch.

Parameters:
  `k` - determines the accuracy and size of the sketch. It is recommended that k be a power of 2 to enable unioning of sketches with different k. It is only possible to union from larger k to smaller k.
Returns:
  this builder

### getK

public int getK()
Gets the current configured k

Returns:
  the current configured k

### build

public UpdateDoublesSketch build()
Returns an UpdateDoublesSketch with the current configuration of this Builder.

Returns:
  a UpdateDoublesSketch

### build

public UpdateDoublesSketch build(org.apache.datasketches.memory.WritableMemory dstMem)
Returns a quantiles UpdateDoublesSketch with the current configuration of this builder and the specified backing destination Memory store.

Parameters:
  `dstMem` - destination memory for use by the sketch
Returns:
  an UpdateDoublesSketch

### toString

public String toString()
Creates a human readable string that describes the current configuration of this builder.

Overrides:
  `toString` in class `Object`