亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bitvector.cs

?? 介紹有關全文檢索的類庫,以lucene為例,在.net環(huán)境下實現(xiàn)多種類型文檔的全文檢索.
?? CS
字號:
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using System;

using Directory = Lucene.Net.Store.Directory;
using IndexInput = Lucene.Net.Store.IndexInput;
using IndexOutput = Lucene.Net.Store.IndexOutput;

namespace Lucene.Net.Util
{
	
	/// <summary>Optimized implementation of a vector of bits.  This is more-or-less like
	/// java.util.BitSet, but also includes the following:
	/// <ul>
	/// <li>a count() method, which efficiently computes the number of one bits;</li>
	/// <li>optimized read from and write to disk;</li>
	/// <li>inlinable get() method;</li>
	/// <li>store and load, as bit set or d-gaps, depending on sparseness;</li> 
	/// </ul>
	/// </summary>
	/// <author>  Doug Cutting
	/// </author>
	/// <version>  $Id: BitVector.java 494136 2007-01-08 18:11:08Z mikemccand $
	/// </version>
	public sealed class BitVector
	{
		
		private byte[] bits;
		private int size;
		private int count = - 1;
		
		/// <summary>Constructs a vector capable of holding <code>n</code> bits. </summary>
		public BitVector(int n)
		{
			size = n;
			bits = new byte[(size >> 3) + 1];
		}
		
		/// <summary>Sets the value of <code>bit</code> to one. </summary>
		public void  Set(int bit)
		{
			if (bit >= size)
			{
				throw new System.IndexOutOfRangeException("Index of bound " + bit);
			}
			bits[bit >> 3] |= (byte) (1 << (bit & 7));
			count = - 1;
		}
		
		/// <summary>Sets the value of <code>bit</code> to zero. </summary>
		public void  Clear(int bit)
		{
			if (bit >= size)
			{
				throw new System.IndexOutOfRangeException("Index of bound " + bit);
			}
			bits[bit >> 3] &= (byte) (~ (1 << (bit & 7)));
			count = - 1;
		}
		
		/// <summary>Returns <code>true</code> if <code>bit</code> is one and
		/// <code>false</code> if it is zero. 
		/// </summary>
		public bool Get(int bit)
		{
			if (bit >= size)
			{
				throw new System.IndexOutOfRangeException("Index of bound " + bit);
			}
			return (bits[bit >> 3] & (1 << (bit & 7))) != 0;
		}
		
		/// <summary>Returns the number of bits in this vector.  This is also one greater than
		/// the number of the largest valid bit number. 
		/// </summary>
		public int Size()
		{
			return size;
		}
		
		/// <summary>Returns the total number of one bits in this vector.  This is efficiently
		/// computed and cached, so that, if the vector is not changed, no
		/// recomputation is done for repeated calls. 
		/// </summary>
		public int Count()
		{
			// if the vector has been modified
			if (count == - 1)
			{
				int c = 0;
				int end = bits.Length;
				for (int i = 0; i < end; i++)
					c += BYTE_COUNTS[bits[i] & 0xFF]; // sum bits per byte
				count = c;
			}
			return count;
		}
		
