Exemplo n.º 1
0
 public static void Check(BPlusTreeLong bpt)
 {
     Console.WriteLine(bpt.ToText());
       bpt.CheckFreeBlock();
       ArrayList allkeys = new ArrayList();
       foreach (DictionaryEntry d in AllInsertHashtable)
       {
     allkeys.Add(d.Key);
       }
       allkeys.Sort();
       allkeys.Reverse();
       foreach (object thing in allkeys)
       {
     string thekey = (string)thing;
     long thevalue = (long)AllInsertHashtable[thing];
     if (thevalue != bpt[thekey])
     {
       throw new ApplicationException("no match on retrieval " + thekey + " --> " + bpt[thekey] + " not " + thevalue);
     }
       }
       allkeys.Reverse();
       string currentkey = bpt.FirstKey();
       foreach (object thing in allkeys)
       {
     string testkey = (string)thing;
     if (currentkey == null)
     {
       throw new ApplicationException("end of keys found when expecting " + testkey);
     }
     if (!testkey.Equals(currentkey))
     {
       throw new ApplicationException("when walking found " + currentkey + " when expecting " + testkey);
     }
     currentkey = bpt.NextKey(testkey);
       }
 }