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>
A builder class for
CHDMinimalPerfectHashFunction
.-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Whetherbuild()
has already been called.protected ChunkedHashStore<T>
protected int
protected double
protected int
protected File
protected TransformationStrategy<? super T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a minimal perfect hash function.Specifies the keys to hash; if you have specified ait.unimi.dsi.sux4j.io.ChunkedHashStore
, it can benull
.lambda
(int lambda) Specifies the average size of a bucket.loadFactor
(int loadFactor) Specifies the load factor.signed
(int signatureWidth) Specifies that the resultingCHDMinimalPerfectHashFunction
should be signed using a given number of bits per key.store
(ChunkedHashStore<T> chunkedHashStore) Specifies a chunked hash store containing the keys.Specifies a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore
.transform
(TransformationStrategy<? super T> transform) Specifies the transformation strategy for the keys to hash; the strategy can be raw.
-
Field Details
-
keys
-
transform
-
signatureWidth
protected int signatureWidth -
tempDir
-
lambda
protected int lambda -
loadFactor
protected double loadFactor -
chunkedHashStore
-
built
protected boolean builtWhetherbuild()
has already been called.
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
Specifies the average size of a bucket.- Parameters:
lambda
- the average size of a bucket.- Returns:
- this builder.
-
loadFactor
Specifies the load factor.- Parameters:
loadFactor
- the load factor.- Returns:
- this builder.
-
transform
public CHDMinimalPerfectHashFunction.Builder<T> transform(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
Specifies that the resultingCHDMinimalPerfectHashFunction
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
Specifies a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore
.- Parameters:
tempDir
- a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore
files, ornull
for the standard temporary directory.- Returns:
- this builder.
-
store
Specifies a chunked hash store containing the keys.- Parameters:
chunkedHashStore
- a chunked hash store containing the keys, ornull
; the store can be unchecked, but in this case you must specify keys and a transform (otherwise, in case of a hash collision in the store anIllegalStateException
will be thrown).- Returns:
- this builder.
-
build
Builds a minimal perfect hash function.- Returns:
- a
CHDMinimalPerfectHashFunction
instance with the specified parameters. - Throws:
IllegalStateException
- if called more than once.IOException
-