Interface DictionaryBuilder<V extends ValueVector>

Type Parameters:
V - the dictionary vector type.
All Known Implementing Classes:
HashTableBasedDictionaryBuilder, SearchTreeBasedDictionaryBuilder

public interface DictionaryBuilder<V extends ValueVector>
A dictionary builder is intended for the scenario frequently encountered in practice: the dictionary is not known a priori, so it is generated dynamically. In particular, when a new value arrives, it is tested to check if it is already in the dictionary. If so, it is simply neglected, otherwise, it is added to the dictionary.

The dictionary builder is intended to build a single dictionary. So it cannot be used for different dictionaries.

Below gives the sample code for using the dictionary builder


 DictionaryBuilder dictionaryBuilder = ...
 ...
 dictionaryBuild.addValue(newValue);
 ...
 

With the above code, the dictionary vector will be populated, and it can be retrieved by the getDictionary() method. After that, dictionary encoding can proceed with the populated dictionary..

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    addValue(V targetVector, int targetIndex)
    Try to add an element from the target vector to the dictionary.
    int
    addValues(V targetVector)
    Try to add all values from the target vector to the dictionary.
    Gets the dictionary built.
  • Method Details

    • addValues

      int addValues(V targetVector)
      Try to add all values from the target vector to the dictionary.
      Parameters:
      targetVector - the target vector containing values to probe.
      Returns:
      the number of values actually added to the dictionary.
    • addValue

      int addValue(V targetVector, int targetIndex)
      Try to add an element from the target vector to the dictionary.
      Parameters:
      targetVector - the target vector containing new element.
      targetIndex - the index of the new element in the target vector.
      Returns:
      the index of the new element in the dictionary.
    • getDictionary

      V getDictionary()
      Gets the dictionary built.
      Returns:
      the dictionary.