Class PrefixCoderTransformationStrategy

java.lang.Object
it.unimi.dsi.bits.PrefixCoderTransformationStrategy
All Implemented Interfaces:
TransformationStrategy<CharSequence>, Serializable
Direct Known Subclasses:
HuTuckerTransformationStrategy

public class PrefixCoderTransformationStrategy extends Object implements TransformationStrategy<CharSequence>
A transformation strategy mapping strings using a prefix-free encoder.

The actual encoding must be provided via a map from characters to symbols, and a set of codewords. The default return value of the map will be used for unknown characters.

This strategy creates a new LongArrayBitVector each time toBitVector(CharSequence) is invoked.

See Also:
  • Field Details

    • codeWord

      protected final BitVector[] codeWord
    • char2symbol

      protected final Char2IntOpenHashMap char2symbol
    • prefixFree

      protected final boolean prefixFree
  • Constructor Details

    • PrefixCoderTransformationStrategy

      public PrefixCoderTransformationStrategy(PrefixCoder coder, Char2IntOpenHashMap char2symbol, boolean prefixFree)
      Create a new transformation strategy based on a prefix-free coder.
      Parameters:
      coder - a prefix-free coder.
      char2symbol - a map from character to symbols (the default returned value will be used for unknown symbols).
      prefixFree - whether it is required that the resulting bit vectors are prefix-free: in this case, symbol 0 will be appended to each string, and will not be allowed to appear in any string.
    • PrefixCoderTransformationStrategy

      protected PrefixCoderTransformationStrategy(PrefixCoderTransformationStrategy transformationStrategy)
    • PrefixCoderTransformationStrategy

      protected PrefixCoderTransformationStrategy(BitVector[] codeWord, Char2IntOpenHashMap char2symbol, boolean prefixFree)
  • Method Details