Class SimpleCompressedDocumentCollection.FrequencyCodec

  • Enclosing class:
    SimpleCompressedDocumentCollection

    protected static class SimpleCompressedDocumentCollection.FrequencyCodec
    extends Object
    A simple codec for integers that remaps frequent numbers to smaller numbers.
    • Constructor Detail

      • FrequencyCodec

        public FrequencyCodec()
    • Method Detail

      • reset

        public void reset()
        Empties the queue and the symbol-to-position map.
      • encode

        public int encode​(int symbol)
        Encodes a symbol, returning a (hopefully smaller) symbol.
        Parameters:
        symbol - the input symbol.
        Returns:
        the output symbol.
      • decode

        public int decode​(int symbol)
        Decodes a symbol, returning the original symbol.
        Parameters:
        symbol - a symbol an encoded file.
        Returns:
        the corresponding original input symbol.