Package org.apache.lucene.util.packed
Class AbstractPagedMutable<T extends AbstractPagedMutable<T>>
- java.lang.Object
-
- org.apache.lucene.util.LongValues
-
- org.apache.lucene.util.packed.AbstractPagedMutable<T>
-
- All Implemented Interfaces:
Accountable
- Direct Known Subclasses:
PagedGrowableWriter,PagedMutable
public abstract class AbstractPagedMutable<T extends AbstractPagedMutable<T>> extends LongValues implements Accountable
Base implementation forPagedMutableandPagedGrowableWriter.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intbitsPerValue(package private) static intMAX_BLOCK_SIZE(package private) static intMIN_BLOCK_SIZE(package private) intpageMask(package private) intpageShift(package private) longsize(package private) PackedInts.Mutable[]subMutables-
Fields inherited from class org.apache.lucene.util.LongValues
IDENTITY, ZEROES
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description AbstractPagedMutable(int bitsPerValue, long size, int pageSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected longbaseRamBytesUsed()protected voidfillPages()longget(long index)Get value atindex.Tgrow()Similar toArrayUtil.grow(long[]).Tgrow(long minSize)Similar toArrayUtil.grow(long[], int).(package private) intindexInPage(long index)(package private) intlastPageSize(long size)protected abstract PackedInts.MutablenewMutable(int valueCount, int bitsPerValue)protected abstract TnewUnfilledCopy(long newSize)(package private) intpageIndex(long index)(package private) intpageSize()longramBytesUsed()Return the memory usage of this object in bytes.Tresize(long newSize)Create a new copy of sizenewSizebased on the content of this buffer.voidset(long index, long value)Set value atindex.longsize()The number of values.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Field Detail
-
MIN_BLOCK_SIZE
static final int MIN_BLOCK_SIZE
- See Also:
- Constant Field Values
-
MAX_BLOCK_SIZE
static final int MAX_BLOCK_SIZE
- See Also:
- Constant Field Values
-
size
final long size
-
pageShift
final int pageShift
-
pageMask
final int pageMask
-
subMutables
final PackedInts.Mutable[] subMutables
-
bitsPerValue
final int bitsPerValue
-
-
Method Detail
-
fillPages
protected final void fillPages()
-
newMutable
protected abstract PackedInts.Mutable newMutable(int valueCount, int bitsPerValue)
-
lastPageSize
final int lastPageSize(long size)
-
pageSize
final int pageSize()
-
size
public final long size()
The number of values.
-
pageIndex
final int pageIndex(long index)
-
indexInPage
final int indexInPage(long index)
-
get
public final long get(long index)
Description copied from class:LongValuesGet value atindex.- Specified by:
getin classLongValues
-
set
public final void set(long index, long value)Set value atindex.
-
baseRamBytesUsed
protected long baseRamBytesUsed()
-
ramBytesUsed
public long ramBytesUsed()
Description copied from interface:AccountableReturn the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsedin interfaceAccountable
-
newUnfilledCopy
protected abstract T newUnfilledCopy(long newSize)
-
resize
public final T resize(long newSize)
Create a new copy of sizenewSizebased on the content of this buffer. This method is much more efficient than creating a new instance and copying values one by one.
-
grow
public final T grow(long minSize)
Similar toArrayUtil.grow(long[], int).
-
grow
public final T grow()
Similar toArrayUtil.grow(long[]).
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-