Class SetOperationBuilder


  • public class SetOperationBuilder
    extends Object
    For building a new SetOperation.
    Author:
    Lee Rhodes
    • Constructor Detail

      • SetOperationBuilder

        public SetOperationBuilder()
        Constructor for building a new SetOperation. The default configuration is
    • Method Detail

      • setNominalEntries

        public SetOperationBuilder 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 SetOperationBuilder
      • setLogNominalEntries

        public SetOperationBuilder 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 SetOperationBuilder
      • getLgNominalEntries

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

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

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

        public SetOperationBuilder setP​(float p)
        Sets the upfront uniform sampling probability, p. Although this functionality is implemented for Unions 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 SetOperationBuilder
      • getP

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

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

        public SetOperationBuilder setMemoryRequestServer​(org.apache.datasketches.memory.MemoryRequestServer memReqSvr)
        Set the MemoryRequestServer
        Parameters:
        memReqSvr - the given MemoryRequestServer
        Returns:
        this SetOperationBuilder
      • getMemoryRequestServer

        public org.apache.datasketches.memory.MemoryRequestServer getMemoryRequestServer()
        Returns the MemoryRequestServer
        Returns:
        the MemoryRequestServer
      • build

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

        public SetOperation build​(Family family,
                                  org.apache.datasketches.memory.WritableMemory dstMem)
        Returns a SetOperation with the current configuration of this Builder, the given Family and the given destination memory. Note that the destination memory cannot be used with AnotB.
        Parameters:
        family - the chosen SetOperation family
        dstMem - The destination Memory.
        Returns:
        a SetOperation
      • buildUnion

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

        public Union buildUnion​(org.apache.datasketches.memory.WritableMemory dstMem)
        Convenience method, returns a configured SetOperation Union with Default Nominal Entries and the given destination memory.
        Parameters:
        dstMem - The destination Memory.
        Returns:
        a Union object
      • buildIntersection

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

        public Intersection buildIntersection​(org.apache.datasketches.memory.WritableMemory dstMem)
        Convenience method, returns a configured SetOperation Intersection with Default Nominal Entries and the given destination memory.
        Parameters:
        dstMem - The destination Memory.
        Returns:
        an Intersection object
      • buildANotB

        public AnotB buildANotB()
        Convenience method, returns a configured SetOperation ANotB with Default Update Seed
        Returns:
        an ANotB object