org.apache.lucene.util.packed
Class AppendingPackedLongBuffer

java.lang.Object
  extended by org.apache.lucene.index.NumericDocValues
      extended by org.apache.lucene.util.LongValues
          extended by org.apache.lucene.util.packed.AppendingPackedLongBuffer

public final class AppendingPackedLongBuffer
extends LongValues

Utility class to buffer a list of signed longs in memory. This class only supports appending and is optimized for non-negative numbers with a uniform distribution over a fixed (limited) range

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Field Summary
 
Fields inherited from class org.apache.lucene.index.NumericDocValues
EMPTY
 
Constructor Summary
AppendingPackedLongBuffer()
          Create an AppendingPackedLongBuffer with initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULT
AppendingPackedLongBuffer(float acceptableOverheadRatio)
          Create an AppendingPackedLongBuffer with initialPageCount=16, pageSize=1024
AppendingPackedLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio)
          AppendingPackedLongBuffer
 
Method Summary
 void add(long l)
          Append a value to this buffer.
 void freeze()
          Pack all pending values in this buffer.
 long get(long index)
          Get value at index.
 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 iterator()
          Return an iterator over the values of this buffer.
 long ramBytesUsed()
          Return the number of bytes used by this instance.
 long size()
          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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppendingPackedLongBuffer

public AppendingPackedLongBuffer(int initialPageCount,
                                 int pageSize,
                                 float acceptableOverheadRatio)
AppendingPackedLongBuffer

Parameters:
initialPageCount - the initial number of pages
pageSize - the size of a single page
acceptableOverheadRatio - an acceptable overhead ratio per value

AppendingPackedLongBuffer

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


AppendingPackedLongBuffer

public AppendingPackedLongBuffer(float acceptableOverheadRatio)
Create an AppendingPackedLongBuffer with initialPageCount=16, pageSize=1024

Method Detail

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.


ramBytesUsed

public long ramBytesUsed()
Return the number of bytes used by this instance.


freeze

public void freeze()
Pack all pending values in this buffer. Subsequent calls to add(long) will fail.



Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.