Class ThetaSetOperationBuilder

java.lang.Object
org.apache.datasketches.theta.ThetaSetOperationBuilder

public final class ThetaSetOperationBuilder extends Object
For building a new ThetaSetOperation.
Author:
Lee Rhodes
  • Constructor Details

    • ThetaSetOperationBuilder

      public ThetaSetOperationBuilder()
      Constructor for building a new ThetaSetOperation. The default configuration is
  • Method Details

    • setNominalEntries

      public ThetaSetOperationBuilder setNominalEntries(int nomEntries)
      Sets the Maximum Nominal Entries (max K) for this set operation. The effective value of K of the result of a Set Operation can be less than max K, but never greater. The minimum value is 16 and the maximum value is 67,108,864, which is 2^26.
      Parameters:
      nomEntries - Nominal Entries This will become the ceiling power of 2 if it is not a power of 2.
      Returns:
      this ThetaSetOperationBuilder
    • setLogNominalEntries

      public ThetaSetOperationBuilder setLogNominalEntries(int lgNomEntries)
      Alternative method of setting the Nominal Entries for this set operation from the log_base2 value. The minimum value is 4 and the maximum value is 26. Be aware that set operations as large as this maximum value may not have been thoroughly characterized for performance.
      Parameters:
      lgNomEntries - the log_base2 Nominal Entries.
      Returns:
      this ThetaSetOperationBuilder
    • getLgNominalEntries

      public int getLgNominalEntries()
      Returns Log-base 2 Nominal Entries
      Returns:
      Log-base 2 Nominal Entries
    • setSeed

      public ThetaSetOperationBuilder setSeed(long seed)
      Sets the long seed value that is require by the hashing function.
      Parameters:
      seed - See seed
      Returns:
      this ThetaSetOperationBuilder
    • getSeed

      public long getSeed()
      Returns the seed
      Returns:
      the seed
    • setP

      public ThetaSetOperationBuilder setP(float p)
      Sets the upfront uniform sampling probability, p. Although this functionality is implemented for ThetaUnions only, it rarely makes sense to use it. The proper use of upfront sampling is when building the sketches.
      Parameters:
      p - See Sampling Probability, p
      Returns:
      this ThetaSetOperationBuilder
    • getP

      public float getP()
      Returns the pre-sampling probability p
      Returns:
      the pre-sampling probability p
    • setResizeFactor

      public ThetaSetOperationBuilder setResizeFactor(ResizeFactor rf)
      Sets the cache Resize Factor
      Parameters:
      rf - See Resize Factor
      Returns:
      this ThetaSetOperationBuilder
    • getResizeFactor

      public ResizeFactor getResizeFactor()
      Returns the Resize Factor
      Returns:
      the Resize Factor
    • build

      public ThetaSetOperation build(Family family)
      Returns a ThetaSetOperation with the current configuration of this Builder and the given Family.
      Parameters:
      family - the chosen ThetaSetOperation family
      Returns:
      a ThetaSetOperation
    • build

      public ThetaSetOperation build(Family family, MemorySegment dstSeg)
      Returns a ThetaSetOperation with the current configuration of this Builder, the given Family and the given destination MemorySegment. Note that the destination MemorySegment cannot be used with ThetaAnotB.
      Parameters:
      family - the chosen ThetaSetOperation family
      dstSeg - The destination MemorySegment.
      Returns:
      a ThetaSetOperation
    • buildUnion

      public ThetaUnion buildUnion()
      Convenience method, returns a configured ThetaSetOperation ThetaUnion with Default Nominal Entries
      Returns:
      a ThetaUnion object
    • buildUnion

      public ThetaUnion buildUnion(MemorySegment dstSeg)
      Convenience method, returns a configured ThetaSetOperation ThetaUnion with Default Nominal Entries and the given destination MemorySegment.
      Parameters:
      dstSeg - The destination MemorySegment.
      Returns:
      a ThetaUnion object
    • buildIntersection

      public ThetaIntersection buildIntersection()
      Convenience method, returns a configured ThetaIntersection with Default Nominal Entries
      Returns:
      a ThetaIntersection object
    • buildIntersection

      public ThetaIntersection buildIntersection(MemorySegment dstSeg)
      Convenience method, returns a configured ThetaIntersection with Default Nominal Entries and the given destination MemorySegment.
      Parameters:
      dstSeg - The destination MemorySegment.
      Returns:
      a ThetaIntersection object
    • buildANotB

      public ThetaAnotB buildANotB()
      Convenience method, returns a configured ThetaSetOperation ANotB with Default Update Seed
      Returns:
      a ThetaANotB object
    • toString

      public String toString()
      Overrides:
      toString in class Object