public abstract class Intersection extends SetOperation
Constructor and Description |
---|
Intersection() |
Modifier and Type | Method and Description |
---|---|
protected static void |
checkMinSizeMemory(org.apache.datasketches.memory.Memory mem) |
Family |
getFamily()
Gets the Family of this SetOperation
|
protected static int |
getMaxLgArrLongs(org.apache.datasketches.memory.Memory dstMem)
Returns the maximum lgArrLongs given the capacity of the Memory.
|
CompactSketch |
getResult()
Gets the result of this operation as an ordered CompactSketch on the Java heap.
|
abstract CompactSketch |
getResult(boolean dstOrdered,
org.apache.datasketches.memory.WritableMemory dstMem)
Gets the result of this operation as a CompactSketch in the given dstMem.
|
abstract boolean |
hasResult()
Returns true if there is an intersection result available
|
abstract void |
intersect(Sketch sketchIn)
Intersect the given sketch with the internal state.
|
CompactSketch |
intersect(Sketch a,
Sketch b)
Perform intersect set operation on the two given sketch arguments and return the result as an
ordered CompactSketch on the heap.
|
abstract CompactSketch |
intersect(Sketch a,
Sketch b,
boolean dstOrdered,
org.apache.datasketches.memory.WritableMemory dstMem)
Perform intersect set operation on the two given sketches and return the result as a
CompactSketch.
|
protected static void |
memChecks(org.apache.datasketches.memory.Memory srcMem) |
abstract void |
reset()
Resets this Intersection for stateful operations only.
|
abstract byte[] |
toByteArray()
Serialize this intersection to a byte array form.
|
void |
update(Sketch sketchIn)
Deprecated.
v2.0.0. Use
intersect(Sketch) instead. |
builder, getMaxAnotBResultBytes, getMaxIntersectionBytes, getMaxUnionBytes, heapify, heapify, isSameResource, wrap, wrap, wrap, wrap
public Family getFamily()
SetOperation
getFamily
in class SetOperation
public CompactSketch getResult()
intersect(Sketch)
method must have been called at least once, otherwise an
exception will be thrown. This is because a virgin Intersection object represents the
Universal Set, which has an infinite number of values.public abstract CompactSketch getResult(boolean dstOrdered, org.apache.datasketches.memory.WritableMemory dstMem)
intersect(Sketch)
method must have been called at least once, otherwise an
exception will be thrown. This is because a virgin Intersection object represents the
Universal Set, which has an infinite number of values.
Note that presenting an intersection with an empty sketch sets the internal state of the intersection to empty = true, and current count = 0. This is consistent with the mathematical definition of the intersection of any set with the empty set is always empty.
Presenting an intersection with a null argument will throw an exception.
dstOrdered
- See Destination OrdereddstMem
- See Destination Memory.public abstract boolean hasResult()
public abstract void reset()
public abstract byte[] toByteArray()
@Deprecated public void update(Sketch sketchIn)
intersect(Sketch)
instead.sketchIn
- the given sketchpublic abstract void intersect(Sketch sketchIn)
sketchIn
- the given sketchpublic CompactSketch intersect(Sketch a, Sketch b)
a
- The first sketch argumentb
- The second sketch argumentpublic abstract CompactSketch intersect(Sketch a, Sketch b, boolean dstOrdered, org.apache.datasketches.memory.WritableMemory dstMem)
a
- The first sketch argumentb
- The second sketch argumentdstOrdered
- See Destination Ordered.dstMem
- See Destination Memory.protected static int getMaxLgArrLongs(org.apache.datasketches.memory.Memory dstMem)
dstMem
- the given Memoryprotected static void checkMinSizeMemory(org.apache.datasketches.memory.Memory mem)
protected static void memChecks(org.apache.datasketches.memory.Memory srcMem)
Copyright © 2015–2021 The Apache Software Foundation. All rights reserved.