Package it.unimi.dsi.sux4j.mph
Class CHDMinimalPerfectHashFunction.Builder<T>
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.CHDMinimalPerfectHashFunction.Builder<T>
-
- Enclosing class:
- CHDMinimalPerfectHashFunction<T>
public static class CHDMinimalPerfectHashFunction.Builder<T> extends java.lang.ObjectA builder class forCHDMinimalPerfectHashFunction.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbuiltWhetherbuild()has already been called.protected ChunkedHashStore<T>chunkedHashStoreprotected java.lang.Iterable<? extends T>keysprotected intlambdaprotected doubleloadFactorprotected intsignatureWidthprotected java.io.FiletempDirprotected it.unimi.dsi.bits.TransformationStrategy<? super T>transform
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CHDMinimalPerfectHashFunction<T>build()Builds a minimal perfect hash function.CHDMinimalPerfectHashFunction.Builder<T>keys(java.lang.Iterable<? extends T> keys)Specifies the keys to hash; if you have specified ait.unimi.dsi.sux4j.io.ChunkedHashStore, it can benull.CHDMinimalPerfectHashFunction.Builder<T>lambda(int lambda)Specifies the average size of a bucket.CHDMinimalPerfectHashFunction.Builder<T>loadFactor(int loadFactor)Specifies the load factor.CHDMinimalPerfectHashFunction.Builder<T>signed(int signatureWidth)Specifies that the resultingCHDMinimalPerfectHashFunctionshould be signed using a given number of bits per key.CHDMinimalPerfectHashFunction.Builder<T>store(ChunkedHashStore<T> chunkedHashStore)Specifies a chunked hash store containing the keys.CHDMinimalPerfectHashFunction.Builder<T>tempDir(java.io.File tempDir)Specifies a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore.CHDMinimalPerfectHashFunction.Builder<T>transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)Specifies the transformation strategy for the keys to hash; the strategy can be raw.
-
-
-
Field Detail
-
keys
protected java.lang.Iterable<? extends T> keys
-
transform
protected it.unimi.dsi.bits.TransformationStrategy<? super T> transform
-
signatureWidth
protected int signatureWidth
-
tempDir
protected java.io.File tempDir
-
lambda
protected int lambda
-
loadFactor
protected double loadFactor
-
chunkedHashStore
protected ChunkedHashStore<T> chunkedHashStore
-
built
protected boolean built
Whetherbuild()has already been called.
-
-
Method Detail
-
keys
public CHDMinimalPerfectHashFunction.Builder<T> keys(java.lang.Iterable<? extends T> keys)
Specifies the keys to hash; if you have specified ait.unimi.dsi.sux4j.io.ChunkedHashStore, it can benull.- Parameters:
keys- the keys to hash.- Returns:
- this builder.
-
lambda
public CHDMinimalPerfectHashFunction.Builder<T> lambda(int lambda)
Specifies the average size of a bucket.- Parameters:
lambda- the average size of a bucket.- Returns:
- this builder.
-
loadFactor
public CHDMinimalPerfectHashFunction.Builder<T> loadFactor(int loadFactor)
Specifies the load factor.- Parameters:
loadFactor- the load factor.- Returns:
- this builder.
-
transform
public CHDMinimalPerfectHashFunction.Builder<T> transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)
Specifies the transformation strategy for the keys to hash; the strategy can be raw.- Parameters:
transform- a transformation strategy for the keys to hash.- Returns:
- this builder.
-
signed
public CHDMinimalPerfectHashFunction.Builder<T> signed(int signatureWidth)
Specifies that the resultingCHDMinimalPerfectHashFunctionshould be signed using a given number of bits per key.- Parameters:
signatureWidth- a signature width, or 0 for no signature.- Returns:
- this builder.
-
tempDir
public CHDMinimalPerfectHashFunction.Builder<T> tempDir(java.io.File tempDir)
Specifies a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore.- Parameters:
tempDir- a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStorefiles, ornullfor the standard temporary directory.- Returns:
- this builder.
-
store
public CHDMinimalPerfectHashFunction.Builder<T> store(ChunkedHashStore<T> chunkedHashStore)
Specifies a chunked hash store containing the keys.
-
build
public CHDMinimalPerfectHashFunction<T> build() throws java.io.IOException
Builds a minimal perfect hash function.- Returns:
- a
CHDMinimalPerfectHashFunctioninstance with the specified parameters. - Throws:
java.lang.IllegalStateException- if called more than once.java.io.IOException
-
-