コード例 #1
0
        /// <summary>
        /// Loads the skip levels. </summary>
        private void LoadSkipLevels()
        {
            if (docCount <= skipInterval[0])
            {
                numberOfSkipLevels = 1;
            }
            else
            {
                numberOfSkipLevels = 1 + MathUtil.Log(docCount / skipInterval[0], skipMultiplier);
            }

            if (numberOfSkipLevels > m_maxNumberOfSkipLevels)
            {
                numberOfSkipLevels = m_maxNumberOfSkipLevels;
            }

            skipStream[0].Seek(skipPointer[0]);

            int toBuffer = numberOfLevelsToBuffer;

            for (int i = numberOfSkipLevels - 1; i > 0; i--)
            {
                // the length of the current level
                long length = skipStream[0].ReadVInt64();

                // the start pointer of the current level
                skipPointer[i] = skipStream[0].GetFilePointer();
                if (toBuffer > 0)
                {
                    // buffer this level
                    skipStream[i] = new SkipBuffer(skipStream[0], (int)length);
                    toBuffer--;
                }
                else
                {
                    // clone this stream, it is already at the start of the current level
                    skipStream[i] = (IndexInput)skipStream[0].Clone();
                    if (inputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
                    {
                        ((BufferedIndexInput)skipStream[i]).SetBufferSize((int)length);
                    }

                    // move base stream beyond the current level
                    skipStream[0].Seek(skipStream[0].GetFilePointer() + length);
                }
            }

            // use base stream for the lowest level
            skipPointer[0] = skipStream[0].GetFilePointer();
        }
コード例 #2
0
        /// <summary>
        /// Loads the skip levels </summary>
        private void LoadSkipLevels()
        {
            if (DocCount <= SkipInterval[0])
            {
                NumberOfSkipLevels = 1;
            }
            else
            {
                NumberOfSkipLevels = 1 + MathUtil.Log(DocCount / SkipInterval[0], SkipMultiplier);
            }

            if (NumberOfSkipLevels > MaxNumberOfSkipLevels)
            {
                NumberOfSkipLevels = MaxNumberOfSkipLevels;
            }

            SkipStream[0].Seek(SkipPointer[0]);

            int toBuffer = NumberOfLevelsToBuffer;

            for (int i = NumberOfSkipLevels - 1; i > 0; i--)
            {
                // the length of the current level
                long length = SkipStream[0].ReadVLong();

                // the start pointer of the current level
                SkipPointer[i] = SkipStream[0].FilePointer;
                if (toBuffer > 0)
                {
                    // buffer this level
                    SkipStream[i] = new SkipBuffer(SkipStream[0], (int)length);
                    toBuffer--;
                }
                else
                {
                    // clone this stream, it is already at the start of the current level
                    SkipStream[i] = (IndexInput)SkipStream[0].Clone();
                    if (InputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
                    {
                        ((BufferedIndexInput)SkipStream[i]).BufferSize_ = (int)length;
                    }

                    // move base stream beyond the current level
                    SkipStream[0].Seek(SkipStream[0].FilePointer + length);
                }
            }

            // use base stream for the lowest level
            SkipPointer[0] = SkipStream[0].FilePointer;
        }
コード例 #3
0
        /// <summary>Loads the skip levels  </summary>
        private void  LoadSkipLevels()
        {
            numberOfSkipLevels = docCount == 0?0:(int)System.Math.Floor(System.Math.Log(docCount) / System.Math.Log(skipInterval[0]));
            if (numberOfSkipLevels > maxNumberOfSkipLevels)
            {
                numberOfSkipLevels = maxNumberOfSkipLevels;
            }

            skipStream[0].Seek(skipPointer[0]);

            int toBuffer = numberOfLevelsToBuffer;

            for (int i = numberOfSkipLevels - 1; i > 0; i--)
            {
                // the length of the current level
                long length = skipStream[0].ReadVLong();

                // the start pointer of the current level
                skipPointer[i] = skipStream[0].FilePointer;
                if (toBuffer > 0)
                {
                    // buffer this level
                    skipStream[i] = new SkipBuffer(skipStream[0], (int)length);
                    toBuffer--;
                }
                else
                {
                    // clone this stream, it is already at the start of the current level
                    skipStream[i] = (IndexInput)skipStream[0].Clone();
                    if (inputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
                    {
                        ((BufferedIndexInput)skipStream[i]).SetBufferSize((int)length);
                    }

                    // move base stream beyond the current level
                    skipStream[0].Seek(skipStream[0].FilePointer + length);
                }
            }

            // use base stream for the lowest level
            skipPointer[0] = skipStream[0].FilePointer;
        }
コード例 #4
0
		/// <summary>Loads the skip levels  </summary>
		private void  LoadSkipLevels()
		{
			numberOfSkipLevels = docCount == 0?0:(int) System.Math.Floor(System.Math.Log(docCount) / System.Math.Log(skipInterval[0]));
			if (numberOfSkipLevels > maxNumberOfSkipLevels)
			{
				numberOfSkipLevels = maxNumberOfSkipLevels;
			}
			
			skipStream[0].Seek(skipPointer[0]);
			
			int toBuffer = numberOfLevelsToBuffer;
			
			for (int i = numberOfSkipLevels - 1; i > 0; i--)
			{
				// the length of the current level
				long length = skipStream[0].ReadVLong();
				
				// the start pointer of the current level
				skipPointer[i] = skipStream[0].FilePointer;
				if (toBuffer > 0)
				{
					// buffer this level
					skipStream[i] = new SkipBuffer(skipStream[0], (int) length);
					toBuffer--;
				}
				else
				{
					// clone this stream, it is already at the start of the current level
					skipStream[i] = (IndexInput) skipStream[0].Clone();
					if (inputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
					{
						((BufferedIndexInput) skipStream[i]).SetBufferSize((int) length);
					}
					
					// move base stream beyond the current level
					skipStream[0].Seek(skipStream[0].FilePointer + length);
				}
			}
			
			// use base stream for the lowest level
			skipPointer[0] = skipStream[0].FilePointer;
		}
コード例 #5
0
        /// <summary>
        /// Loads the skip levels </summary>
        private void LoadSkipLevels()
        {
            if (DocCount <= SkipInterval[0])
            {
                NumberOfSkipLevels = 1;
            }
            else
            {
                NumberOfSkipLevels = 1 + MathUtil.Log(DocCount / SkipInterval[0], SkipMultiplier);
            }

            if (NumberOfSkipLevels > MaxNumberOfSkipLevels)
            {
                NumberOfSkipLevels = MaxNumberOfSkipLevels;
            }

            SkipStream[0].Seek(SkipPointer[0]);

            int toBuffer = NumberOfLevelsToBuffer;

            for (int i = NumberOfSkipLevels - 1; i > 0; i--)
            {
                // the length of the current level
                long length = SkipStream[0].ReadVLong();

                // the start pointer of the current level
                SkipPointer[i] = SkipStream[0].FilePointer;
                if (toBuffer > 0)
                {
                    // buffer this level
                    SkipStream[i] = new SkipBuffer(SkipStream[0], (int)length);
                    toBuffer--;
                }
                else
                {
                    // clone this stream, it is already at the start of the current level
                    SkipStream[i] = (IndexInput)SkipStream[0].Clone();
                    if (InputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
                    {
                        ((BufferedIndexInput)SkipStream[i]).BufferSize_ = (int)length;
                    }

                    // move base stream beyond the current level
                    SkipStream[0].Seek(SkipStream[0].FilePointer + length);
                }
            }

            // use base stream for the lowest level
            SkipPointer[0] = SkipStream[0].FilePointer;
        }