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

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

?? xbplustreebytes.cs

?? R樹與B樹的混合樹
?? CS
字號:
using System;
using System.Collections;

namespace BplusDotNet
{
	/// <summary>
	/// Bplustree with unlimited length strings (but only a fixed prefix is indexed in the tree directly).
	/// </summary>
	public class xBplusTreeBytes : IByteTree
	{
		public BplusTreeBytes tree;
		public int prefixLength;
		public int BucketSizeLimit = -1;
		public xBplusTreeBytes(BplusTreeBytes tree, int prefixLength)
		{
			if (prefixLength<3) 
			{
				throw new BplusTreeException("prefix cannot be smaller than 3 :: "+prefixLength); 
			}
			if (prefixLength>tree.MaxKeyLength()) 
			{
				throw new BplusTreeException("prefix length cannot exceed keylength for internal tree");
			}
			this.tree = tree;
			this.prefixLength = prefixLength;
		}
		public void LimitBucketSize(int limit) 
		{
			this.BucketSizeLimit = limit;
		}
		public static xBplusTreeBytes Initialize(string treefileName, string blockfileName, int PrefixLength, int CultureId,
			int nodesize, int buffersize) 
		{
			return new xBplusTreeBytes(
				BplusTreeBytes.Initialize(treefileName, blockfileName, PrefixLength, CultureId, nodesize, buffersize),
				PrefixLength);
		}
		public static xBplusTreeBytes Initialize(string treefileName, string blockfileName, int PrefixLength, int CultureId) 
		{
			return new xBplusTreeBytes(
				BplusTreeBytes.Initialize(treefileName, blockfileName, PrefixLength, CultureId),
				PrefixLength);
		}
		public static xBplusTreeBytes Initialize(string treefileName, string blockfileName, int PrefixLength) 
		{
			return new xBplusTreeBytes(
				BplusTreeBytes.Initialize(treefileName, blockfileName, PrefixLength),
				PrefixLength);
		}
		public static xBplusTreeBytes Initialize(System.IO.Stream treefile, System.IO.Stream blockfile, int PrefixLength, int CultureId,
			int nodesize, int buffersize) 
		{
			return new xBplusTreeBytes(
				BplusTreeBytes.Initialize(treefile, blockfile, PrefixLength, CultureId, nodesize, buffersize),
				PrefixLength);
		}
		public static xBplusTreeBytes Initialize(System.IO.Stream treefile, System.IO.Stream blockfile, int PrefixLength, int CultureId) 
		{
			return new xBplusTreeBytes(
				BplusTreeBytes.Initialize(treefile, blockfile, PrefixLength, CultureId),
				PrefixLength);
		}
		public static xBplusTreeBytes Initialize(System.IO.Stream treefile, System.IO.Stream blockfile, int PrefixLength) 
		{
			return new xBplusTreeBytes(
				BplusTreeBytes.Initialize(treefile, blockfile, PrefixLength),
				PrefixLength);
		}

		public static xBplusTreeBytes ReOpen(System.IO.Stream treefile, System.IO.Stream blockfile) 
		{
			BplusTreeBytes tree = BplusTreeBytes.ReOpen(treefile, blockfile);
			int prefixLength = tree.MaxKeyLength();
			return new xBplusTreeBytes(tree, prefixLength);
		}
		public static xBplusTreeBytes ReOpen(string treefileName, string blockfileName) 
		{
			BplusTreeBytes tree = BplusTreeBytes.ReOpen(treefileName, blockfileName);
			int prefixLength = tree.MaxKeyLength();
			return new xBplusTreeBytes(tree, prefixLength);
		}
		public static xBplusTreeBytes ReadOnly(string treefileName, string blockfileName) 
		{
			BplusTreeBytes tree = BplusTreeBytes.ReadOnly(treefileName, blockfileName);
			int prefixLength = tree.MaxKeyLength();
			return new xBplusTreeBytes(tree, prefixLength);
		}

