public static bool Equals(Db4objects.Db4o.Internal.Btree.BTreePointer x, Db4objects.Db4o.Internal.Btree.BTreePointer y) { if (x == null) { return(y == null); } return(x.Equals(y)); }
public virtual bool MoveNext() { if (ReachedEnd(_cursor)) { _current = null; return false; } _current = _cursor; _cursor = _cursor.Next(); return true; }
public AbstractBTreeRangeIterator(BTreeRangeSingle range) { _range = range; BTreePointer first = range.First(); if (first != null) { // we clone here, because we are calling unsafeNext() on BTreePointer // _cursor is our private copy, we modify it and never pass it out. _cursor = first.ShallowClone(); } }
private bool ReachedEnd(BTreePointer cursor) { if (cursor == null) { return true; } if (_range.End() == null) { return false; } return _range.End().Equals(cursor); }
public BTreeRangeSingle(Db4objects.Db4o.Internal.Transaction transaction, BTree btree , BTreePointer first, BTreePointer end) { if (transaction == null || btree == null) { throw new ArgumentNullException(); } _transaction = transaction; _btree = btree; _first = first; _end = end; }
public int CompareTo(Db4objects.Db4o.Internal.Btree.BTreePointer y) { if (null == y) { throw new ArgumentNullException(); } if (Btree() != y.Btree()) { throw new ArgumentException(); } return(Btree().CompareKeys(_transaction.Context(), Key(), y.Key())); }
internal BTreeNodeSearchResult(Transaction transaction, BTree btree, BTreePointer pointer, bool foundMatch) { if (null == transaction || null == btree) { throw new ArgumentNullException(); } _transaction = transaction; _btree = btree; _pointer = pointer; _foundMatch = foundMatch; }
private static BTreePointer NextPointerIf(BTreePointer pointer, bool condition) { if (null == pointer) { return null; } if (condition) { return pointer.Next(); } return pointer; }
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(); } }
public static BTreePointer Min(BTreePointer x, BTreePointer y) { if (x == null) { return y; } if (y == null) { return x; } if (x.CompareTo(y) < 0) { return x; } return y; }
public virtual bool MoveNext() { if (_beyondEnd) { return false; } if (BeforeFirst()) { _currentPointer = _bTree.FirstPointer(_transaction); } else { _currentPointer = _currentPointer.Next(); } _beyondEnd = (_currentPointer == null); return !_beyondEnd; }
public static Db4objects.Db4o.Internal.Btree.BTreePointer Min(Db4objects.Db4o.Internal.Btree.BTreePointer x, Db4objects.Db4o.Internal.Btree.BTreePointer y) { if (x == null) { return(y); } if (y == null) { return(x); } if (x.CompareTo(y) < 0) { return(x); } return(y); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (!(obj is Db4objects.Db4o.Internal.Btree.BTreePointer)) { return(false); } Db4objects.Db4o.Internal.Btree.BTreePointer other = (Db4objects.Db4o.Internal.Btree.BTreePointer )obj; if (_index != other._index) { return(false); } return(_node.Equals(other._node)); }
public virtual bool MoveNext() { if (ReachedEnd()) { _current = null; return false; } if (_current == null) { _current = _cursor.ShallowClone(); } else { _cursor.CopyTo(_current); } _cursor = _cursor.UnsafeFastNext(); return true; }
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); }
private BTreePointer FirstBTreePointer() { // We don't want nulls included so we have to search for null and use the resulting pointer if we find one. IIndexable4 keyHandler = Btree().KeyHandler(); if (keyHandler is ICanExcludeNullInQueries) { ICanExcludeNullInQueries canExcludeNullInQueries = (ICanExcludeNullInQueries)keyHandler; if (canExcludeNullInQueries.ExcludeNull()) { BTreeNodeSearchResult searchLeaf = Btree().SearchLeafByObject(Transaction(), null , SearchTarget.Highest); BTreePointer pointer = searchLeaf.FirstValidPointer(); if (pointer != null) { return(pointer); } } } return(Btree().FirstPointer(Transaction())); }
public virtual BTreePointer SearchPointer(Transaction trans, object key) { EnsureActive(trans); KeyCantBeNull(key); IPreparedComparison preparedComparison = KeyHandler().PrepareComparison(trans.Context (), key); BTreeNodeSearchResult start = SearchLeaf(trans, preparedComparison, SearchTarget. Lowest); BTreePointer bTreePointer = start.FirstValidPointer(); if (bTreePointer == null) { ConvertCacheEvictedNodesToReadMode(); return(null); } object found = bTreePointer.Key(); ConvertCacheEvictedNodesToReadMode(); if (preparedComparison.CompareTo(found) == 0) { return(bTreePointer); } return(null); }
public virtual BTreeRangeSingle NewBTreeRangeSingle (BTreePointer first, BTreePointer end) { return new BTreeRangeSingle(Transaction(), _btree, first, end); }
public int CompareTo(BTreePointer y) { if (null == y) { throw new ArgumentNullException(); } if (Btree() != y.Btree()) { throw new ArgumentException(); } return Btree().CompareKeys(_transaction.Context(), Key(), y.Key()); }
public virtual Db4objects.Db4o.Internal.Btree.BTreeRangeSingle NewBTreeRangeSingle (BTreePointer first, BTreePointer end) { return new Db4objects.Db4o.Internal.Btree.BTreeRangeSingle(Transaction(), _btree, first, end); }
public static bool Equals(BTreePointer x, BTreePointer y) { if (x == null) { return y == null; } return x.Equals(y); }
protected virtual void AssertPointerKey(int key, BTreePointer pointer) { Assert.AreEqual(key, pointer.Key()); }
public virtual Db4objects.Db4o.Internal.Btree.BTreeRangeSingle NewBTreeRangeSingle (BTreePointer first, BTreePointer end) { return(new Db4objects.Db4o.Internal.Btree.BTreeRangeSingle(Transaction(), _btree, first, end)); }
public static bool LessThan(BTreePointer x, BTreePointer y) { return(Min(x, y) == x && !Equals(x, y )); }
public void CopyTo(Db4objects.Db4o.Internal.Btree.BTreePointer target) { target._node = _node; target._index = _index; target._nodeReader = _nodeReader; }
public virtual BTreeRangeSingle NewBTreeRangeSingle (BTreePointer first, BTreePointer end) { return(new BTreeRangeSingle(Transaction(), _btree, first, end)); }
public AbstractBTreeRangeIterator(BTreeRangeSingle range) { _range = range; _cursor = range.First(); }
public virtual bool Adjacent(Db4objects.Db4o.Internal.Btree.BTreeRangeSingle range ) { return(BTreePointer.Equals(_end, range._first) || BTreePointer.Equals(range._end, _first)); }
private bool FirstOverlaps(BTreeRangeSingle x, BTreeRangeSingle y) { return(BTreePointer.LessThan(y._first, x._end) && BTreePointer.LessThan(x._first, y._end)); }
public virtual bool IsEmpty() { return(BTreePointer.Equals(_first, _end)); }
public static bool LessThan(Db4objects.Db4o.Internal.Btree.BTreePointer x, Db4objects.Db4o.Internal.Btree.BTreePointer y) { return(Db4objects.Db4o.Internal.Btree.BTreePointer.Min(x, y) == x && !Equals(x, y )); }
public virtual void Reset() { _cursor = _range.First(); }
public static bool LessThan(BTreePointer x, BTreePointer y) { return Min(x, y) == x && !Equals(x, y ); }
public virtual bool Adjacent(BTreeRangeSingle range ) { return(BTreePointer.Equals(_end, range._first) || BTreePointer.Equals(range._end, _first)); }
private bool FirstOverlaps(Db4objects.Db4o.Internal.Btree.BTreeRangeSingle x, Db4objects.Db4o.Internal.Btree.BTreeRangeSingle y) { return(BTreePointer.LessThan(y._first, x._end) && BTreePointer.LessThan(x._first, y._end)); }