Package it.unimi.dsi.sux4j.mph
Class GOVMinimalPerfectHashFunction.Builder<T>
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.GOVMinimalPerfectHashFunction.Builder<T>
-
- Enclosing class:
- GOVMinimalPerfectHashFunction<T>
public static class GOVMinimalPerfectHashFunction.Builder<T> extends java.lang.ObjectA builder class forGOVMinimalPerfectHashFunction.
-
-
Field Summary
Fields Modifier and Type Field Description protected BucketedHashStore<T>bucketedHashStoreprotected booleanbuiltWhetherbuild()has already been called.protected 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 GOVMinimalPerfectHashFunction<T>build()Builds a minimal perfect hash function.GOVMinimalPerfectHashFunction.Builder<T>keys(java.lang.Iterable<? extends T> keys)Specifies the keys to hash; if you have specified aBucketedHashStore, it can benull.GOVMinimalPerfectHashFunction.Builder<T>signed(int signatureWidth)Specifies that the resultingGOVMinimalPerfectHashFunctionshould be signed using a given number of bits per key.GOVMinimalPerfectHashFunction.Builder<T>store(BucketedHashStore<T> bucketedHashStore)Specifies a bucketed hash store containing the keys.GOVMinimalPerfectHashFunction.Builder<T>tempDir(java.io.File tempDir)Specifies a temporary directory for theBucketedHashStore.GOVMinimalPerfectHashFunction.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
-
bucketedHashStore
protected BucketedHashStore<T> bucketedHashStore
-
built
protected boolean built
Whetherbuild()has already been called.
-
-
Method Detail
-
keys
public GOVMinimalPerfectHashFunction.Builder<T> keys(java.lang.Iterable<? extends T> keys)
Specifies the keys to hash; if you have specified aBucketedHashStore, it can benull.- Parameters:
keys- the keys to hash.- Returns:
- this builder.
-
transform
public GOVMinimalPerfectHashFunction.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 GOVMinimalPerfectHashFunction.Builder<T> signed(int signatureWidth)
Specifies that the resultingGOVMinimalPerfectHashFunctionshould 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 GOVMinimalPerfectHashFunction.Builder<T> tempDir(java.io.File tempDir)
Specifies a temporary directory for theBucketedHashStore.- Parameters:
tempDir- a temporary directory for theBucketedHashStorefiles, ornullfor the standard temporary directory.- Returns:
- this builder.
-
store
public GOVMinimalPerfectHashFunction.Builder<T> store(BucketedHashStore<T> bucketedHashStore)
Specifies a bucketed hash store containing the keys.
-
build
public GOVMinimalPerfectHashFunction<T> build() throws java.io.IOException
Builds a minimal perfect hash function.- Returns:
- a
GOVMinimalPerfectHashFunctioninstance with the specified parameters. - Throws:
java.lang.IllegalStateException- if called more than once.java.io.IOException
-
-