Exemplo n.º 1
0
 public virtual void Insert(System.IComparable key, object value)
 {
     // check if root is full
     if (root.IsFull())
     {
         NeoDatis.Btree.IBTreeNode newRoot = BuildNode();
         NeoDatis.Btree.IBTreeNode oldRoot = root;
         newRoot.SetChildAt(root, 0);
         newRoot.SetNbChildren(1);
         root = newRoot;
         Split(newRoot, oldRoot, 0);
         height++;
         persister.SaveNode(oldRoot);
         // TODO Remove the save of the new root : the save on the btree
         // should do the save on the new root(after introspector
         // refactoring)
         persister.SaveNode(newRoot);
         persister.SaveBTree(this);
         NeoDatis.Btree.Tool.BTreeValidator.ValidateNode(newRoot, true);
     }
     InsertNonFull(root, key, value);
     size++;
     persister.SaveBTree(this);
 }
Exemplo n.º 2
0
 public AbstractBTree(string name, int degree, NeoDatis.Btree.IBTreePersister persister
                      )
 {
     this.name      = name;
     this.degree    = degree;
     this.size      = 0;
     this.height    = 1;
     this.persister = persister;
     root           = BuildNode();
     // TODO check if it is needed to store the root before the btree ->
     // saving btree will try to update root!
     persister.SaveNode(root);
     persister.SaveBTree(this);
     persister.Flush();
 }