AbstractPagedMutable (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.util.packed, class: AbstractPagedMutable

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 for `PagedMutable` and `PagedGrowableWriter`.

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

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.util.LongValues

  `IDENTITY, ZEROES`

  ### Fields inherited from interface org.apache.lucene.util.Accountable

  `NULL_ACCOUNTABLE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected long`
  `baseRamBytesUsed()`
  `protected final void`
  `fillPages()`
  `final long`
  `get(long index)`
  Get value at `index`.
  `final T`
  `grow()`
  Similar to `ArrayUtil.grow(long[])`.
  `final T`
  `grow(long minSize)`
  Similar to `ArrayUtil.grow(long[], int)`.
  `protected abstract PackedInts.Mutable`
  `newMutable(int valueCount, int bitsPerValue)`
  `protected abstract T`
  `newUnfilledCopy(long newSize)`
  `long`
  `ramBytesUsed()`
  Returns an estimate of the JVM heap memory used by this object in bytes.
  `final T`
  `resize(long newSize)`
  Create a new copy of size `newSize` based on the content of this buffer.
  `final void`
  `set(long index, long value)`
  Set value at `index`.
  `final long`
  `size()`
  The number of values.
  `final 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`

- ## Method Details

  - ### fillPages

    protected final void fillPages()

  - ### newMutable

    protected abstract PackedInts.Mutable newMutable(int valueCount, int bitsPerValue)

  - ### size

    public final long size()
    The number of values.

  - ### 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`
    Returns an estimate of the JVM heap memory used by this object in bytes. The method name uses "ram" for historical reasons; only JVM heap memory should be reported. Off-heap resources such as memory-mapped files or native direct buffers should not be included. 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)
    Similar to `ArrayUtil.grow(long[], int)`.

  - ### grow

    public final T grow()
    Similar to `ArrayUtil.grow(long[])`.

  - ### toString

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