# Class UpdatableQuantilesDoublesSketch

java.lang.Object
org.apache.datasketches.quantiles.QuantilesDoublesSketch
org.apache.datasketches.quantiles.UpdatableQuantilesDoublesSketch

All Implemented Interfaces:
  `MemorySegmentStatus, QuantilesAPI, QuantilesDoublesAPI`

public abstract class UpdatableQuantilesDoublesSketch extends QuantilesDoublesSketch
Extends QuantilesDoubleSketch

Author:
  Jon Malkin

## Field Summary

### Fields inherited from interface QuantilesAPI

`EMPTY_MSG, MEM_REQ_SVR_NULL_MSG, NOT_SINGLE_ITEM_MSG, SELF_MERGE_MSG, TGT_IS_READ_ONLY_MSG, UNSUPPORTED_MSG`

## Method Summary

Modifier and Type
Method
Description
`CompactQuantilesDoublesSketch`
`compact()`
Returns a CompactQuantilesDoublesSketch of this class
`CompactQuantilesDoublesSketch`
`compact(MemorySegment dstSeg)`
Returns a compact version of this sketch.
`static UpdatableQuantilesDoublesSketch`
`heapify(MemorySegment srcSeg)`
Factory heapify takes a compact sketch image in MemorySegment and instantiates an on-heap sketch.
`abstract void`
`update(double item)`
Updates this sketch with the given item.
`static UpdatableQuantilesDoublesSketch`
`wrap(MemorySegment srcSeg)`
Wrap a sketch around the given source MemorySegment containing sketch data that originated from this sketch.
`static UpdatableQuantilesDoublesSketch`
`wrap(MemorySegment srcSeg, MemorySegmentRequest mSegReq)`
Wrap a sketch around the given source MemorySegment containing sketch data that originated from this sketch and including an optional, user defined `MemorySegmentRequest`.

### Methods inherited from class QuantilesDoublesSketch

`builder, downSample, getCDF, getCompactSerialiedSizeBytes, getCurrentCompactSerializedSizeBytes, getCurrentUpdatableSerializedSizeBytes, getK, getKFromEpsilon, getMaxItem, getMinItem, getN, getNormalizedRankError, getNormalizedRankError, getNumRetained, getPMF, getQuantile, getQuantileLowerBound, getQuantiles, getQuantileUpperBound, getRank, getRankLowerBound, getRanks, getRankUpperBound, getSerializedSizeBytes, getSortedView, getUpdatableStorageBytes, hasMemorySegment, isEmpty, isEstimationMode, isOffHeap, isReadOnly, isSameResource, iterator, putIntoMemorySegment, putIntoMemorySegment, reset, toByteArray, toByteArray, toString, toString, toString, toString, writableWrap, writableWrap`

### Methods inherited from class Object

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

### Methods inherited from interface QuantilesDoublesAPI

`getCDF, getPMF, getQuantile, getQuantiles, getRank, getRanks`

## Method Details

### wrap

public static UpdatableQuantilesDoublesSketch wrap(MemorySegment srcSeg)
Wrap a sketch around the given source MemorySegment containing sketch data that originated from this sketch.

The given MemorySegment must be writable and it must contain a UpdatableQuantilesDoublesSketch. The sketch will be updated and managed totally within the MemorySegment. If the given source MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.

NOTE:If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch will request more capacity using the `MemorySegmentRequest` interface. The default of this interface will return a new MemorySegment on the heap.

Parameters:
  `srcSeg` - a MemorySegment that contains sketch data.
Returns:
  an instance of this sketch that wraps the given MemorySegment.

### wrap

public static UpdatableQuantilesDoublesSketch wrap(MemorySegment srcSeg, MemorySegmentRequest mSegReq)
Wrap a sketch around the given source MemorySegment containing sketch data that originated from this sketch and including an optional, user defined `MemorySegmentRequest`.

The given MemorySegment must be writable and it must contain a UpdatableQuantilesDoublesSketch. The sketch will be updated and managed totally within the MemorySegment. If the given source MemorySegment is created off-heap, then all the management of the sketch's internal data will be off-heap as well.

NOTE:If during updating of the sketch the sketch requires more capacity than the given size of the MemorySegment, the sketch will request more capacity using the `MemorySegmentRequest` interface. The default of this interface will return a new MemorySegment on the heap. It is up to the user to optionally extend this interface if more flexible handling of requests for more capacity is required.

Parameters:
  `srcSeg` - a MemorySegment that contains sketch data.
  `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 instance of this sketch that wraps the given MemorySegment.

### heapify

public static UpdatableQuantilesDoublesSketch heapify(MemorySegment srcSeg)
Factory heapify takes a compact sketch image in MemorySegment and instantiates an on-heap sketch. The resulting sketch will not retain any link to the source MemorySegment.

Parameters:
  `srcSeg` - compact MemorySegment image of a sketch serialized by this sketch.
Returns:
  a heap-based sketch based on the given MemorySegment.

### compact

public CompactQuantilesDoublesSketch compact()
Returns a CompactQuantilesDoublesSketch of this class

Returns:
  a CompactQuantilesDoublesSketch of this class

### compact

public CompactQuantilesDoublesSketch compact(MemorySegment dstSeg)
Returns a compact version of this sketch. If passing in a MemorySegment object, the compact sketch will use and load that MemorySegment; otherwise, an on-heap sketch will be returned.

Parameters:
  `dstSeg` - An optional target MemorySegment to hold the sketch.
Returns:
  A compact version of this sketch

### update

public abstract void update(double item)
Description copied from interface: `QuantilesDoublesAPI`
Updates this sketch with the given item.

Parameters:
  `item` - from a stream of items. NaNs are ignored.