Class Codec.ZeroCodec.Coder
java.lang.Object
it.unimi.dsi.sux4j.mph.codec.Codec.ZeroCodec.Coder
- All Implemented Interfaces:
Codec.Coder
- Enclosing class:
Codec.ZeroCodec
- Author:
- Sebastiano Vigna, Marco Genuzio
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcodewordLength(long symbol) Returns the length of the codeword associated with the given symbol.longencode(long symbol) Returns the codeword associated with a symbol, or −1 if the provided symbol should be escaped.Return a decoder associated with this coder.intReturns the maximum length of a codeword (including escaped symbols).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Codec.Coder
escape, escapedSymbolLength
-
Constructor Details
-
Coder
protected Coder()
-
-
Method Details
-
encode
public long encode(long symbol) Description copied from interface:Codec.CoderReturns the codeword associated with a symbol, or −1 if the provided symbol should be escaped.If a symbol needs to be escaped, it must be encoded using the escape codeword followed by the symbol written in a field of
Codec.Coder.escapedSymbolLength()bits.- Specified by:
encodein interfaceCodec.Coder- Parameters:
symbol- a symbol.- Returns:
- the associated codeword.
-
codewordLength
public int codewordLength(long symbol) Description copied from interface:Codec.CoderReturns the length of the codeword associated with the given symbol.For escaped symbols, the returned values is the length of the escape codeword plus
Codec.Coder.escapedSymbolLength().- Specified by:
codewordLengthin interfaceCodec.Coder- Parameters:
symbol- a symbol provided at construction time.- Returns:
- the length of the codeword associated with the given symbol.
-
maxCodewordLength
public int maxCodewordLength()Description copied from interface:Codec.CoderReturns the maximum length of a codeword (including escaped symbols).- Specified by:
maxCodewordLengthin interfaceCodec.Coder- Returns:
- the maximum length of a codeword (including escaped symbols).
-
getDecoder
Description copied from interface:Codec.CoderReturn a decoder associated with this coder.- Specified by:
getDecoderin interfaceCodec.Coder- Returns:
- a decoder associated with this coder.
-