public class NOnesIntEncoder extends FourFlagsIntEncoder
FourFlagsIntEncoder
which translates the data as
follows:
value+1
(2 ⇒ 3, 3
⇒ 4 and so forth).
N
occurrences of 1 are encoded as a single 2.
Encoding examples:
Integer.MAX_VALUE
. 0 is not supported because it's not supported by
FourFlagsIntEncoder
and Integer.MAX_VALUE
because this
encoder translates N to N+1, which will cause an overflow and
Integer.MAX_VALUE
will become a negative number, which is not
supported as well.Integer.MAX_VALUE
. If it is not
the first value to encode, and you wrap this encoder with
DGapIntEncoder
, then the value that will be sent to this encoder will
be MAX_VAL - prev
.encodeQueue, indicator, ordinal
Constructor and Description |
---|
NOnesIntEncoder(int n)
Constructs an encoder with a given value of N (N: Number of consecutive
'1's to be translated into single target value '2').
|
Modifier and Type | Method and Description |
---|---|
IntDecoder |
createMatchingDecoder()
Returns an
IntDecoder which can decode the values that were encoded
with this encoder. |
void |
encode(IntsRef values,
BytesRef buf)
Encodes the values to the given buffer.
|
String |
toString() |
encodeChunk
public NOnesIntEncoder(int n)
public void encode(IntsRef values, BytesRef buf)
IntEncoder
encode
in class FourFlagsIntEncoder
public IntDecoder createMatchingDecoder()
IntEncoder
IntDecoder
which can decode the values that were encoded
with this encoder.createMatchingDecoder
in class FourFlagsIntEncoder
public String toString()
toString
in class FourFlagsIntEncoder
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.