public abstract class DoublesUnion extends Object
Constructor and Description |
---|
DoublesUnion() |
Modifier and Type | Method and Description |
---|---|
static DoublesUnionBuilder |
builder()
Returns a new UnionBuilder
|
abstract int |
getEffectiveK()
Returns the effective k of this Union.
|
abstract int |
getMaxK()
Returns the configured maxK of this Union.
|
abstract UpdateDoublesSketch |
getResult()
Gets the result of this Union as an UpdateDoublesSketch, which enables further update
operations on the resulting sketch.
|
abstract UpdateDoublesSketch |
getResult(org.apache.datasketches.memory.WritableMemory dstMem)
Places the result of this Union into the provided memory as an UpdateDoublesSketch,
which enables further update operations on the resulting sketch.
|
abstract UpdateDoublesSketch |
getResultAndReset()
Gets the result of this Union as an UpdateDoublesSketch, which enables further update
operations on the resulting sketch.
|
abstract boolean |
hasMemory()
Returns true if this union's data structure is backed by Memory or WritableMemory.
|
static DoublesUnion |
heapify(DoublesSketch sketch)
Returns a Heap Union object that has been initialized with the data from the given sketch.
|
static DoublesUnion |
heapify(org.apache.datasketches.memory.Memory srcMem)
Returns a Heap Union object that has been initialized with the data from the given memory
image of a sketch.
|
abstract boolean |
isDirect()
Returns true if this union is off-heap (direct)
|
abstract boolean |
isEmpty()
Returns true if this union is empty
|
abstract boolean |
isSameResource(org.apache.datasketches.memory.Memory that)
Returns true if the backing resource of this is identical with the backing resource
of that.
|
abstract void |
reset()
Resets this Union to a virgin state.
|
abstract byte[] |
toByteArray()
Serialize this union to a byte array.
|
abstract String |
toString()
Returns summary information about the backing sketch.
|
abstract String |
toString(boolean sketchSummary,
boolean dataDetail)
Returns summary information about the backing sketch.
|
abstract void |
union(DoublesSketch sketchIn)
Iterative union operation, which means this method can be repeatedly called.
|
abstract void |
union(org.apache.datasketches.memory.Memory mem)
Iterative union operation, which means this method can be repeatedly called.
|
abstract void |
update(double dataItem)
Update this union with the given double (or float) data Item.
|
static DoublesUnion |
wrap(org.apache.datasketches.memory.Memory mem)
Returns a read-only Union object that wraps off-heap data of the given memory image of
a sketch.
|
static DoublesUnion |
wrap(org.apache.datasketches.memory.WritableMemory mem)
Returns an updatable Union object that wraps off-heap data of the given memory image of
a sketch.
|
public static DoublesUnionBuilder builder()
public static DoublesUnion heapify(DoublesSketch sketch)
sketch
- A DoublesSketch to be used as a source of data only and will not be modified.public static DoublesUnion heapify(org.apache.datasketches.memory.Memory srcMem)
srcMem
- A memory image of a DoublesSketch to be used as a source of data,
but will not be modified.public static DoublesUnion wrap(org.apache.datasketches.memory.Memory mem)
mem
- A memory region to be used as the data structure for the sketch
and will be modified.public static DoublesUnion wrap(org.apache.datasketches.memory.WritableMemory mem)
mem
- A memory region to be used as the data structure for the sketch
and will be modified.public abstract boolean hasMemory()
public abstract boolean isDirect()
public abstract boolean isEmpty()
public abstract int getMaxK()
public abstract int getEffectiveK()
public abstract void union(DoublesSketch sketchIn)
It is required that the results of the union operation, which can be obtained at any time,
is obtained from getResult()
.
sketchIn
- the sketch to be merged into this one.public abstract void union(org.apache.datasketches.memory.Memory mem)
It is required that the results of the union operation, which can be obtained at any time,
is obtained from getResult()
.
mem
- Memory image of sketch to be mergedpublic abstract void update(double dataItem)
dataItem
- The given double datum.public abstract UpdateDoublesSketch getResult()
public abstract UpdateDoublesSketch getResult(org.apache.datasketches.memory.WritableMemory dstMem)
dstMem
- the destination memory for the resultpublic abstract UpdateDoublesSketch getResultAndReset()
public abstract void reset()
public abstract byte[] toByteArray()
public abstract String toString()
public abstract String toString(boolean sketchSummary, boolean dataDetail)
sketchSummary
- if true includes sketch summarydataDetail
- if true includes data detailpublic abstract boolean isSameResource(org.apache.datasketches.memory.Memory that)
that
- A different non-null objectCopyright © 2015–2024 The Apache Software Foundation. All rights reserved.