Class ThetaSetOperation

java.lang.Object
org.apache.datasketches.theta.ThetaSetOperation
All Implemented Interfaces:
MemorySegmentStatus
Direct Known Subclasses:
ThetaAnotB, ThetaIntersection, ThetaUnion

public abstract class ThetaSetOperation extends Object implements MemorySegmentStatus
The parent API for all Set Operations
Author:
Lee Rhodes
  • Method Details

    • builder

      public static final ThetaSetOperationBuilder builder()
      Makes a new builder
      Returns:
      a new builder
    • heapify

      public static ThetaSetOperation heapify(MemorySegment srcSeg)
      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

      public static ThetaSetOperation heapify(MemorySegment srcSeg, long expectedSeed)
      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

      public static ThetaSetOperation wrap(MemorySegment srcSeg)
      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

      public static ThetaSetOperation wrap(MemorySegment srcSeg, long expectedSeed)
      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

      public abstract Family getFamily()
      Gets the Family of this ThetaSetOperation
      Returns:
      the Family of this ThetaSetOperation