Class GV4CompressedFunction.Builder<T>

  • Enclosing class:
    GV4CompressedFunction<T>

    public static class GV4CompressedFunction.Builder<T>
    extends java.lang.Object
    • 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
      • values

        protected it.unimi.dsi.fastutil.longs.LongIterable values
      • indirect

        protected boolean indirect
      • built

        protected boolean built
        Whether build() has already been called.
      • codec

        protected Codec codec
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • keys

        public GV4CompressedFunction.Builder<T> keys​(java.lang.Iterable<? extends T> keys)
        Specifies the keys of the function; if you have specified a BucketedHashStore, it can be null.
        Parameters:
        keys - the keys of the function.
        Returns:
        this builder.
      • store

        public GV4CompressedFunction.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, 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).
        Returns:
        this builder.
      • values

        public GV4CompressedFunction.Builder<T> values​(it.unimi.dsi.fastutil.longs.LongIterable values)
        Specifies the values assigned to the keys.

        Contrarily to values(LongIterable), this method does not require a complete scan of the value to determine the output width.

        Parameters:
        values - values to be assigned to each element, in the same order of the keys.
        Returns:
        this builder.
        See Also:
        values(LongIterable)
      • indirect

        public GV4CompressedFunction.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 LongList or a LongBigList.

        Returns:
        this builder.
      • codec

        public GV4CompressedFunction.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.
      • build

        public GV4CompressedFunction<T> build()
                                       throws java.io.IOException
        Builds a new function.
        Returns:
        a GOV3Function instance with the specified parameters.
        Throws:
        java.lang.IllegalStateException - if called more than once.
        java.io.IOException