Package org.apache.lucene.util.packed
Class PackedInts.ReaderImpl
- java.lang.Object
-
- org.apache.lucene.util.packed.PackedInts.ReaderImpl
-
- All Implemented Interfaces:
PackedInts.Reader
- Enclosing class:
- PackedInts
public abstract static class PackedInts.ReaderImpl extends Object implements PackedInts.Reader
A simple base for Readers that keeps track of valueCount and bitsPerValue.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description protected intbitsPerValueprotected intvalueCount
-
Constructor Summary
Constructors Modifier Constructor Description protectedReaderImpl(int valueCount, int bitsPerValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetArray()Expert: if the bit-width of this reader matches one of java's native types, returns the underlying array (ie, byte[], short[], int[], long[]); else, returns null.intgetBitsPerValue()longgetMaxValue()booleanhasArray()Returns true if this implementation is backed by a native java array.intsize()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.packed.PackedInts.Reader
get
-
-
-
-
Method Detail
-
getBitsPerValue
public int getBitsPerValue()
- Specified by:
getBitsPerValuein interfacePackedInts.Reader- Returns:
- the number of bits used to store any given value.
Note: This does not imply that memory usage is
bitsPerValue * #valuesas implementations are free to use non-space-optimal packing of bits.
-
size
public int size()
- Specified by:
sizein interfacePackedInts.Reader- Returns:
- the number of values.
-
getMaxValue
public long getMaxValue()
-
getArray
public Object getArray()
Description copied from interface:PackedInts.ReaderExpert: if the bit-width of this reader matches one of java's native types, returns the underlying array (ie, byte[], short[], int[], long[]); else, returns null. Note that when accessing the array you must upgrade the type (bitwise AND with all ones), to interpret the full value as unsigned. Ie, bytes[idx]&0xFF, shorts[idx]&0xFFFF, etc.- Specified by:
getArrayin interfacePackedInts.Reader
-
hasArray
public boolean hasArray()
Description copied from interface:PackedInts.ReaderReturns true if this implementation is backed by a native java array.- Specified by:
hasArrayin interfacePackedInts.Reader- See Also:
PackedInts.Reader.getArray()
-
-