Package org.apache.lucene.util.packed
Class PagedGrowableWriter
java.lang.Object
org.apache.lucene.index.NumericDocValues
org.apache.lucene.util.LongValues
org.apache.lucene.util.packed.PagedGrowableWriter
A
PagedGrowableWriter
. This class slices data into fixed-size blocks
which have independent numbers of bits per value and grow on-demand.
You should use this class instead of the AbstractAppendingLongBuffer
related ones only when
you need random write-access. Otherwise this class will likely be slower and
less memory-efficient.
-
Field Summary
Fields inherited from class org.apache.lucene.index.NumericDocValues
EMPTY
-
Constructor Summary
ConstructorsConstructorDescriptionPagedGrowableWriter
(long size, int pageSize, int startBitsPerValue, float acceptableOverheadRatio) Create a newPagedGrowableWriter
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected long
protected final void
final long
get
(long index) Get value atindex
.final PagedGrowableWriter
grow()
Similar toArrayUtil.grow(long[])
.final PagedGrowableWriter
grow
(long minSize) Similar toArrayUtil.grow(long[], int)
.protected PackedInts.Mutable
newMutable
(int valueCount, int bitsPerValue) protected PagedGrowableWriter
newUnfilledCopy
(long newSize) long
Return the number of bytes used by this object.final PagedGrowableWriter
resize
(long newSize) Create a new copy of sizenewSize
based on the content of this buffer.final void
set
(long index, long value) Set value atindex
.final long
size()
The number of values.final String
toString()
Methods inherited from class org.apache.lucene.util.LongValues
get
-
Constructor Details
-
PagedGrowableWriter
public PagedGrowableWriter(long size, int pageSize, int startBitsPerValue, float acceptableOverheadRatio) Create a newPagedGrowableWriter
instance.- Parameters:
size
- the number of values to store.pageSize
- the number of values per pagestartBitsPerValue
- the initial number of bits per valueacceptableOverheadRatio
- an acceptable overhead ratio
-
-
Method Details
-
newMutable
-
newUnfilledCopy
-
baseRamBytesUsed
protected long baseRamBytesUsed() -
fillPages
protected final void fillPages() -
size
public final long size()The number of values. -
get
public final long get(long index) Description copied from class:LongValues
Get value atindex
.- Specified by:
get
in classLongValues
-
set
public final void set(long index, long value) Set value atindex
. -
ramBytesUsed
public long ramBytesUsed()Return the number of bytes used by this object. -
resize
Create a new copy of sizenewSize
based on the content of this buffer. This method is much more efficient than creating a new instance and copying values one by one. -
grow
Similar toArrayUtil.grow(long[], int)
. -
grow
Similar toArrayUtil.grow(long[])
. -
toString
-