Package org.apache.lucene.util
Class IntBlockPool
java.lang.Object
org.apache.lucene.util.IntBlockPool
A pool for int blocks similar to
ByteBlockPool-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAbstract class for allocating and freeing int blocks.static final classA simpleIntBlockPool.Allocatorthat never recycles.static final classAIntBlockPool.SliceReaderthat can read int slices written by aIntBlockPool.SliceWriterstatic classAIntBlockPool.SliceWriterthat allows to write multiple integer slices into a givenIntBlockPool. -
Field Summary
FieldsModifier and TypeFieldDescriptionint[]Current head bufferint[][]array of buffers currently used in the pool.static final intstatic final intstatic final intintCurrent head offsetintPointer to the current position in head buffer -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newIntBlockPoolwith a defaultIntBlockPool.Allocator.IntBlockPool(IntBlockPool.Allocator allocator) Creates a newIntBlockPoolwith the givenIntBlockPool.Allocator. -
Method Summary
-
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[][] buffersarray of buffers currently used in the pool. Buffers are allocated if needed don't modify this outside of this class -
intUpto
public int intUptoPointer to the current position in head buffer -
buffer
public int[] bufferCurrent head buffer -
intOffset
public int intOffsetCurrent head offset
-
-
Constructor Details
-
IntBlockPool
public IntBlockPool()Creates a newIntBlockPoolwith a defaultIntBlockPool.Allocator.- See Also:
-
IntBlockPool
Creates a newIntBlockPoolwith the givenIntBlockPool.Allocator.- See Also:
-
-
Method Details
-
reset
public void reset()Resets the pool to its initial state reusing the first buffer. CallingnextBuffer()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- iftruethe buffers are filled with 0. This should be set totrueif this pool is used withIntBlockPool.SliceWriter.reuseFirst- iftruethe first buffer will be reused and callingnextBuffer()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 areset()call will advance the pool to its first buffer immediately.
-