		public virtual string PrefixForByteCount(string s, int maxbytecount) 
		{
			if (s.Length<1) 
			{
				return "";
			}
			int prefixcharcount = maxbytecount;
			if (prefixcharcount>s.Length) 
			{
				prefixcharcount = s.Length;
			}
			System.Text.Encoder encode = System.Text.Encoding.UTF8.GetEncoder();
			char[] chars = s.ToCharArray(0, prefixcharcount);
			long length = encode.GetByteCount(chars, 0, prefixcharcount, true);
			while (length>maxbytecount) 
			{
				prefixcharcount--;
				length = encode.GetByteCount(chars, 0, prefixcharcount, true);
			}
			return s.Substring(0, prefixcharcount);
		}
		public bool FindBucketForPrefix(string key, out xBucket bucket, out string prefix, bool keyIsPrefix) 
		{
			bucket = null;
			prefix = key;
			if (!keyIsPrefix) 
			{
				prefix = PrefixForByteCount(key, this.prefixLength);
			}
			object datathing = this.tree.Get(prefix, "");
			if (datathing is byte[]) 
			{
				byte[] databytes = (byte[]) datathing;
				bucket = new xBucket(this);
				bucket.Load(databytes);
				if (bucket.Count()<1) 
				{
					throw new BplusTreeException("empty bucket loaded");
				}
				return true;
			}
			return false; // default
		}

		
		#region ITreeIndex Members

		
		public int Compare(string left, string right) 
		{
			return this.tree.Compare(left, right);
		}

		public void Recover(bool CorrectErrors)
		{
			this.tree.Recover(CorrectErrors);
		}

		public void RemoveKey(string key)
		{
			xBucket bucket;
			string prefix;
			bool found = FindBucketForPrefix(key, out bucket, out prefix, false);
			if (!found) 
			{
				throw new BplusTreeKeyMissing("no such key to delete");
			}
			bucket.Remove(key);
			if (bucket.Count()<1) 
			{
				this.tree.RemoveKey(prefix);
			} 
			else 
			{
				this.tree[prefix] = bucket.dump();
			}
		}

		public string FirstKey()
		{
			xBucket bucket;
			string prefix = this.tree.FirstKey();
			if (prefix==null) 
			{
				return null;
			}
			string dummyprefix;
			bool found = FindBucketForPrefix(prefix, out bucket, out dummyprefix, true);
			if (!found) 
			{
				throw new BplusTreeException("internal tree gave bad first key");
			}
			return bucket.FirstKey();
		}

		public string NextKey(string AfterThisKey)
		{
			xBucket bucket;
			string prefix;
			string result = null;
			bool found = FindBucketForPrefix(AfterThisKey, out bucket, out prefix, false);
			if (found) 
			{
				result = bucket.NextKey(AfterThisKey);
				if (result!=null) 
				{
					return result;
				}
			}
			// otherwise look in the next bucket
			string nextprefix = this.tree.NextKey(prefix);
			if (nextprefix==null) 
			{
				return null;
			}
			byte[] databytes = this.tree[nextprefix];
			bucket = new xBucket(this);
			bucket.Load(databytes);
			if (bucket.Count()<1) 
			{
				throw new BplusTreeException("empty bucket loaded");
			}
			return bucket.FirstKey();
		}

		public bool ContainsKey(string key)
		{
			xBucket bucket;
			string prefix;
			bool found = FindBucketForPrefix(key, out bucket, out prefix, false);
			if (!found) 
			{
				return false;
			}
			byte[] map;
			return bucket.Find(key, out map);
		}

		public object Get(string key, object defaultValue)
		{
			xBucket bucket;
			string prefix;
			bool found = FindBucketForPrefix(key, out bucket, out prefix, false);
			if (!found) 
			{
				return defaultValue;
			}
			byte[] map;
			found = bucket.Find(key, out map);
			if (found) 
			{
				return map;
			}
			return defaultValue;
		}

		public void Set(string key, object map)
		{
			
			xBucket bucket;
			string prefix;
			bool found = FindBucketForPrefix(key, out bucket, out prefix, false);
			if (!found) 
			{
				bucket = new xBucket(this);
			}
			if (!(map is byte[])) 
			{
				throw new BplusTreeBadKeyValue("xBplus only accepts byte array values");
			}
			bucket.Add(key, (byte[]) map);
			this.tree[prefix] = bucket.dump();
		}
		public byte[] this[string key] 
		{
			get 
			{
				object test = this.Get(key, "");
				if (test is byte[]) 
				{
					return (byte[]) test;
				}
				throw new BplusTreeKeyMissing("no such key in tree");
			} 
			set 
			{
				this.Set(key, value);
			}
		}

