Package org.apache.datasketches.theta
Class SetOperation
java.lang.Object
org.apache.datasketches.theta.SetOperation
- Direct Known Subclasses:
AnotB,Intersection,Union
public abstract class SetOperation extends Object
The parent API for all Set Operations
- Author:
- Lee Rhodes
-
Method Summary
Modifier and Type Method Description static SetOperationBuilderbuilder()Makes a new builderabstract FamilygetFamily()Gets the Family of this SetOperationstatic intgetMaxAnotBResultBytes(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 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 Union operationsstatic SetOperationheapify(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 SetOperationheapify(org.apache.datasketches.memory.Memory srcMem, long seed)Heapify takes the SetOperation image in Memory and instantiates an on-heap SetOperation using the given seed.abstract booleanisSameResource(org.apache.datasketches.memory.Memory that)Returns true if the backing resource of this is identical with the backing resource of that.static SetOperationwrap(org.apache.datasketches.memory.Memory srcMem)Wrap takes the SetOperation image in Memory and refers to it directly.static SetOperationwrap(org.apache.datasketches.memory.Memory srcMem, long seed)Wrap takes the SetOperation image in Memory and refers to it directly.static SetOperationwrap(org.apache.datasketches.memory.WritableMemory srcMem)Wrap takes the SetOperation image in Memory and refers to it directly.static SetOperationwrap(org.apache.datasketches.memory.WritableMemory srcMem, long seed)Wrap takes the SetOperation image in Memory and refers to it directly.
-
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 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 hash of the given seed matches the image seed hash. See Memoryseed- 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 seed matches the image seed hash. See Memoryseed- 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
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 seed matches the image seed hash. See Memoryseed- 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
-
isSameResource
public 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. The capacities must be the same. If this is a region, the region offset must also be the same.Note: Only certain set operators during stateful operations can be serialized. Only when they are stored into Memory will this be relevant.
- Parameters:
that- A different non-null object- Returns:
- true if the backing resource of this is the same as the backing resource of that.
-