Package org.apache.datasketches.theta
Class SetOperation
java.lang.Object
org.apache.datasketches.theta.SetOperation
- All Implemented Interfaces:
MemoryStatus
- Direct Known Subclasses:
AnotB
,Intersection
,Union
The parent API for all Set Operations
- Author:
- Lee Rhodes
-
Method Summary
Modifier and TypeMethodDescriptionstatic final SetOperationBuilder
builder()
Makes a new builderabstract Family
Gets the Family of this SetOperationstatic int
getMaxAnotBResultBytes
(int nomEntries) Returns the maximum number of bytes for the returned CompactSketch, given the value of nomEntries of the first sketch A of AnotB.static int
getMaxIntersectionBytes
(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for Intersection operationsstatic int
getMaxUnionBytes
(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for Union operationsstatic SetOperation
heapify
(org.apache.datasketches.memory.Memory srcMem) Heapify takes the SetOperations image in Memory and instantiates an on-heap SetOperation using the Default Update Seed.static SetOperation
heapify
(org.apache.datasketches.memory.Memory srcMem, long expectedSeed) Heapify takes the SetOperation image in Memory and instantiates an on-heap SetOperation using the given expectedSeed.static SetOperation
wrap
(org.apache.datasketches.memory.Memory srcMem) Wrap takes the SetOperation image in Memory and refers to it directly.static SetOperation
wrap
(org.apache.datasketches.memory.Memory srcMem, long expectedSeed) Wrap takes the SetOperation image in Memory and refers to it directly.static SetOperation
wrap
(org.apache.datasketches.memory.WritableMemory srcMem) Wrap takes the SetOperation image in Memory and refers to it directly.static SetOperation
wrap
(org.apache.datasketches.memory.WritableMemory srcMem, long expectedSeed) Wrap takes the SetOperation image in Memory and refers to it directly.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.datasketches.common.MemoryStatus
hasMemory, isDirect, isSameResource
-
Method Details
-
builder
Makes a new builder- Returns:
- a new builder
-
heapify
Heapify takes the SetOperations image in Memory and instantiates an on-heap SetOperation using the Default Update Seed. The resulting SetOperation will not retain any link to the source Memory.Note: Only certain set operators during stateful operations can be serialized and thus heapified.
- Parameters:
srcMem
- an image of a SetOperation where the image seed hash matches the default seed hash. See Memory- Returns:
- a Heap-based SetOperation from the given Memory
-
heapify
Heapify takes the SetOperation image in Memory and instantiates an on-heap SetOperation using the given expectedSeed. The resulting SetOperation will not retain any link to the source Memory.Note: Only certain set operators during stateful operations can be serialized and thus heapified.
- Parameters:
srcMem
- an image of a SetOperation where the hash of the given expectedSeed matches the image seed hash. See MemoryexpectedSeed
- the seed used to validate the given Memory image. See Update Hash Seed.- Returns:
- a Heap-based SetOperation from the given Memory
-
wrap
Wrap takes the SetOperation image in Memory and refers to it directly. There is no data copying onto the java heap. This method assumes the Default Update Seed.Note: Only certain set operators during stateful operations can be serialized and thus wrapped.
- Parameters:
srcMem
- an image of a SetOperation where the image seed hash matches the default seed hash. See Memory- Returns:
- a SetOperation backed by the given Memory
-
wrap
Wrap takes the SetOperation image in Memory and refers to it directly. There is no data copying onto the java heap.Note: Only certain set operators during stateful operations can be serialized and thus wrapped.
- Parameters:
srcMem
- an image of a SetOperation where the hash of the given expectedSeed matches the image seed hash. See MemoryexpectedSeed
- the seed used to validate the given Memory image. See Update Hash Seed.- Returns:
- a SetOperation backed by the given Memory
-
wrap
Wrap takes the SetOperation image in Memory and refers to it directly. There is no data copying onto the java heap. This method assumes the Default Update Seed.Note: Only certain set operators during stateful operations can be serialized and thus wrapped.
- Parameters:
srcMem
- an image of a SetOperation where the image seed hash matches the default seed hash. See Memory- Returns:
- a SetOperation backed by the given Memory
-
wrap
public static SetOperation wrap(org.apache.datasketches.memory.WritableMemory srcMem, long expectedSeed) Wrap takes the SetOperation image in Memory and refers to it directly. There is no data copying onto the java heap.Note: Only certain set operators during stateful operations can be serialized and thus wrapped.
- Parameters:
srcMem
- an image of a SetOperation where the hash of the given expectedSeed matches the image seed hash. See MemoryexpectedSeed
- the seed used to validate the given Memory image. See Update Hash Seed.- Returns:
- a SetOperation backed by the given Memory
-
getMaxUnionBytes
public static int getMaxUnionBytes(int nomEntries) Returns the maximum required storage bytes given a nomEntries parameter for Union 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 CompactSketch, given the value of nomEntries of the first sketch A of AnotB.- Parameters:
nomEntries
- this value must be a power of 2.- Returns:
- the maximum number of bytes.
-
getFamily
Gets the Family of this SetOperation- Returns:
- the Family of this SetOperation
-