		private static readonly byte[] BYTE_COUNTS = new byte[]{0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
		
		
		/// <summary>Writes this vector to the file <code>name</code> in Directory
		/// <code>d</code>, in a format that can be read by the constructor {@link
		/// #BitVector(Directory, String)}.  
		/// </summary>
		public void  Write(Directory d, System.String name)
		{
			IndexOutput output = d.CreateOutput(name);
			try
			{
				if (IsSparse())
				{
					WriteDgaps(output); // sparse bit-set more efficiently saved as d-gaps.
				}
				else
				{
					WriteBits(output);
				}
			}
			finally
			{
				output.Close();
			}
		}
		
		/// <summary>Write as a bit set </summary>
		private void  WriteBits(IndexOutput output)
		{
			output.WriteInt(Size()); // write size
			output.WriteInt(Count()); // write count
			output.WriteBytes(bits, bits.Length);
		}
		
		/// <summary>Write as a d-gaps list </summary>
		private void  WriteDgaps(IndexOutput output)
		{
			output.WriteInt(- 1); // mark using d-gaps                         
			output.WriteInt(Size()); // write size
			output.WriteInt(Count()); // write count
			int last = 0;
			int n = Count();
			int m = bits.Length;
			for (int i = 0; i < m && n > 0; i++)
			{
				if (bits[i] != 0)
				{
					output.WriteVInt(i - last);
					output.WriteByte(bits[i]);
					last = i;
					n -= BYTE_COUNTS[bits[i] & 0xFF];
				}
			}
		}
		
		/// <summary>Indicates if the bit vector is sparse and should be saved as a d-gaps list, or dense, and should be saved as a bit set. </summary>
		private bool IsSparse()
		{
			// note: order of comparisons below set to favor smaller values (no binary range search.)
			// note: adding 4 because we start with ((int) -1) to indicate d-gaps format.
			// note: we write the d-gap for the byte number, and the byte (bits[i]) itself, therefore
			//       multiplying count by (8+8) or (8+16) or (8+24) etc.:
			//       - first 8 for writing bits[i] (1 byte vs. 1 bit), and 
			//       - second part for writing the byte-number d-gap as vint. 
			// note: factor is for read/write of byte-arrays being faster than vints.  
			int factor = 10;
			if (bits.Length < (1 << 7))
				return factor * (4 + (8 + 8) * Count()) < Size();
			if (bits.Length < (1 << 14))
				return factor * (4 + (8 + 16) * Count()) < Size();
			if (bits.Length < (1 << 21))
				return factor * (4 + (8 + 24) * Count()) < Size();
			if (bits.Length < (1 << 28))
				return factor * (4 + (8 + 32) * Count()) < Size();
			return factor * (4 + (8 + 40) * Count()) < Size();
		}
		
		/// <summary>Constructs a bit vector from the file <code>name</code> in Directory
		/// <code>d</code>, as written by the {@link #write} method.
		/// </summary>
		public BitVector(Directory d, System.String name)
		{
			IndexInput input = d.OpenInput(name);
			try
			{
				size = input.ReadInt(); // read size
				if (size == - 1)
				{
					ReadDgaps(input);
				}
				else
				{
					ReadBits(input);
				}
			}
			finally
			{
				input.Close();
			}
		}
		
		/// <summary>Read as a bit set </summary>
		private void  ReadBits(IndexInput input)
		{
			count = input.ReadInt(); // read count
			bits = new byte[(size >> 3) + 1]; // allocate bits
			input.ReadBytes(bits, 0, bits.Length);
		}
		
		/// <summary>read as a d-gaps list </summary>
		private void  ReadDgaps(IndexInput input)
		{
			size = input.ReadInt(); // (re)read size
			count = input.ReadInt(); // read count
			bits = new byte[(size >> 3) + 1]; // allocate bits
			int last = 0;
			int n = Count();
			while (n > 0)
			{
				last += input.ReadVInt();
				bits[last] = input.ReadByte();
				n -= BYTE_COUNTS[bits[last] & 0xFF];
			}
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区不卡| 中文字幕一区日韩精品欧美| 日韩一级视频免费观看在线| 欧美国产97人人爽人人喊| 亚洲一二三四区不卡| 国产曰批免费观看久久久| 色婷婷国产精品久久包臀| 久久久综合激的五月天| 香蕉乱码成人久久天堂爱免费| 国产酒店精品激情| 欧美一级日韩不卡播放免费| 中文字幕亚洲区| 国产成人在线网站| 日韩欧美亚洲一区二区| 亚洲第一福利视频在线| 色就色 综合激情| 中文字幕一区二区三区蜜月| 国产乱码精品一区二区三 | 午夜欧美电影在线观看| www.色精品| 中文字幕欧美日韩一区| 国产一区二区三区四| 日韩精品在线网站| 蜜桃在线一区二区三区| 3d动漫精品啪啪1区2区免费 | 国产日韩三级在线| 九色综合国产一区二区三区| 日韩午夜在线观看| 美女一区二区三区在线观看| 69精品人人人人| 日日摸夜夜添夜夜添亚洲女人| 欧美性感一类影片在线播放| 亚洲视频一区在线| 91国偷自产一区二区使用方法| 亚洲激情成人在线| 在线观看日韩毛片| 亚洲成人av免费| 欧美剧情片在线观看| 日韩女优毛片在线| 欧美大片拔萝卜| 2023国产精品| 久久久电影一区二区三区| 久久综合狠狠综合久久综合88| 欧美一级夜夜爽| 久久综合九色综合欧美就去吻| 国产午夜亚洲精品午夜鲁丝片| ww亚洲ww在线观看国产| 国产欧美精品在线观看| 久久精品亚洲精品国产欧美 | 69堂国产成人免费视频| 日韩免费成人网| 六月丁香婷婷色狠狠久久| 91精品欧美久久久久久动漫| 不卡的av网站| 亚洲欧美福利一区二区| 欧美调教femdomvk| 免费成人你懂的| 久久久精品中文字幕麻豆发布| 国产1区2区3区精品美女| 亚洲激情网站免费观看| 日韩欧美国产一区在线观看| 国产一区二区久久| 亚洲男人电影天堂| 欧美性猛交xxxxxxxx| 久久精品国产77777蜜臀| 欧美极品xxx| 欧美视频一区二区三区四区| 久久99九九99精品| 一区二区三区 在线观看视频| 欧美精三区欧美精三区| 国产精品69久久久久水密桃| 亚洲欧美aⅴ...| 欧美成人精品二区三区99精品| av中文字幕亚洲| 免费在线观看一区| 亚洲精品中文在线观看| 精品国产99国产精品| 在线亚洲精品福利网址导航| 国产在线乱码一区二区三区| 亚洲免费在线视频| 久久久五月婷婷| 欧美日韩精品二区第二页| 国产suv精品一区二区883| 天堂在线亚洲视频| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 91麻豆精品91久久久久久清纯| 不卡高清视频专区| 国内精品久久久久影院色| 亚洲成人自拍网| 亚洲日本免费电影| 日本一区二区三区四区| 日韩欧美国产一区在线观看| 欧美三级欧美一级| 91麻豆国产自产在线观看| 国产揄拍国内精品对白| 蜜桃一区二区三区在线观看| 亚洲高清在线视频| 亚洲精品乱码久久久久久久久| 国产日韩欧美亚洲| 久久久亚洲精华液精华液精华液| 91精品免费在线| 在线不卡免费欧美| 欧美日韩精品福利| 欧美日韩国产高清一区二区三区| 91国产免费观看| 91浏览器在线视频| 91浏览器在线视频| 91在线精品秘密一区二区| 成人午夜在线播放| 成人国产精品免费观看动漫| 懂色av一区二区夜夜嗨| 国产成人在线视频网址| 国产成人精品免费网站| 风流少妇一区二区| 成人久久视频在线观看| 国产成人综合亚洲91猫咪| 国产凹凸在线观看一区二区| 成人午夜激情影院| 北岛玲一区二区三区四区| 成人午夜视频免费看| 99国产精品99久久久久久| 91在线精品秘密一区二区| 色哟哟一区二区| 欧美三级视频在线| 日韩欧美中文字幕公布| 欧美岛国在线观看| 亚洲国产精品成人综合| 《视频一区视频二区| 亚洲综合网站在线观看| 亚洲.国产.中文慕字在线| 免费美女久久99| 国产精品影视在线| 91蝌蚪国产九色| 欧美日韩成人综合| 欧美成人一区二区三区片免费| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲国产精品99久久久久久久久 | 717成人午夜免费福利电影| 日韩丝袜情趣美女图片| 国产亚洲欧美日韩俺去了| 国产精品免费视频一区| 亚洲国产精品欧美一二99 | 亚洲国产你懂的| 蜜臀av性久久久久av蜜臀妖精| 国产精品影视网| 欧洲亚洲国产日韩| 精品国产a毛片| 一区二区在线观看免费视频播放| 水野朝阳av一区二区三区| 国产精品99久| 在线看国产一区| www国产精品av| 亚洲一区欧美一区| 国产成人综合精品三级| 欧美色涩在线第一页| 久久久亚洲欧洲日产国码αv| 一区二区三区日韩欧美精品| 久久精品免费观看| 色综合av在线| 国产亚洲成年网址在线观看| 一区二区三区影院| 精品一区二区三区在线视频| 91原创在线视频| 久久先锋影音av鲁色资源网| 亚洲激情欧美激情| 不卡av电影在线播放| 6080午夜不卡| 亚洲另类色综合网站| 国产精品456露脸| 日韩欧美国产综合| 午夜伊人狠狠久久| 91视频一区二区三区| 久久亚洲精华国产精华液| 婷婷国产在线综合| 色婷婷国产精品| 中文字幕在线不卡一区| 国产一区二区看久久| 欧美一区二区成人| 亚洲国产毛片aaaaa无费看| 成人免费高清视频| 久久久91精品国产一区二区精品| 五月天亚洲婷婷| 色8久久精品久久久久久蜜| 亚洲国产精品二十页| 国产福利一区二区三区| 日韩三级伦理片妻子的秘密按摩| 亚洲午夜影视影院在线观看| 99精品热视频| 国产精品免费视频观看| 国产一区二区精品在线观看| 欧美成人一级视频| 老司机免费视频一区二区三区| 欧美群妇大交群中文字幕| 亚洲一区二区不卡免费| 在线观看欧美黄色| 亚洲高清一区二区三区| 欧美日韩成人在线一区| 热久久久久久久| 日韩欧美一二三区| 国产一区二区三区香蕉|