Package it.unimi.dsi.sux4j.mph
Class TwoStepsMWHCFunction.Builder<T>
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.TwoStepsMWHCFunction.Builder<T>
-
- Enclosing class:
- TwoStepsMWHCFunction<T>
public static class TwoStepsMWHCFunction.Builder<T> extends java.lang.Object
A builder class forTwoStepsMWHCFunction
.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
built
Whetherbuild()
has already been called.protected ChunkedHashStore<T>
chunkedHashStore
protected java.lang.Iterable<? extends T>
keys
protected java.io.File
tempDir
protected it.unimi.dsi.bits.TransformationStrategy<? super T>
transform
protected it.unimi.dsi.fastutil.longs.LongBigList
values
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TwoStepsMWHCFunction<T>
build()
Builds a new function.TwoStepsMWHCFunction.Builder<T>
keys(java.lang.Iterable<? extends T> keys)
Specifies the keys of the function; if you have specified ait.unimi.dsi.sux4j.io.ChunkedHashStore
, it can benull
.TwoStepsMWHCFunction.Builder<T>
store(ChunkedHashStore<T> chunkedHashStore)
Specifies a chunked hash store containing the keys associated with their rank.TwoStepsMWHCFunction.Builder<T>
tempDir(java.io.File tempDir)
Specifies a temporary directory for theit.unimi.dsi.sux4j.io.ChunkedHashStore
.TwoStepsMWHCFunction.Builder<T>
transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)
Specifies the transformation strategy for the keys of the function.TwoStepsMWHCFunction.Builder<T>
values(it.unimi.dsi.fastutil.longs.LongBigList values)
Specifies the values assigned to the keys; the output width of the function will be the minimum width needed to represent all values.
-
-
-
Field Detail
-
keys
protected java.lang.Iterable<? extends T> keys
-
transform
protected it.unimi.dsi.bits.TransformationStrategy<? super T> transform
-
tempDir
protected java.io.File tempDir
-
chunkedHashStore
protected ChunkedHashStore<T> chunkedHashStore
-
values
protected it.unimi.dsi.fastutil.longs.LongBigList values
-
built
protected boolean built
Whetherbuild()
has already been called.
-
-
Method Detail
-
keys
public TwoStepsMWHCFunction.Builder<T> keys(java.lang.Iterable<? extends T> keys)
Specifies the keys of the function; if you have specified ait.unimi.dsi.sux4j.io.ChunkedHashStore
, it can benull
.- Parameters:
keys
- the keys of the function.- Returns:
- this builder.
-
transform
public TwoStepsMWHCFunction.Builder<T> transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)
Specifies the transformation strategy for the keys of the function.- Parameters:
transform
- a transformation strategy for the keys of the function.- Returns:
- this builder.
-
tempDir
public TwoStepsMWHCFunction.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.ChunkedHashStore
files, ornull
for the standard temporary directory.- Returns:
- this builder.
-
store
public TwoStepsMWHCFunction.Builder<T> store(ChunkedHashStore<T> chunkedHashStore)
Specifies a chunked hash store containing the keys associated with their rank.Warning: during the construction phase, a filter will be set on the specified
ChunkedHashStore
. You will have to reset it to its previous state.- Parameters:
chunkedHashStore
- a chunked hash store containing the keys associated with their rank, 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.
-
values
public TwoStepsMWHCFunction.Builder<T> values(it.unimi.dsi.fastutil.longs.LongBigList values)
Specifies the values assigned to the keys; the output width of the function will be the minimum width needed to represent all values.- Parameters:
values
- values to be assigned to each element, in the same order of the keys.- Returns:
- this builder.
-
build
public TwoStepsMWHCFunction<T> build() throws java.io.IOException
Builds a new function.- Returns:
- an
MWHCFunction
instance with the specified parameters. - Throws:
java.lang.IllegalStateException
- if called more than once.java.io.IOException
-
-