T
- Type of itemspublic final class VarOptItemsUnion<T> extends Object
Modifier and Type | Method and Description |
---|---|
VarOptItemsSketch<T> |
getResult()
Gets the varopt sketch resulting from the union of any input sketches.
|
static <T> VarOptItemsUnion<T> |
heapify(org.apache.datasketches.memory.Memory srcMem,
ArrayOfItemsSerDe<T> serDe)
Instantiates a Union from Memory
|
static <T> VarOptItemsUnion<T> |
newInstance(int maxK)
Creates an empty Union with a maximum capacity of size k.
|
void |
reset()
Resets this sketch to the empty state, but retains the original value of max k.
|
byte[] |
toByteArray(ArrayOfItemsSerDe<T> serDe)
Returns a byte array representation of this union
|
byte[] |
toByteArray(ArrayOfItemsSerDe<T> serDe,
Class<?> clazz)
Returns a byte array representation of this union.
|
String |
toString()
Returns a human-readable summary of the sketch, without items.
|
void |
update(org.apache.datasketches.memory.Memory mem,
ArrayOfItemsSerDe<T> serDe)
Union the given Memory image of the sketch.
|
void |
update(ReservoirItemsSketch<T> reservoirIn)
Union a reservoir sketch.
|
void |
update(VarOptItemsSketch<T> sketchIn)
Union the given sketch.
|
public static <T> VarOptItemsUnion<T> newInstance(int maxK)
T
- The type of item this union containsmaxK
- The maximum allowed capacity of the unioned resultpublic static <T> VarOptItemsUnion<T> heapify(org.apache.datasketches.memory.Memory srcMem, ArrayOfItemsSerDe<T> serDe)
T
- The type of item this sketch containssrcMem
- Memory object containing a serialized unionserDe
- An instance of ArrayOfItemsSerDepublic void update(VarOptItemsSketch<T> sketchIn)
This method can be repeatedly called.
sketchIn
- The sketch to be mergedpublic void update(org.apache.datasketches.memory.Memory mem, ArrayOfItemsSerDe<T> serDe)
This method can be repeatedly called.
mem
- Memory image of sketch to be mergedserDe
- An instance of ArrayOfItemsSerDepublic void update(ReservoirItemsSketch<T> reservoirIn)
reservoirIn
- The reservoir sketch to be mergedpublic VarOptItemsSketch<T> getResult()
public void reset()
public String toString()
public byte[] toByteArray(ArrayOfItemsSerDe<T> serDe)
serDe
- An instance of ArrayOfItemsSerDepublic byte[] toByteArray(ArrayOfItemsSerDe<T> serDe, Class<?> clazz)
serDe
- An instance of ArrayOfItemsSerDeclazz
- A class to which the items are cast before serializationCopyright © 2015–2024 The Apache Software Foundation. All rights reserved.