Exemplo n.º 1
0
		private void AssertReadModePointerIteration(int[] expectedKeys, BTreePointer pointer
			)
		{
			object[] expected = IntArrays4.ToObjectArray(expectedKeys);
			for (int i = 0; i < expected.Length; i++)
			{
				Assert.IsNotNull(pointer, "Expected '" + expected[i] + "'");
				Assert.AreNotSame(_btree.Root(), pointer.Node());
				AssertInReadModeOrCached(pointer.Node());
				Assert.AreEqual(expected[i], pointer.Key());
				AssertInReadModeOrCached(pointer.Node());
				pointer = pointer.Next();
			}
		}
Exemplo n.º 2
0
        public virtual void Clear(Transaction transaction)
        {
            BTreePointer currentPointer = FirstPointer(transaction);

            while (currentPointer != null && currentPointer.IsValid())
            {
                BTreeNode node  = currentPointer.Node();
                int       index = currentPointer.Index();
                node.Remove(transaction, index);
                currentPointer = currentPointer.Next();
            }
        }
Exemplo n.º 3
0
        public virtual object Remove(Transaction trans, object key)
        {
            BTreePointer bTreePointer = SearchPointer(trans, key);

            if (bTreePointer == null)
            {
                return(null);
            }
            object result = bTreePointer.Key();

            Enlist(trans);
            IPreparedComparison preparedComparison = KeyHandler().PrepareComparison(trans.Context
                                                                                        (), key);
            BTreeNode node = bTreePointer.Node();

            node.Remove(trans, preparedComparison, key, bTreePointer.Index());
            ConvertCacheEvictedNodesToReadMode();
            return(result);
        }