Class IntBlockPool

java.lang.Object
org.apache.lucene.util.IntBlockPool

public final class IntBlockPool extends Object
A pool for int blocks similar to ByteBlockPool
  • Field Details

    • INT_BLOCK_SHIFT

      public static final int INT_BLOCK_SHIFT
      See Also:
    • INT_BLOCK_SIZE

      public static final int INT_BLOCK_SIZE
      See Also:
    • INT_BLOCK_MASK

      public static final int INT_BLOCK_MASK
      See Also:
    • buffers

      public int[][] buffers
      array of buffers currently used in the pool. Buffers are allocated if needed don't modify this outside of this class
    • bufferUpto

      private int bufferUpto
      index into the buffers array pointing to the current buffer used as the head
    • intUpto

      public int intUpto
      Pointer to the current position in head buffer
    • buffer

      public int[] buffer
      Current head buffer
    • intOffset

      public int intOffset
      Current head offset
    • allocator

      private final IntBlockPool.Allocator allocator
    • NEXT_LEVEL_ARRAY

      private static final int[] NEXT_LEVEL_ARRAY
      An array holding the offset into the LEVEL_SIZE_ARRAY to quickly navigate to the next slice level.
    • LEVEL_SIZE_ARRAY

      private static final int[] LEVEL_SIZE_ARRAY
      An array holding the level sizes for int slices.
    • FIRST_LEVEL_SIZE

      private static final int FIRST_LEVEL_SIZE
      The first level size for new slices
  • Constructor Details

  • Method Details

    • reset

      public void reset()
      Resets the pool to its initial state reusing the first buffer. Calling nextBuffer() is not needed after reset.
    • reset

      public void reset(boolean zeroFillBuffers, boolean reuseFirst)
      Expert: Resets the pool to its initial state reusing the first buffer.
      Parameters:
      zeroFillBuffers - if true the buffers are filled with 0. This should be set to true if this pool is used with IntBlockPool.SliceWriter.
      reuseFirst - if true the first buffer will be reused and calling nextBuffer() is not needed after reset iff the block pool was used before ie. nextBuffer() was called before.
    • nextBuffer

      public void nextBuffer()
      Advances the pool to its next buffer. This method should be called once after the constructor to initialize the pool. In contrast to the constructor a reset() call will advance the pool to its first buffer immediately.
    • newSlice

      private int newSlice(int size)
      Creates a new int slice with the given starting size and returns the slices offset in the pool.
      See Also:
    • assertSliceBuffer

      private static boolean assertSliceBuffer(int[] buffer)
    • allocSlice

      private int allocSlice(int[] slice, int sliceOffset)
      Allocates a new slice from the given offset