Package it.unimi.dsi.sux4j.mph
Class MinimalPerfectHashFunction.Builder<T>
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.MinimalPerfectHashFunction.Builder<T>
-
- Enclosing class:
- MinimalPerfectHashFunction<T>
public static class MinimalPerfectHashFunction.Builder<T> extends java.lang.ObjectA builder class forMinimalPerfectHashFunction.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbuiltWhetherbuild()has already been called.protected ChunkedHashStore<T>chunkedHashStoreprotected java.lang.Iterable<? extends T>keysprotected 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 MinimalPerfectHashFunction<T>build()Builds a minimal perfect hash function.MinimalPerfectHashFunction.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.MinimalPerfectHashFunction.Builder<T>signed(int signatureWidth)Specifies that the resultingMinimalPerfectHashFunctionshould be signed using a given number of bits per key.MinimalPerfectHashFunction.Builder<T>store(ChunkedHashStore<T> chunkedHashStore)Specifies a chunked hash store containing the keys.MinimalPerfectHashFunction.Builder<T>tempDir(java.io.File tempDir)Specifies a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore.MinimalPerfectHashFunction.Builder<T>transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)Specifies the transformation strategy for the keys to hash.
-
-
-
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
-
chunkedHashStore
protected ChunkedHashStore<T> chunkedHashStore
-
built
protected boolean built
Whetherbuild()has already been called.
-
-
Method Detail
-
keys
public MinimalPerfectHashFunction.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.
-
transform
public MinimalPerfectHashFunction.Builder<T> transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)
Specifies the transformation strategy for the keys to hash.- Parameters:
transform- a transformation strategy for the keys to hash.- Returns:
- this builder.
-
signed
public MinimalPerfectHashFunction.Builder<T> signed(int signatureWidth)
Specifies that the resultingMinimalPerfectHashFunctionshould 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 MinimalPerfectHashFunction.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 MinimalPerfectHashFunction.Builder<T> store(ChunkedHashStore<T> chunkedHashStore)
Specifies a chunked hash store containing the keys.
-
build
public MinimalPerfectHashFunction<T> build() throws java.io.IOException
Builds a minimal perfect hash function.- Returns:
- a
MinimalPerfectHashFunctioninstance with the specified parameters. - Throws:
java.lang.IllegalStateException- if called more than once.java.io.IOException
-
-