Package it.unimi.dsi.sux4j.mph
Class GV3CompressedFunction.Builder<T>
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.GV3CompressedFunction.Builder<T>
-
- Enclosing class:
- GV3CompressedFunction<T>
public static class GV3CompressedFunction.Builder<T> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected BucketedHashStore<T>bucketedHashStoreprotected booleanbuiltWhetherbuild()has already been called.protected Codeccodecprotected booleanindirectprotected java.lang.Iterable<? extends T>keysprotected booleanpeeledprotected java.io.FiletempDirprotected it.unimi.dsi.bits.TransformationStrategy<? super T>transformprotected it.unimi.dsi.fastutil.longs.LongIterablevalues
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GV3CompressedFunction<T>build()Builds a new function.GV3CompressedFunction.Builder<T>codec(Codec codec)Specifies a codec that will be used to encode the function output values.GV3CompressedFunction.Builder<T>indirect()GV3CompressedFunction.Builder<T>keys(java.lang.Iterable<? extends T> keys)Specifies the keys of the function; if you have specified aBucketedHashStore, it can benull.GV3CompressedFunction.Builder<T>peeled()Specifies to use peeling rather than lazy Gaussian elimination; the resulting structure uses +12% space, but it can be constructed much more quickly.GV3CompressedFunction.Builder<T>store(BucketedHashStore<T> bucketedHashStore)Specifies a bucketed hash store containing the keys.GV3CompressedFunction.Builder<T>tempDir(java.io.File tempDir)Specifies a temporary directory for theBucketedHashStore.GV3CompressedFunction.Builder<T>transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)Specifies the transformation strategy for the keys of the function; the strategy can be raw.GV3CompressedFunction.Builder<T>values(it.unimi.dsi.fastutil.longs.LongIterable 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
-
bucketedHashStore
protected BucketedHashStore<T> bucketedHashStore
-
values
protected it.unimi.dsi.fastutil.longs.LongIterable values
-
indirect
protected boolean indirect
-
built
protected boolean built
Whetherbuild()has already been called.
-
codec
protected Codec codec
-
peeled
protected boolean peeled
-
-
Method Detail
-
keys
public GV3CompressedFunction.Builder<T> keys(java.lang.Iterable<? extends T> keys)
Specifies the keys of the function; if you have specified aBucketedHashStore, it can benull.- Parameters:
keys- the keys of the function.- Returns:
- this builder.
-
transform
public GV3CompressedFunction.Builder<T> transform(it.unimi.dsi.bits.TransformationStrategy<? super T> transform)
Specifies the transformation strategy for the keys of the function; the strategy can be raw.- Parameters:
transform- a transformation strategy for the keys of the function.- Returns:
- this builder.
-
tempDir
public GV3CompressedFunction.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 GV3CompressedFunction.Builder<T> store(BucketedHashStore<T> bucketedHashStore)
Specifies a bucketed hash store containing the keys.Note that if you specify a store, it is your responsibility that it conforms to the rest of the data: it must contain ranks if you do not specify values or if you use the indirect feature, values otherwise.
- Parameters:
bucketedHashStore- a bucketed hash store containing the keys associated with their values and counting value frequencies, 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 anIllegalStateExceptionwill be thrown).- Returns:
- this builder.
-
values
public GV3CompressedFunction.Builder<T> values(it.unimi.dsi.fastutil.longs.LongIterable 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.
-
indirect
public GV3CompressedFunction.Builder<T> indirect()
Specifies that the function construction must be indirect: a provided store contains indices that must be used to access the values.If you specify this option, the provided values must be a
LongListor aLongBigList.- Returns:
- this builder.
-
codec
public GV3CompressedFunction.Builder<T> codec(Codec codec)
Specifies a codec that will be used to encode the function output values. The default is a Codec.Huffman codec with default parameters.- Parameters:
codec- a codec that will be used to encode the function output values- Returns:
- this builder.
-
peeled
public GV3CompressedFunction.Builder<T> peeled()
Specifies to use peeling rather than lazy Gaussian elimination; the resulting structure uses +12% space, but it can be constructed much more quickly.- Returns:
- this builder.
-
build
public GV3CompressedFunction<T> build() throws java.io.IOException
Builds a new function.- Returns:
- a
GOV3Functioninstance with the specified parameters. - Throws:
java.lang.IllegalStateException- if called more than once.java.io.IOException
-
-