예제 #1
0
//		public override string PrefixForByteCount(string s, int maxbytecount)
//		{
//			// compute a hash code as a string which has maxbytecount size as a byte sequence
//			byte[] resultbytes = new byte[maxbytecount];
//			byte[] inputbytes = BplusTree.StringToBytes(s);
//			int sevenbits = 127;
//			int eighthbit = 128;
//			bool invert = false;
//			for (int i=0; i<maxbytecount; i++)
//			{
//				resultbytes[i] = (byte) (i & sevenbits);
//			}
//			for (int i=0; i<inputbytes.Length; i++)
//			{
//				int inputbyte = inputbytes[i];
//				int outputindex = i % maxbytecount;
//				int outputbyte = resultbytes[outputindex];
//				int rotator = (i/maxbytecount) % 8;
//				if (rotator!=0)
//				{
//					int hipart = inputbyte << rotator;
//					int lowpart = inputbyte >> (8-rotator);
//					inputbyte = (hipart | lowpart);
//				}
//				outputbyte = ((inputbyte ^ outputbyte) % sevenbits);
//				if ( (inputbyte&eighthbit)!=0 )
//				{
//					invert = !invert;
//				}
//				if (invert)
//				{
//					outputbyte = (outputbyte ^ sevenbits) % eighthbit;
//				}
//				resultbytes[outputindex] = (byte) outputbyte;
//			}
//			string result = BplusTree.BytesToString(resultbytes);
//			if (result.Length!=maxbytecount)
//			{
//				throw new BplusTreeException("bad hash value generated with length: "+result.Length+" not "+maxbytecount);
//			}
//			return result;
//		}
        public string toHtml()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(((BplusTreeBytes)this.tree).toHtml());
            sb.Append("\r\n<br><b>key / hash / value dump</b><br>");
            string currentkey = this.FirstKey();

            while (currentkey != null)
            {
                sb.Append("\r\n<br>" + currentkey);
                sb.Append(" / " + BplusNode.PrintableString(this.PrefixForByteCount(currentkey, this.prefixLength)));
                try
                {
                    sb.Append(" / value found ");
                }
                catch (Exception)
                {
                    sb.Append(" !!!!!!! FAILED TO GET VALUE");
                }
                currentkey = this.NextKey(currentkey);
            }
            return(sb.ToString());
        }
예제 #2
0
        public string toHtml()
        {
            var sb = new StringBuilder();

            sb.Append(tree.toHtml());
            sb.Append("\r\n<br><b>key / hash / value dump</b><br>");
            string currentkey = FirstKey();

            while (currentkey != null)
            {
                sb.Append("\r\n<br>" + currentkey);
                sb.Append(" / " + BplusNode.PrintableString(PrefixForByteCount(currentkey, prefixLength)));
                try
                {
                    sb.Append(" / value found ");
                }
                catch (Exception)
                {
                    sb.Append(" !!!!!!! FAILED TO GET VALUE");
                }
                currentkey = NextKey(currentkey);
            }
            return(sb.ToString());
        }