# Class QuantilesDoublesSketchBuilder

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

public class QuantilesDoublesSketchBuilder extends Object
For building a new quantiles QuantilesDoublesSketch.

Author:
  Lee Rhodes

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`UpdatableQuantilesDoublesSketch`
`build()`
Returns an UpdatableQuantilesDoublesSketch with the current configuration of this Builder.
`UpdatableQuantilesDoublesSketch`
`build(MemorySegment dstSeg)`
Returns a UpdatableQuantilesDoublesSketch with the current configuration of this builder and the specified backing destination MemorySegment store that can grow.
`UpdatableQuantilesDoublesSketch`
`build(MemorySegment dstSeg, MemorySegmentRequest mSegReq)`
Returns a UpdatableQuantilesDoublesSketch with the current configuration of this builder and the specified backing destination MemorySegment store that can grow.
`int`
`getK()`
Gets the current configured k
`QuantilesDoublesSketchBuilder`
`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 Object

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

## Constructor Details

### QuantilesDoublesSketchBuilder

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

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

## Method Details

### setK

public QuantilesDoublesSketchBuilder 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 UpdatableQuantilesDoublesSketch build()
Returns an UpdatableQuantilesDoublesSketch with the current configuration of this Builder.

Returns:
  a UpdatableQuantilesDoublesSketch

### build

public UpdatableQuantilesDoublesSketch build(MemorySegment dstSeg)
Returns a UpdatableQuantilesDoublesSketch with the current configuration of this builder and the specified backing destination MemorySegment store that can grow.

Parameters:
  `dstSeg` - destination MemorySegment for use by the sketch
Returns:
  an UpdatableQuantilesDoublesSketch

### build

public UpdatableQuantilesDoublesSketch build(MemorySegment dstSeg, MemorySegmentRequest mSegReq)
Returns a UpdatableQuantilesDoublesSketch with the current configuration of this builder and the specified backing destination MemorySegment store that can grow.

Parameters:
  `dstSeg` - destination MemorySegment for use by the sketch
  `mSegReq` - the MemorySegmentRequest used if the given MemorySegment needs to expand. Otherwise, it can be null and the default MemorySegmentRequest will be used.
Returns:
  an UpdatableQuantilesDoublesSketch

### toString

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

Overrides:
  `toString` in class `Object`