Package it.unimi.dsi.sux4j.mph
Class LcpMonotoneMinimalPerfectHashFunction.Builder<T>
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.LcpMonotoneMinimalPerfectHashFunction.Builder<T>
-
- Enclosing class:
- LcpMonotoneMinimalPerfectHashFunction<T>
public static class LcpMonotoneMinimalPerfectHashFunction.Builder<T> extends java.lang.Object
A builder class forLcpMonotoneMinimalPerfectHashFunction
.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
built
Whetherbuild()
has already been called.protected java.lang.Iterable<? extends T>
keys
protected long
numKeys
protected int
signatureWidth
protected java.io.File
tempDir
protected 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 LcpMonotoneMinimalPerfectHashFunction<T>
build()
Builds an LCP monotone minimal perfect hash function.LcpMonotoneMinimalPerfectHashFunction.Builder<T>
keys(java.lang.Iterable<? extends T> keys)
Specifies the keys to hash.LcpMonotoneMinimalPerfectHashFunction.Builder<T>
numKeys(long numKeys)
Specifies the number of keys.LcpMonotoneMinimalPerfectHashFunction.Builder<T>
signed(int signatureWidth)
Specifies that the resultingLcpMonotoneMinimalPerfectHashFunction
should be signed using a given number of bits per key.LcpMonotoneMinimalPerfectHashFunction.Builder<T>
tempDir(java.io.File tempDir)
Specifies a temporary directory for theBucketedHashStore
.LcpMonotoneMinimalPerfectHashFunction.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
-
numKeys
protected long numKeys
-
signatureWidth
protected int signatureWidth
-
tempDir
protected java.io.File tempDir
-
built
protected boolean built
Whetherbuild()
has already been called.
-
-
Method Detail
-
keys
public LcpMonotoneMinimalPerfectHashFunction.Builder<T> keys(java.lang.Iterable<? extends T> keys)
Specifies the keys to hash.- Parameters:
keys
- the keys to hash.- Returns:
- this builder.
-
numKeys
public LcpMonotoneMinimalPerfectHashFunction.Builder<T> numKeys(long numKeys)
Specifies the number of keys.The argument must be equal to the number of keys returned by an iterator generated by
the set of keys
. Without this information, a first scan of the key set will be necessary to compute its cardinality, unless the set of keys implementsSize64
orCollection
.- Parameters:
numKeys
- the keys to hash.- Returns:
- this builder.
-
transform
public LcpMonotoneMinimalPerfectHashFunction.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 LcpMonotoneMinimalPerfectHashFunction.Builder<T> signed(int signatureWidth)
Specifies that the resultingLcpMonotoneMinimalPerfectHashFunction
should 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 LcpMonotoneMinimalPerfectHashFunction.Builder<T> tempDir(java.io.File tempDir)
Specifies a temporary directory for theBucketedHashStore
.- Parameters:
tempDir
- a temporary directory for theBucketedHashStore
. files, ornull
for the standard temporary directory.- Returns:
- this builder.
-
build
public LcpMonotoneMinimalPerfectHashFunction<T> build() throws java.io.IOException
Builds an LCP monotone minimal perfect hash function.- Returns:
- an
LcpMonotoneMinimalPerfectHashFunction
instance with the specified parameters. - Throws:
java.lang.IllegalStateException
- if called more than once.java.io.IOException
-
-