org.apache.lucene.util.packed
Class MonotonicAppendingLongBuffer

java.lang.Object
  extended by org.apache.lucene.util.packed.MonotonicAppendingLongBuffer

public final class MonotonicAppendingLongBuffer
extends Object

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.

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

Nested Class Summary
 class MonotonicAppendingLongBuffer.Iterator
          A long iterator.
 
Constructor Summary
MonotonicAppendingLongBuffer()
          Create an MonotonicAppendingLongBuffer with initialPageCount=16 and pageSize=1024.
MonotonicAppendingLongBuffer(int initialPageCount, int pageSize)
           
 
Method Summary
 void add(long l)
          Append a value to this buffer.
 long get(long index)
          Get a value from this buffer.
 MonotonicAppendingLongBuffer.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonotonicAppendingLongBuffer

public MonotonicAppendingLongBuffer(int initialPageCount,
                                    int pageSize)
Parameters:
initialPageCount - the initial number of pages
pageSize - the size of a single page

MonotonicAppendingLongBuffer

public MonotonicAppendingLongBuffer()
Create an MonotonicAppendingLongBuffer with initialPageCount=16 and pageSize=1024.

Method Detail

iterator

public MonotonicAppendingLongBuffer.Iterator iterator()
Return an iterator over the values of this buffer.


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)
Get a value from this buffer.



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