		public void Commit()
		{
			this.tree.Commit();
		}

		public void Abort()
		{
			this.tree.Abort();
		}

		public void SetFootPrintLimit(int limit)
		{
			this.tree.SetFootPrintLimit(limit);
		}

		public void Shutdown()
		{
			this.tree.Shutdown();
		}

		#endregion
	}
	/// <summary>
	/// Bucket for elements with same prefix -- designed for small buckets.
	/// </summary>
	public class xBucket 
	{
		ArrayList keys;
		ArrayList values;
		xBplusTreeBytes owner;
		public xBucket(xBplusTreeBytes owner) 
		{
			this.keys = new ArrayList();
			this.values = new ArrayList();
			this.owner = owner;
		}
		public int Count() 
		{
			return this.keys.Count;
		}
		public void Load(byte[] serialization) 
		{
			int index = 0;
			int byteCount = serialization.Length;
			if (this.values.Count!=0 || this.keys.Count!=0) 
			{
				throw new BplusTreeException("load into nonempty xBucket not permitted");
			}
			while (index<byteCount) 
			{
				// get key prefix and key
				int keylength = BufferFile.Retrieve(serialization, index);
				index += BufferFile.INTSTORAGE;
				byte[] keybytes = new byte[keylength];
				Array.Copy(serialization, index, keybytes, 0, keylength);
				string keystring = BplusTree.BytesToString(keybytes);
				index+= keylength;
				// get value prefix and value
				int valuelength = BufferFile.Retrieve(serialization, index);
				index += BufferFile.INTSTORAGE;
				byte[] valuebytes = new byte[valuelength];
				Array.Copy(serialization, index, valuebytes, 0, valuelength);
				// record new key and value
				this.keys.Add(keystring);
				this.values.Add(valuebytes);
				index+= valuelength;
			}
			if (index!=byteCount) 
			{
				throw new BplusTreeException("bad byte count in serialization "+byteCount);
			}
		}
		public byte[] dump() 
		{
			ArrayList allbytes = new ArrayList();
			int byteCount = 0;
			for (int index=0; index<this.keys.Count; index++) 
			{
				string thisKey = (string) this.keys[index];
				byte[] thisValue = (byte[]) this.values[index];
				byte[] keyprefix = new byte[BufferFile.INTSTORAGE];
				byte[] keybytes = BplusTree.StringToBytes(thisKey);
				BufferFile.Store(keybytes.Length, keyprefix, 0);
				allbytes.Add(keyprefix);
				allbytes.Add(keybytes);
				byte[] valueprefix = new byte[BufferFile.INTSTORAGE];
				BufferFile.Store(thisValue.Length, valueprefix, 0);
				allbytes.Add(valueprefix);
				allbytes.Add(thisValue);
			}
			foreach (object thing in allbytes) 
			{
				byte[] thebytes = (byte[]) thing;
				byteCount+= thebytes.Length;
			}
			int outindex=0;
			byte[] result = new byte[byteCount];
			foreach (object thing in allbytes) 
			{
				byte[] thebytes = (byte[]) thing;
				int thelength = thebytes.Length;
				Array.Copy(thebytes, 0, result, outindex, thelength);
				outindex+= thelength;
			}
			if (outindex!=byteCount) 
			{
				throw new BplusTreeException("error counting bytes in dump "+outindex+"!="+byteCount);
			}
			return result;
		}
		public void Add(string key, byte[] map) 
		{
			int index = 0;
			int limit = this.owner.BucketSizeLimit;
			while (index<this.keys.Count) 
			{
				string thiskey = (string) this.keys[index];
				int comparison = this.owner.Compare(thiskey, key);
				if (comparison==0) 
				{
					this.values[index] = map;
					this.keys[index] = key;
					return;
				}
				if (comparison>0) 
				{
					this.values.Insert(index, map);
					this.keys.Insert(index, key);
					if (limit>0 && this.keys.Count>limit) 
					{
						throw new BplusTreeBadKeyValue("bucket size limit exceeded");
					}
					return;
				}
				index++;
			}
			this.keys.Add(key);
			this.values.Add(map);
			if (limit>0 && this.keys.Count>limit) 
			{
				throw new BplusTreeBadKeyValue("bucket size limit exceeded");
			}
		}
		public void Remove(string key) 
		{
			int index = 0;
			while (index<this.keys.Count) 
			{
				string thiskey = (string) this.keys[index];
				if (this.owner.Compare(thiskey, key)==0) 
				{
					this.values.RemoveAt(index);
					this.keys.RemoveAt(index);
					return;
				}
				index++;
			}
			throw new BplusTreeBadKeyValue("cannot remove missing key: "+key);
		}
		public bool Find(string key, out byte[] map) 
		{
			map = null;
			int index = 0;
			while (index<this.keys.Count) 
			{
				string thiskey = (string) this.keys[index];
				if (this.owner.Compare(thiskey, key)==0) 
				{
					map = (byte[]) this.values[index];
					return true;
				}
				index++;
			}
			return false;
		}
		public string FirstKey() 
		{
			if (this.keys.Count<1) 
			{
				return null;
			}
			return (string) this.keys[0];
		}
		public string NextKey(string AfterThisKey) 
		{
			int index = 0;
			while (index<this.keys.Count) 
			{
				string thiskey = (string) this.keys[index];
				if (this.owner.Compare(thiskey, AfterThisKey)>0) 
				{
					return thiskey;
				}
				index++;
			}
			return null;
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色先锋aa成人| 日韩高清电影一区| 99精品国产99久久久久久白柏| 久久夜色精品一区| 国产成人丝袜美腿| 成人欧美一区二区三区| 91福利国产精品| 日韩和的一区二区| 久久男人中文字幕资源站| 国产成人自拍在线| 亚洲一区欧美一区| 精品sm在线观看| 99久免费精品视频在线观看| 一区二区免费看| 欧美变态tickling挠脚心| 成人av网站在线观看免费| 亚洲老妇xxxxxx| 精品久久一二三区| 91免费精品国自产拍在线不卡| 亚洲午夜电影网| 国产亚洲美州欧州综合国 | 久久精品国产精品亚洲精品| 久久久国产精品不卡| 一本一道久久a久久精品 | 成人av影院在线| 天天综合色天天| 国产欧美一区二区精品久导航| 91丨porny丨在线| 九九视频精品免费| 亚洲视频一区在线| 日韩视频国产视频| 一本色道久久综合亚洲精品按摩| 免费在线成人网| 综合久久久久久久| 精品国内二区三区| 欧美日韩日本视频| 99视频在线观看一区三区| 日韩成人dvd| 亚洲精品视频一区| 国产亚洲精品资源在线26u| 欧美日韩精品一区二区在线播放| 国产精品1024| 精品一区二区三区在线观看| 亚洲精品菠萝久久久久久久| 国产亚洲欧美一级| 日韩免费成人网| 欧美日韩一区二区三区在线| 99精品久久久久久| 成人性色生活片| 麻豆极品一区二区三区| 亚洲大片在线观看| 亚洲精品中文字幕乱码三区| 久久久久久**毛片大全| 91精品久久久久久久91蜜桃| 欧美又粗又大又爽| 99视频在线精品| 成人久久18免费网站麻豆| 久久精品99久久久| 久久激五月天综合精品| 婷婷综合五月天| 亚洲五月六月丁香激情| 亚洲激情综合网| 亚洲欧美另类图片小说| 中文字幕亚洲综合久久菠萝蜜| 久久综合网色—综合色88| 精品免费视频.| 欧美tickling网站挠脚心| 欧美一级高清片在线观看| 欧美日韩国产综合一区二区| 91精品福利在线| 91久久精品国产91性色tv| 91在线国内视频| 91色porny蝌蚪| 色综合激情五月| 色94色欧美sute亚洲13| 欧美伊人久久久久久午夜久久久久| 色婷婷av一区二区| 欧美视频中文字幕| 欧美日韩午夜精品| 欧美肥妇毛茸茸| 日韩精品在线看片z| 精品国产一区久久| 久久女同互慰一区二区三区| 久久综合一区二区| 中文幕一区二区三区久久蜜桃| 亚洲国产精品激情在线观看| 欧美激情一区三区| 亚洲精品写真福利| 亚洲电影视频在线| 免播放器亚洲一区| 粉嫩aⅴ一区二区三区四区| 波多野结衣中文一区| 一本久久a久久精品亚洲| 欧美怡红院视频| 欧美成va人片在线观看| 国产精品午夜电影| 亚洲综合色网站| 久久草av在线| av成人免费在线观看| 欧美日韩欧美一区二区| 精品三级在线观看| 中文字幕制服丝袜成人av| 亚洲自拍欧美精品| 久久99精品国产.久久久久久| 国产精品一级二级三级| 91在线精品一区二区| 7777精品伊人久久久大香线蕉超级流畅| 欧美一区二区三区免费大片| 久久嫩草精品久久久久| 一区二区三区在线播放| 麻豆成人av在线| 91亚洲午夜精品久久久久久| 欧美人动与zoxxxx乱| 久久久精品一品道一区| 亚洲一区二区三区免费视频| 韩国在线一区二区| 欧美天堂一区二区三区| 国产亚洲综合色| 五月天一区二区| 不卡大黄网站免费看| 日韩精品中午字幕| 一区二区三区四区高清精品免费观看| 日韩激情中文字幕| 99久久精品免费| 精品99一区二区| 亚洲自拍偷拍九九九| 国产91高潮流白浆在线麻豆 | 99久久综合色| 精品久久久久久最新网址| 亚洲天天做日日做天天谢日日欢| 日本在线播放一区二区三区| 91免费看`日韩一区二区| 精品国产精品一区二区夜夜嗨| 一区二区在线观看免费| 国产成人精品网址| 日韩一区国产二区欧美三区| 曰韩精品一区二区| av不卡一区二区三区| 精品对白一区国产伦| 日韩国产高清影视| 欧美色图免费看| 亚洲欧洲av在线| 成人免费看的视频| 久久久夜色精品亚洲| 美女mm1313爽爽久久久蜜臀| 欧美日韩日本视频| 亚洲一区二区不卡免费| 91影院在线免费观看| 国产欧美综合在线观看第十页| 久久成人av少妇免费| 日韩一级在线观看| 琪琪久久久久日韩精品| 欧美剧在线免费观看网站| 亚洲夂夂婷婷色拍ww47| 91九色02白丝porn| 一区二区欧美视频| 色综合久久66| 亚洲三级电影全部在线观看高清| 成人av免费网站| 日本一区二区成人| 成+人+亚洲+综合天堂| 中国色在线观看另类| 成人高清在线视频| 一区在线中文字幕| 99久久99久久免费精品蜜臀| 国产精品热久久久久夜色精品三区| 国产福利精品导航| 国产精品丝袜久久久久久app| 成人自拍视频在线观看| 欧美高清在线精品一区| 99视频在线精品| 一区二区三区在线视频观看| 欧美图区在线视频| 日韩精品91亚洲二区在线观看| 欧美一区二区三区不卡| 蜜臀av一区二区在线免费观看| 欧美变态tickling挠脚心| 国产一区二区不卡| 国产精品午夜免费| 91美女片黄在线观看| 亚洲一区二区免费视频| 91精品国产一区二区三区蜜臀 | 精品一区二区三区在线观看| 2023国产精华国产精品| 成人综合婷婷国产精品久久免费| 国产精品夫妻自拍| 欧美在线免费观看亚洲| 日本成人中文字幕| 国产亚洲短视频| 日本精品一区二区三区高清| 五月天精品一区二区三区| 欧美α欧美αv大片| 成人一区在线观看| 亚洲男女毛片无遮挡| 制服丝袜亚洲播放| 国产精品一区专区| 亚洲人成精品久久久久久| 91精品国产综合久久香蕉麻豆| 免费不卡在线视频| 国产精品成人在线观看|