Package org.apache.lucene.util.packed
Class AppendingDeltaPackedLongBuffer
- java.lang.Object
-
- org.apache.lucene.index.NumericDocValues
-
- org.apache.lucene.util.LongValues
-
- org.apache.lucene.util.packed.AppendingDeltaPackedLongBuffer
-
public final class AppendingDeltaPackedLongBuffer extends LongValues
Utility class to buffer a list of signed longs in memory. This class only supports appending and is optimized for the case where values are close to each other.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.NumericDocValues
EMPTY
-
-
Constructor Summary
Constructors Constructor Description AppendingDeltaPackedLongBuffer()Create anAppendingDeltaPackedLongBufferwith initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULTAppendingDeltaPackedLongBuffer(float acceptableOverheadRatio)Create anAppendingDeltaPackedLongBufferwith initialPageCount=16, pageSize=1024AppendingDeltaPackedLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long l)Append a value to this buffer.voidfreeze()Pack all pending values in this buffer.longget(long index)Get value atindex.intget(long index, long[] arr, int off, int len)Bulk get: read at least one and at mostlenlongs starting fromindexintoarr[off:off+len]and return the actual number of values that have been read.org.apache.lucene.util.packed.AbstractAppendingLongBuffer.Iteratoriterator()Return an iterator over the values of this buffer.longramBytesUsed()Return the number of bytes used by this instance.longsize()Get the number of values that have been added to the buffer.-
Methods inherited from class org.apache.lucene.util.LongValues
get
-
-
-
-
Constructor Detail
-
AppendingDeltaPackedLongBuffer
public AppendingDeltaPackedLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio)- Parameters:
initialPageCount- the initial number of pagespageSize- the size of a single pageacceptableOverheadRatio- an acceptable overhead ratio per value
-
AppendingDeltaPackedLongBuffer
public AppendingDeltaPackedLongBuffer()
Create anAppendingDeltaPackedLongBufferwith initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULT
-
AppendingDeltaPackedLongBuffer
public AppendingDeltaPackedLongBuffer(float acceptableOverheadRatio)
Create anAppendingDeltaPackedLongBufferwith initialPageCount=16, pageSize=1024
-
-
Method Detail
-
ramBytesUsed
public long ramBytesUsed()
Return the number of bytes used by this instance.
-
size
public final long size()
Get the number of values that have been added to the buffer.
-
add
public final void add(long l)
Append a value to this buffer.
-
get
public final long get(long index)
Description copied from class:LongValuesGet value atindex.- Specified by:
getin classLongValues
-
get
public final int get(long index, long[] arr, int off, int len)Bulk get: read at least one and at mostlenlongs starting fromindexintoarr[off:off+len]and return the actual number of values that have been read.
-
iterator
public org.apache.lucene.util.packed.AbstractAppendingLongBuffer.Iterator iterator()
Return an iterator over the values of this buffer.
-
freeze
public void freeze()
Pack all pending values in this buffer. Subsequent calls toadd(long)will fail.
-
-