本文整理汇总了C#中Db4objects.Db4o.Internal.Btree.BTree类的典型用法代码示例。如果您正苦于以下问题:C# BTree类的具体用法?C# BTree怎么用?C# BTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BTree类属于Db4objects.Db4o.Internal.Btree命名空间,在下文中一共展示了BTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssertEmpty
public static void AssertEmpty(Transaction transaction, BTree tree)
{
ExpectingVisitor visitor = new ExpectingVisitor(new object[0]);
tree.TraverseKeys(transaction, visitor);
visitor.AssertExpectations();
Assert.AreEqual(0, tree.Size(transaction));
}
示例2: CycleIntKeys
/// <exception cref="System.Exception"></exception>
private BTree CycleIntKeys(BTree btree)
{
AddKeys(btree);
ExpectKeys(btree, _sortedKeys);
btree.Commit(Trans());
ExpectKeys(btree, _sortedKeys);
RemoveKeys(btree);
ExpectKeys(btree, _keysOnRemoval);
btree.Rollback(Trans());
ExpectKeys(btree, _sortedKeys);
var id = btree.GetID();
Reopen();
btree = BTreeAssert.CreateIntKeyBTree(Container(), id, BtreeNodeSize);
ExpectKeys(btree, _sortedKeys);
RemoveKeys(btree);
ExpectKeys(btree, _keysOnRemoval);
btree.Commit(Trans());
ExpectKeys(btree, _keysOnRemoval);
// remove all but 1
for (var i = 1; i < _keysOnRemoval.Length; i++)
{
btree.Remove(Trans(), _keysOnRemoval[i]);
}
ExpectKeys(btree, _one);
btree.Commit(Trans());
ExpectKeys(btree, _one);
btree.Remove(Trans(), 1);
btree.Rollback(Trans());
ExpectKeys(btree, _one);
btree.Remove(Trans(), 1);
btree.Commit(Trans());
ExpectKeys(btree, _none);
return btree;
}
示例3: Commit
public override object Commit(Transaction trans, BTree btree, BTreeNode node)
{
if (_transaction == trans)
{
return GetObject();
}
return this;
}
示例4: Rollback
public override object Rollback(Transaction trans, BTree btree)
{
if (_transaction == trans)
{
return RolledBack(btree);
}
return this;
}
示例5: CreateBTreeIndex
private void CreateBTreeIndex(ObjectContainerBase stream, int btreeID)
{
if (stream.IsClient)
{
return;
}
_btreeIndex = ((LocalObjectContainer)stream).CreateBTreeClassIndex(btreeID);
_btreeIndex.SetRemoveListener(new _IVisitor4_61(this));
}
示例6: CreateBTrees
private void CreateBTrees(int addressID, int lengthID)
{
BTreeConfiguration config = new BTreeConfiguration(_idSystem, SlotChangeFactory.FreeSpace
, 64, false);
_slotsByAddress = new BTree(Transaction(), config, addressID, new AddressKeySlotHandler
());
_slotsByLength = new BTree(Transaction(), config, lengthID, new LengthKeySlotHandler
());
}
示例7: BTreeNode
public BTreeNode(BTree btree, int count, bool isLeaf, int parentID, int previousID
, int nextID)
{
_btree = btree;
_parentID = parentID;
_previousID = previousID;
_nextID = nextID;
_count = count;
_isLeaf = isLeaf;
PrepareArrays();
}
示例8: BTreeRangeSingle
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;
}
示例9: BTreeNodeSearchResult
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;
}
示例10: AssertSingleElement
public static void AssertSingleElement(Transaction trans, BTree btree, object element
)
{
Assert.AreEqual(1, btree.Size(trans));
IBTreeRange result = btree.SearchRange(trans, element);
ExpectingVisitor expectingVisitor = new ExpectingVisitor(new object[] { element }
);
BTreeAssert.TraverseKeys(result, expectingVisitor);
expectingVisitor.AssertExpectations();
expectingVisitor = new ExpectingVisitor(new object[] { element });
btree.TraverseKeys(trans, expectingVisitor);
expectingVisitor.AssertExpectations();
}
示例11: Convert
public virtual void Convert(LocalObjectContainer container, int classIndexId, BTree
bTree)
{
Transaction trans = container.SystemTransaction();
ByteArrayBuffer reader = container.ReadBufferById(trans, classIndexId);
if (reader == null)
{
return;
}
int entries = reader.ReadInt();
for (int i = 0; i < entries; i++)
{
bTree.Add(trans, reader.ReadInt());
}
}
示例12: Initialize
private void Initialize()
{
int idToTimestampIndexId = _container.SystemData().IdToTimestampIndexId();
int timestampToIdIndexId = _container.SystemData().TimestampToIdIndexId();
_idToTimestamp = new BTree(_container.SystemTransaction(), idToTimestampIndexId,
new CommitTimestampSupport.TimestampEntryById());
_timestampToId = new BTree(_container.SystemTransaction(), timestampToIdIndexId,
new CommitTimestampSupport.IdEntryByTimestamp());
if (idToTimestampIndexId != _idToTimestamp.GetID())
{
StoreBtreesIds();
}
EventRegistryFactory.ForObjectContainer(_container).Committing += new System.EventHandler<Db4objects.Db4o.Events.CommitEventArgs>
(new _IEventListener4_69(this).OnEvent);
}
示例13: ExpectKeysSearch
private void ExpectKeysSearch(Transaction trans, BTree btree, int[] keys)
{
int lastValue = int.MinValue;
for (int i = 0; i < keys.Length; i++)
{
if (keys[i] != lastValue)
{
ExpectingVisitor expectingVisitor = ExpectingVisitor.CreateExpectingVisitor(keys[
i], IntArrays4.Occurences(keys, keys[i]));
IBTreeRange range = btree.SearchRange(trans, keys[i]);
BTreeAssert.TraverseKeys(range, expectingVisitor);
expectingVisitor.AssertExpectations();
lastValue = keys[i];
}
}
}
示例14: ExpectKeysSearch
private void ExpectKeysSearch(BTree btree, int[] values)
{
int lastValue = int.MinValue;
for (int i = 0; i < values.Length; i++)
{
if (values[i] != lastValue)
{
ExpectingVisitor expectingVisitor = ExpectingVisitor.CreateExpectingVisitor(values
[i], IntArrays4.Occurences(values, values[i]));
IBTreeRange range = FieldIndexKeySearch(Trans(), btree, values[i]);
BTreeAssert.TraverseKeys(range, new _IVisitor4_62(expectingVisitor));
expectingVisitor.AssertExpectations();
lastValue = values[i];
}
}
}
示例15: Commit
public override object Commit(Transaction trans, BTree btree, BTreeNode node)
{
Db4objects.Db4o.Internal.Btree.BTreeUpdate patch = (Db4objects.Db4o.Internal.Btree.BTreeUpdate
)ForTransaction(trans);
if (patch is BTreeCancelledRemoval)
{
object obj = patch.GetCommittedObject();
ApplyKeyChange(obj);
}
else
{
if (patch is BTreeRemove)
{
RemovedBy(trans, btree, node);
patch.Committed(btree);
return No4.Instance;
}
}
return InternalCommit(trans, btree);
}