Package org.apache.datasketches.quantiles

# Class UpdateDoublesSketch

java.lang.Object
org.apache.datasketches.quantiles.DoublesSketch
org.apache.datasketches.quantiles.UpdateDoublesSketch

All Implemented Interfaces:
  `QuantilesAPI`, `QuantilesDoublesAPI`

public abstract class UpdateDoublesSketch extends DoublesSketch

Author:
  Jon Malkin

## Field Summary

### Fields inherited from interface org.apache.datasketches.quantilescommon.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
`CompactDoublesSketch`
`compact()`
`CompactDoublesSketch`
`compact(org.apache.datasketches.memory.WritableMemory dstMem)`
Returns a compact version of this sketch.
`static UpdateDoublesSketch`
`heapify(org.apache.datasketches.memory.Memory srcMem)`
Factory heapify takes a compact sketch image in Memory and instantiates an on-heap sketch.
`abstract void`
`update(double item)`
Updates this sketch with the given double data item
`static UpdateDoublesSketch`
`wrap(org.apache.datasketches.memory.WritableMemory srcMem)`
Wrap this sketch around the given non-compact Memory image of a DoublesSketch.

### Methods inherited from class org.apache.datasketches.quantiles.DoublesSketch

`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, hasMemory, isDirect, isEmpty, isEstimationMode, isReadOnly, isSameResource, iterator, putMemory, putMemory, reset, toByteArray, toByteArray, toString, toString, toString, toString, wrap`

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

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

### Methods inherited from interface org.apache.datasketches.quantilescommon.QuantilesDoublesAPI

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

## Method Details

### wrap

public static UpdateDoublesSketch wrap(org.apache.datasketches.memory.WritableMemory srcMem)
Wrap this sketch around the given non-compact Memory image of a DoublesSketch.

Parameters:
  `srcMem` - the given Memory image of a DoublesSketch that may have data,
Returns:
  a sketch that wraps the given srcMem

### update

public abstract void update(double item)
Updates this sketch with the given double data item

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

### heapify

public static UpdateDoublesSketch heapify(org.apache.datasketches.memory.Memory srcMem)
Factory heapify takes a compact sketch image in Memory and instantiates an on-heap sketch. The resulting sketch will not retain any link to the source Memory.

Parameters:
  `srcMem` - a compact Memory image of a sketch serialized by this sketch. See Memory
Returns:
  a heap-based sketch based on the given Memory.

### compact

public CompactDoublesSketch compact()

Returns:
  a CompactDoublesSketch of this class

### compact

public CompactDoublesSketch compact(org.apache.datasketches.memory.WritableMemory dstMem)
Returns a compact version of this sketch. If passing in a Memory object, the compact sketch will use that direct memory; otherwise, an on-heap sketch will be returned.

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