Class MonotonicAppendingLongBuffer

java.lang.Object
org.apache.lucene.index.NumericDocValues
org.apache.lucene.util.LongValues
org.apache.lucene.util.packed.MonotonicAppendingLongBuffer

public final class MonotonicAppendingLongBuffer extends LongValues
Utility class to buffer signed longs in memory, which is optimized for the case where the sequence is monotonic, although it can encode any sequence of arbitrary longs. It only supports appending.
  • Field Summary

    Fields inherited from class org.apache.lucene.index.NumericDocValues

    EMPTY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an MonotonicAppendingLongBuffer with initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULT
    MonotonicAppendingLongBuffer(float acceptableOverheadRatio)
    Create an AppendingDeltaPackedLongBuffer with initialPageCount=16, pageSize=1024
    MonotonicAppendingLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(long l)
    Append a value to this buffer.
    void
    Pack all pending values in this buffer.
    final long
    get(long index)
    Get value at index.
    final int
    get(long index, long[] arr, int off, int len)
    Bulk get: read at least one and at most len longs starting from index into arr[off:off+len] and return the actual number of values that have been read.
    org.apache.lucene.util.packed.AbstractAppendingLongBuffer.Iterator
    Return an iterator over the values of this buffer.
    long
    Return the number of bytes used by this instance.
    final long
    Get the number of values that have been added to the buffer.

    Methods inherited from class org.apache.lucene.util.LongValues

    get

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MonotonicAppendingLongBuffer

      public MonotonicAppendingLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio)
      Parameters:
      initialPageCount - the initial number of pages
      pageSize - the size of a single page
      acceptableOverheadRatio - an acceptable overhead ratio per value
    • MonotonicAppendingLongBuffer

      public MonotonicAppendingLongBuffer()
      Create an MonotonicAppendingLongBuffer with initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULT
    • MonotonicAppendingLongBuffer

      public MonotonicAppendingLongBuffer(float acceptableOverheadRatio)
      Create an AppendingDeltaPackedLongBuffer with initialPageCount=16, pageSize=1024
  • Method Details

    • 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: LongValues
      Get value at index.
      Specified by:
      get in class LongValues
    • get

      public final int get(long index, long[] arr, int off, int len)
      Bulk get: read at least one and at most len longs starting from index into arr[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 to add(long) will fail.