示例#1
0
        // Needed for cloning (shallow copy) this BTree.
        private void Initialize(BTreeAlgorithm <TKey, TValue> BTree)
        {
            this.SlotLength = BTree.SlotLength;
            this.Root       = BTree.Root;

            //Copy CurrentItem. "Copy" as CurrentItem is value type.
            this.CurrentItem = BTree.CurrentItem;

            this.Comparer = BTree.Comparer;
            // create another set of temporary slots for thread safe 'Search' operation support
            TempSlots    = new BTreeItem <TKey, TValue> [SlotLength + 1];
            TempChildren = new TreeNode[SlotLength + 2];
        }
示例#2
0
 /// <summary>
 /// Implement to copy items from source onto this instance.
 /// </summary>
 /// <param name="source"></param>
 public void Copy(BTreeAlgorithm <TKey, TValue> source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (source.MoveFirst())
     {
         for (; source.CurrentEntry != null; source.MoveNext())
         {
             Add(source.CurrentEntry.Key, source.CurrentEntry.Value);
         }
     }
 }
示例#3
0
        // Needed for cloning (shallow copy) this BTree.
        private void Initialize(BTreeAlgorithm <TKey, TValue> bTree)
        {
            this.SlotLength = bTree.SlotLength;
            this.Comparer   = bTree.Comparer;
            this.Root       = new TreeRootNode(this);
            //this.Root = bTree.Root;
            //Copy CurrentItem. "Copy" as CurrentItem is value type.
            this.CurrentItem = bTree.CurrentItem;
            // create another set of temporary slots for thread safe 'Search' operation support
            _tempSlots    = new BTreeItem <TKey, TValue> [SlotLength + 1];
            _tempChildren = new TreeNode[SlotLength + 2];

            // copy the tree graph.
            bTree.Locker.Invoke(() => { Copy(bTree); });
        }
示例#4
0
 internal BTreeAlgorithm(BTreeAlgorithm <TKey, TValue> bTree)
 {
     Initialize(bTree);
 }
示例#5
0
 /// <summary>
 /// Constructor to use if you want to provide your own Comparer object that defines
 /// how your records will be sorted/arranged
 /// </summary>
 /// <param name="comparer">IComparer implementation that defines how records will be sorted</param>
 public SortedDictionary(System.Collections.Generic.IComparer <TKey> comparer)
 {
     Btree = new BTree.BTreeAlgorithm <TKey, TValue>(comparer);
 }
示例#6
0
 public void SetCurrentItemAddress(BTree.BTreeAlgorithm <TKey, TValue> .TreeNode itemNode, byte itemIndex)
 {
     _currentItem.Node          = itemNode;
     _currentItem.NodeItemIndex = itemIndex;
 }
示例#7
0
 internal SortedDictionary(BTree.BTreeAlgorithm <TKey, TValue> source)
 {
     Btree = (BTree.BTreeAlgorithm <TKey, TValue>)source.Clone();
 }