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 for PagedMutable and PagedGrowableWriter.
  • Field Details

    • MIN_BLOCK_SIZE

      static final int MIN_BLOCK_SIZE
      See Also:
    • MAX_BLOCK_SIZE

      static final int MAX_BLOCK_SIZE
      See Also:
    • size

      final long size
    • pageShift

      final int pageShift
    • pageMask

      final int pageMask
    • subMutables

      final PackedInts.Mutable[] subMutables
    • bitsPerValue

      final int bitsPerValue
  • Constructor Details

    • AbstractPagedMutable

      AbstractPagedMutable(int bitsPerValue, long size, int pageSize)
  • Method Details

    • 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 at index.
      Specified by:
      get in class LongValues
    • set

      public final void set(long index, long value)
      Set value at index.
    • 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 interface Accountable
    • newUnfilledCopy

      protected abstract T newUnfilledCopy(long newSize)
    • resize

      public final T resize(long newSize)
      Create a new copy of size newSize 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)
    • grow

      public final T grow()
    • toString

      public final String toString()
      Overrides:
      toString in class Object