Beispiel #1
0
 public virtual bool MoveNext()
 {
     if (ReachedEnd(_cursor))
     {
         _current = null;
         return(false);
     }
     _current = _cursor;
     _cursor  = _cursor.Next();
     return(true);
 }
		private static BTreePointer NextPointerIf(BTreePointer pointer, bool condition)
		{
			if (null == pointer)
			{
				return null;
			}
			if (condition)
			{
				return pointer.Next();
			}
			return pointer;
		}
 public virtual BTreePointer FirstValidPointer()
 {
     if (null == _pointer)
     {
         return(null);
     }
     if (_pointer.IsValid())
     {
         return(_pointer);
     }
     return(_pointer.Next());
 }
 private static BTreePointer NextPointerIf(BTreePointer pointer, bool condition)
 {
     if (null == pointer)
     {
         return(null);
     }
     if (condition)
     {
         return(pointer.Next());
     }
     return(pointer);
 }
Beispiel #5
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();
            }
        }
Beispiel #6
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();
			}
		}
Beispiel #7
0
 public virtual bool MoveNext()
 {
     if (_beyondEnd)
     {
         return(false);
     }
     if (BeforeFirst())
     {
         _currentPointer = _bTree.FirstPointer(_transaction);
     }
     else
     {
         _currentPointer = _currentPointer.Next();
     }
     _beyondEnd = (_currentPointer == null);
     return(!_beyondEnd);
 }