public static class MinimalPerfectHashFunction.Builder<T> extends Object
MinimalPerfectHashFunction.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
built
Whether
build() has already been called. |
protected ChunkedHashStore<T> |
chunkedHashStore |
protected Iterable<? extends T> |
keys |
protected int |
signatureWidth |
protected File |
tempDir |
protected TransformationStrategy<? super T> |
transform |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
MinimalPerfectHashFunction<T> |
build()
Builds a minimal perfect hash function.
|
MinimalPerfectHashFunction.Builder<T> |
keys(Iterable<? extends T> keys)
Specifies the keys to hash; if you have specified a
ChunkedHashStore, it can be null. |
MinimalPerfectHashFunction.Builder<T> |
signed(int signatureWidth)
Specifies that the resulting
MinimalPerfectHashFunction should 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(File tempDir)
Specifies a temporary directory for the
ChunkedHashStore. |
MinimalPerfectHashFunction.Builder<T> |
transform(TransformationStrategy<? super T> transform)
Specifies the transformation strategy for the keys to hash.
|
protected TransformationStrategy<? super T> transform
protected int signatureWidth
protected File tempDir
protected ChunkedHashStore<T> chunkedHashStore
protected boolean built
build() has already been called.public MinimalPerfectHashFunction.Builder<T> keys(Iterable<? extends T> keys)
ChunkedHashStore, it can be null.keys - the keys to hash.public MinimalPerfectHashFunction.Builder<T> transform(TransformationStrategy<? super T> transform)
transform - a transformation strategy for the keys to hash.public MinimalPerfectHashFunction.Builder<T> signed(int signatureWidth)
MinimalPerfectHashFunction should be signed using a given number of bits per key.signatureWidth - a signature width, or 0 for no signature.public MinimalPerfectHashFunction.Builder<T> tempDir(File tempDir)
ChunkedHashStore.tempDir - a temporary directory for the ChunkedHashStore files, or null for the standard temporary directory.public MinimalPerfectHashFunction.Builder<T> store(ChunkedHashStore<T> chunkedHashStore)
chunkedHashStore - a chunked hash store containing the keys, or null; 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 an IllegalStateException will be thrown).public MinimalPerfectHashFunction<T> build() throws IOException
MinimalPerfectHashFunction instance with the specified parameters.IllegalStateException - if called more than once.IOException