Package org.apache.datasketches.theta
Class SetOperationBuilder
java.lang.Object
org.apache.datasketches.theta.SetOperationBuilder
public class SetOperationBuilder extends Object
For building a new SetOperation.
- Author:
- Lee Rhodes
-
Constructor Summary
Constructors Constructor Description SetOperationBuilder()Constructor for building a new SetOperation. -
Method Summary
Modifier and Type Method Description SetOperationbuild(Family family)Returns a SetOperation with the current configuration of this Builder and the given Family.SetOperationbuild(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.AnotBbuildANotB()Convenience method, returns a configured SetOperation ANotB with Default Update SeedIntersectionbuildIntersection()Convenience method, returns a configured SetOperation Intersection with Default Nominal EntriesIntersectionbuildIntersection(org.apache.datasketches.memory.WritableMemory dstMem)Convenience method, returns a configured SetOperation Intersection with Default Nominal Entries and the given destination memory.UnionbuildUnion()Convenience method, returns a configured SetOperation Union with Default Nominal EntriesUnionbuildUnion(org.apache.datasketches.memory.WritableMemory dstMem)Convenience method, returns a configured SetOperation Union with Default Nominal Entries and the given destination memory.intgetLgNominalEntries()Returns Log-base 2 Nominal Entriesorg.apache.datasketches.memory.MemoryRequestServergetMemoryRequestServer()Returns the MemoryRequestServerfloatgetP()Returns the pre-sampling probability pResizeFactorgetResizeFactor()Returns the Resize FactorlonggetSeed()Returns the seedSetOperationBuildersetMemoryRequestServer(org.apache.datasketches.memory.MemoryRequestServer memReqSvr)Set the MemoryRequestServerSetOperationBuildersetNominalEntries(int nomEntries)Sets the Maximum Nominal Entries (max K) for this set operation.SetOperationBuildersetP(float p)Sets the upfront uniform sampling probability, p.SetOperationBuildersetResizeFactor(ResizeFactor rf)Sets the cache Resize FactorSetOperationBuildersetSeed(long seed)Sets the long seed value that is require by the hashing function.StringtoString()
-
Constructor Details
-
SetOperationBuilder
public SetOperationBuilder()Constructor for building a new SetOperation. The default configuration is- Max Nominal Entries (max K): 4096
- Seed: 9001L
ResizeFactor.X8- Input Sampling Probability: 1.0
- Memory: null
-
-
Method Details
-
setNominalEntries
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 Entres This will become the ceiling power of 2 if it is not a power of 2.- Returns:
- this SetOperationBuilder
-
getLgNominalEntries
public int getLgNominalEntries()Returns Log-base 2 Nominal Entries- Returns:
- Log-base 2 Nominal Entries
-
setSeed
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
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
-
setResizeFactor
Sets the cache Resize Factor- Parameters:
rf- See Resize Factor- Returns:
- this SetOperationBuilder
-
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
Returns a SetOperation with the current configuration of this Builder and the given Family.- Parameters:
family- the chosen SetOperation family- Returns:
- a SetOperation
-
build
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 familydstMem- The destination Memory.- Returns:
- a SetOperation
-
buildUnion
Convenience method, returns a configured SetOperation Union with Default Nominal Entries- Returns:
- a Union object
-
buildUnion
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
Convenience method, returns a configured SetOperation Intersection with Default Nominal Entries- Returns:
- an Intersection object
-
buildIntersection
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
Convenience method, returns a configured SetOperation ANotB with Default Update Seed- Returns:
- an ANotB object
-
toString
-