Class ThetaSetOperation
java.lang.Object
org.apache.datasketches.theta.ThetaSetOperation
- All Implemented Interfaces:
MemorySegmentStatus
- Direct Known Subclasses:
ThetaAnotB, ThetaIntersection, ThetaUnion
The parent API for all Set Operations
- Author:
- Lee Rhodes
-
Method Summary
Modifier and TypeMethodDescriptionstatic final ThetaSetOperationBuilderbuilder()Makes a new builderabstract FamilyGets the Family of this ThetaSetOperationstatic intgetMaxAnotBResultBytes(int nomEntries) Returns the maximum number of bytes for the returned CompactThetaSketch, given the value of nomEntries of the first sketch A of ThetaAnotB.static intgetMaxIntersectionBytes(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for intersection operationsstatic intgetMaxUnionBytes(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for ThetaUnion operationsstatic ThetaSetOperationheapify(MemorySegment srcSeg) Heapify takes the ThetaSetOperation image in MemorySegment and instantiates an on-heap ThetaSetOperation using the Default Update Seed.static ThetaSetOperationheapify(MemorySegment srcSeg, long expectedSeed) Heapify takes the ThetaSetOperation image in MemorySegment and instantiates an on-heap ThetaSetOperation using the given expectedSeed.static ThetaSetOperationwrap(MemorySegment srcSeg) Wrap takes the ThetaSetOperation image in MemorySegment and refers to it directly.static ThetaSetOperationwrap(MemorySegment srcSeg, long expectedSeed) Wrap takes the ThetaSetOperation image in MemorySegment and refers to it directly.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MemorySegmentStatus
hasMemorySegment, isOffHeap, isSameResource
-
Method Details
-
builder
-
heapify
Heapify takes the ThetaSetOperation image in MemorySegment and instantiates an on-heap ThetaSetOperation using the Default Update Seed. The resulting ThetaSetOperation will not retain any link to the source MemorySegment.Note: Only certain set operators during stateful operations can be serialized and thus heapified.
- Parameters:
srcSeg- an image of a ThetaSetOperation where the image seed hash matches the default seed hash.- Returns:
- a Heap-based ThetaSetOperation from the given MemorySegment
-
heapify
Heapify takes the ThetaSetOperation image in MemorySegment and instantiates an on-heap ThetaSetOperation using the given expectedSeed. The resulting ThetaSetOperation will not retain any link to the source MemorySegment.Note: Only certain set operators during stateful operations can be serialized and thus heapified.
- Parameters:
srcSeg- an image of a ThetaSetOperation where the hash of the given expectedSeed matches the image seed hash.expectedSeed- the seed used to validate the given MemorySegment image. See Update Hash Seed.- Returns:
- a Heap-based ThetaSetOperation from the given MemorySegment
-
wrap
Wrap takes the ThetaSetOperation image in MemorySegment and refers to it directly. There is no data copying onto the java heap. This method assumes the Default Update Seed. If the given source MemorySegment is read-only, the returned object will also be read-only.Note: Only certain set operators during stateful operations can be serialized and thus wrapped.
- Parameters:
srcSeg- an image of a ThetaSetOperation where the image seed hash matches the default seed hash.- Returns:
- a ThetaSetOperation backed by the given MemorySegment
-
wrap
Wrap takes the ThetaSetOperation image in MemorySegment and refers to it directly. There is no data copying onto the java heap. If the given source MemorySegment is read-only, the returned object will also be read-only.Note: Only certain set operators during stateful operations can be serialized and thus wrapped.
- Parameters:
srcSeg- an image of a ThetaSetOperation where the hash of the given expectedSeed matches the image seed hash.expectedSeed- the seed used to validate the given MemorySegment image. See Update Hash Seed.- Returns:
- a ThetaSetOperation backed by the given MemorySegment
-
getMaxUnionBytes
public static int getMaxUnionBytes(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for ThetaUnion operations- Parameters:
nomEntries- Nominal Entries This will become the ceiling power of 2 if it is not.- Returns:
- the maximum required storage bytes given a nomEntries parameter
-
getMaxIntersectionBytes
public static int getMaxIntersectionBytes(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for intersection operations- Parameters:
nomEntries- Nominal Entries This will become the ceiling power of 2 if it is not.- Returns:
- the maximum required storage bytes given a nomEntries parameter
-
getMaxAnotBResultBytes
public static int getMaxAnotBResultBytes(int nomEntries) Returns the maximum number of bytes for the returned CompactThetaSketch, given the value of nomEntries of the first sketch A of ThetaAnotB.- Parameters:
nomEntries- this value must be a power of 2.- Returns:
- the maximum number of bytes.
-
getFamily
Gets the Family of this ThetaSetOperation- Returns:
- the Family of this ThetaSetOperation
-