org.apache.lucene.facet.encoding
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() |
encodeChunkpublic NOnesIntEncoder(int n)
public void encode(IntsRef values, BytesRef buf)
IntEncoderencode in class FourFlagsIntEncoderpublic IntDecoder createMatchingDecoder()
IntEncoderIntDecoder which can decode the values that were encoded
with this encoder.createMatchingDecoder in class FourFlagsIntEncoderpublic String toString()
toString in class FourFlagsIntEncoderCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.