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 forPagedMutable
andPagedGrowableWriter
.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
bitsPerValue
(package private) static int
MAX_BLOCK_SIZE
(package private) static int
MIN_BLOCK_SIZE
(package private) int
pageMask
(package private) int
pageShift
(package private) long
size
(package private) PackedInts.Mutable[]
subMutables
-
Fields inherited from class org.apache.lucene.util.LongValues
IDENTITY, ZEROES
-
-
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 long
baseRamBytesUsed()
protected void
fillPages()
long
get(long index)
Get value atindex
.T
grow()
Similar toArrayUtil.grow(long[])
.T
grow(long minSize)
Similar toArrayUtil.grow(long[], int)
.(package private) int
indexInPage(long index)
(package private) int
lastPageSize(long size)
protected abstract PackedInts.Mutable
newMutable(int valueCount, int bitsPerValue)
protected abstract T
newUnfilledCopy(long newSize)
(package private) int
pageIndex(long index)
(package private) int
pageSize()
long
ramBytesUsed()
Return the memory usage of this object in bytes.T
resize(long newSize)
Create a new copy of sizenewSize
based on the content of this buffer.void
set(long index, long value)
Set value atindex
.long
size()
The number of values.java.lang.String
toString()
-
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:LongValues
Get value atindex
.- Specified by:
get
in 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:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
newUnfilledCopy
protected abstract T newUnfilledCopy(long newSize)
-
resize
public final T resize(long newSize)
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
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:
toString
in classjava.lang.Object
-
-