it.unimi.di.mg4j.document
Class SimpleCompressedDocumentCollection.FrequencyCodec

java.lang.Object
  extended by it.unimi.di.mg4j.document.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 Summary
SimpleCompressedDocumentCollection.FrequencyCodec()
           
 
Method Summary
 int decode(int symbol)
          Decodes a symbol, returning the original symbol.
 int encode(int symbol)
          Encodes a symbol, returning a (hopefully smaller) symbol.
 void reset()
          Empties the queue and the symbol-to-position map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCompressedDocumentCollection.FrequencyCodec

public SimpleCompressedDocumentCollection.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.