Lucene.Net.Index.DocumentsWriter.GetIntBlock C# (CSharp) Method

GetIntBlock() private method

private GetIntBlock ( bool trackAllocations ) : int[]
trackAllocations bool
return int[]
		internal int[] GetIntBlock(bool trackAllocations)
		{
			lock (this)
			{
				int size = freeIntBlocks.Count;
				int[] b;
				if (0 == size)
				{
					// Always record a block allocated, even if
					// trackAllocations is false.  This is necessary
					// because this block will be shared between
					// things that don't track allocations (term
					// vectors) and things that do (freq/prox
					// postings).
					numBytesAlloc += INT_BLOCK_SIZE * INT_NUM_BYTE;
					b = new int[INT_BLOCK_SIZE];
				}
				else
				{
				    b = freeIntBlocks[size - 1];
				    freeIntBlocks.RemoveAt(size - 1);
				}
				if (trackAllocations)
					numBytesUsed += INT_BLOCK_SIZE * INT_NUM_BYTE;
				System.Diagnostics.Debug.Assert(numBytesUsed <= numBytesAlloc);
				return b;
			}
		}
		

Usage Example

Beispiel #1
0
        public void  NextBuffer()
        {
            if (1 + bufferUpto == buffers.Length)
            {
                Array.Resize(ref buffers, (int)(buffers.Length * 1.5));
            }
            buffer = buffers[1 + bufferUpto] = docWriter.GetIntBlock(trackAllocations);
            bufferUpto++;

            intUpto    = 0;
            intOffset += DocumentsWriter.INT_BLOCK_SIZE;
        }
All Usage Examples Of Lucene.Net.Index.DocumentsWriter::GetIntBlock