# 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 Summary

Constructors
Constructor
Description
`ThetaSetOperationBuilder()`
Constructor for building a new ThetaSetOperation.

## Method Summary

Modifier and Type
Method
Description
`ThetaSetOperation`
`build(Family family)`
Returns a ThetaSetOperation with the current configuration of this Builder and the given Family.
`ThetaSetOperation`
`build(Family family, MemorySegment dstSeg)`
Returns a ThetaSetOperation with the current configuration of this Builder, the given Family and the given destination MemorySegment.
`ThetaAnotB`
`buildANotB()`
Convenience method, returns a configured ThetaSetOperation ANotB with Default Update Seed
`ThetaIntersection`
`buildIntersection()`
Convenience method, returns a configured ThetaIntersection with Default Nominal Entries
`ThetaIntersection`
`buildIntersection(MemorySegment dstSeg)`
Convenience method, returns a configured ThetaIntersection with Default Nominal Entries and the given destination MemorySegment.
`ThetaUnion`
`buildUnion()`
Convenience method, returns a configured ThetaSetOperation ThetaUnion with Default Nominal Entries
`ThetaUnion`
`buildUnion(MemorySegment dstSeg)`
Convenience method, returns a configured ThetaSetOperation ThetaUnion with Default Nominal Entries and the given destination MemorySegment.
`int`
`getLgNominalEntries()`
Returns Log-base 2 Nominal Entries
`float`
`getP()`
Returns the pre-sampling probability p
`ResizeFactor`
`getResizeFactor()`
Returns the Resize Factor
`long`
`getSeed()`
Returns the seed
`ThetaSetOperationBuilder`
`setLogNominalEntries(int lgNomEntries)`
Alternative method of setting the Nominal Entries for this set operation from the log_base2 value.
`ThetaSetOperationBuilder`
`setNominalEntries(int nomEntries)`
Sets the Maximum Nominal Entries (max K) for this set operation.
`ThetaSetOperationBuilder`
`setP(float p)`
Sets the upfront uniform sampling probability, p.
`ThetaSetOperationBuilder`
`setResizeFactor(ResizeFactor rf)`
Sets the cache Resize Factor
`ThetaSetOperationBuilder`
`setSeed(long seed)`
Sets the long seed value that is require by the hashing function.
`String`
`toString()`

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ThetaSetOperationBuilder

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

- Max Nominal Entries (max K): 4096
- Seed: 9001L
- `ResizeFactor.X8`
- Input Sampling Probability: 1.0
- MemorySegment: null

## 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`