本文整理汇总了C#中Db4objects.Db4o.Internal.Btree.BTreeNode类的典型用法代码示例。如果您正苦于以下问题:C# BTreeNode类的具体用法?C# BTreeNode怎么用?C# BTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BTreeNode类属于Db4objects.Db4o.Internal.Btree命名空间,在下文中一共展示了BTreeNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BTree
public BTree(Transaction trans, BTreeConfiguration config, int id, IIndexable4 keyHandler
, int treeNodeSize) : base(config._idSystem)
{
_config = config;
if (null == keyHandler)
{
throw new ArgumentNullException();
}
_nodeSize = treeNodeSize;
_nodeCache = CacheFactory.NewLRUIntCache(config._cacheSize);
_halfNodeSize = _nodeSize / 2;
_nodeSize = _halfNodeSize * 2;
_keyHandler = keyHandler;
SetID(id);
if (IsNew())
{
SetStateDirty();
_root = new BTreeNode(this, 0, true, 0, 0, 0);
_root.Write(trans.SystemTransaction());
AddNode(_root);
Write(trans.SystemTransaction());
}
else
{
SetStateDeactivated();
}
}
开发者ID:superyfwy,项目名称:db4o,代码行数:27,代码来源:BTree.cs
示例2: AssertTransactionalSize
private void AssertTransactionalSize(BTreeNode node)
{
Transaction otherTrans = NewTransaction();
int originalSize = node.Size(Trans());
Assert.IsGreater(0, originalSize);
for (int i = originalSize - 1; i > 0; i--)
{
object key = node.Key(Trans(), i);
node.Remove(Trans(), PrepareComparison(key), key, i);
}
Assert.AreEqual(1, node.Size(Trans()));
Assert.AreEqual(originalSize, node.Size(otherTrans));
node.Commit(Trans());
Assert.AreEqual(1, node.Size(otherTrans));
object newKey = node.Key(Trans(), 0);
node.Add(Trans(), PrepareComparison(newKey), newKey);
Assert.AreEqual(2, node.Size(Trans()));
Assert.AreEqual(1, node.Size(otherTrans));
node.Commit(Trans());
Assert.AreEqual(2, node.Size(Trans()));
Assert.AreEqual(2, node.Size(otherTrans));
node.Remove(Trans(), PrepareComparison(newKey), newKey, 1);
Assert.AreEqual(1, node.Size(Trans()));
Assert.AreEqual(2, node.Size(otherTrans));
node.Add(Trans(), PrepareComparison(newKey), newKey);
Assert.AreEqual(2, node.Size(Trans()));
Assert.AreEqual(2, node.Size(otherTrans));
}
开发者ID:Galigator,项目名称:db4o,代码行数:28,代码来源:BTreeNodeTestCase.cs
示例3: AssertInReadModeOrCached
private void AssertInReadModeOrCached(BTreeNode node)
{
if (IsCached(node))
{
return;
}
Assert.IsFalse(node.CanWrite());
}
开发者ID:Galigator,项目名称:db4o,代码行数:8,代码来源:BTreePointerTestCase.cs
示例4: TestTransactionalSize
public virtual void TestTransactionalSize()
{
BTreeNode node = Node(3);
AssertTransactionalSize(node);
int id = node.GetID();
BTreeNode readNode = new BTreeNode(id, _btree);
AssertTransactionalSize(readNode);
}
开发者ID:Galigator,项目名称:db4o,代码行数:8,代码来源:BTreeNodeTestCase.cs
示例5: Commit
public override object Commit(Transaction trans, BTree btree, BTreeNode node)
{
if (_transaction == trans)
{
return GetObject();
}
return this;
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:8,代码来源:BTreeAdd.cs
示例6: BTreeNode
public BTreeNode(Transaction trans, BTreeNode firstChild
, BTreeNode secondChild) : this(firstChild._btree
, 2, false, 0, 0, 0)
{
_keys[0] = firstChild._keys[0];
_children[0] = firstChild;
_keys[1] = secondChild._keys[0];
_children[1] = secondChild;
Write(trans.SystemTransaction());
firstChild.SetParentID(trans, GetID());
secondChild.SetParentID(trans, GetID());
}
开发者ID:masroore,项目名称:db4o,代码行数:12,代码来源:BTreeNode.cs
示例7: BTreePointer
public BTreePointer(Transaction transaction, ByteArrayBuffer nodeReader, BTreeNode
node, int index)
{
if (transaction == null || node == null)
{
throw new ArgumentNullException();
}
_transaction = transaction;
_nodeReader = nodeReader;
_node = node;
_index = index;
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:12,代码来源:BTreePointer.cs
示例8: 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);
}
开发者ID:superyfwy,项目名称:db4o,代码行数:20,代码来源:BTreeUpdate.cs
示例9: BTreeNodeSearchResult
internal BTreeNodeSearchResult(Transaction trans, ByteArrayBuffer nodeReader, BTree
btree, BTreeNode node, int cursor, bool foundMatch) : this(trans, btree, PointerOrNull
(trans, nodeReader, node, cursor), foundMatch)
{
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:5,代码来源:BTreeNodeSearchResult.cs
示例10: Commit
public abstract object Commit(Transaction trans, BTree btree, BTreeNode node);
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:1,代码来源:BTreePatch.cs
示例11: AdjustSizeOnRemovalByOtherTransaction
protected override void AdjustSizeOnRemovalByOtherTransaction(BTree btree, BTreeNode
node)
{
// The size was reduced for this entry, let's change back.
btree.SizeChanged(_transaction, node, +1);
}
开发者ID:masroore,项目名称:db4o,代码行数:6,代码来源:BTreeRemove.cs
示例12: _IFunction4_605
public _IFunction4_605(BTreeNode node)
{
this.node = node;
}
开发者ID:erdincay,项目名称:db4o,代码行数:4,代码来源:BTree.cs
示例13: EvictedFromCache
public virtual void EvictedFromCache(BTreeNode node)
{
_evictedFromCache = ((TreeIntObject)Tree.Add(_evictedFromCache, new TreeIntObject
(node.GetID(), node)));
}
开发者ID:erdincay,项目名称:db4o,代码行数:5,代码来源:BTree.cs
示例14: NotifyCountChanged
public virtual void NotifyCountChanged(Transaction trans, BTreeNode node, int diff
)
{
if (_structureListener != null)
{
_structureListener.NotifyCountChanged(trans, node, diff);
}
}
开发者ID:erdincay,项目名称:db4o,代码行数:8,代码来源:BTree.cs
示例15: CacheEntry
internal virtual BTreeNodeCacheEntry CacheEntry(BTreeNode node)
{
return ((BTreeNodeCacheEntry)_nodeCache.Produce(node.GetID(), new _IFunction4_605
(node), new _IProcedure4_609(this)));
}
开发者ID:erdincay,项目名称:db4o,代码行数:5,代码来源:BTree.cs
示例16: RemovedBy
public virtual void RemovedBy(Transaction trans, BTree btree, BTreeNode node)
{
if (trans != _transaction)
{
AdjustSizeOnRemovalByOtherTransaction(btree, node);
}
if (HasNext())
{
_next.RemovedBy(trans, btree, node);
}
}
开发者ID:masroore,项目名称:db4o,代码行数:11,代码来源:BTreeUpdate.cs
示例17: NotifyDeleted
public virtual void NotifyDeleted(Transaction trans, BTreeNode node)
{
if (_structureListener != null)
{
_structureListener.NotifyDeleted(trans, node);
}
}
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:BTree.cs
示例18: AdjustSizeOnRemovalByOtherTransaction
protected abstract void AdjustSizeOnRemovalByOtherTransaction(BTree btree, BTreeNode
node);
开发者ID:masroore,项目名称:db4o,代码行数:2,代码来源:BTreeUpdate.cs
示例19: Split
private Db4objects.Db4o.Internal.Btree.BTreeNode Split(Transaction trans)
{
Db4objects.Db4o.Internal.Btree.BTreeNode res = new Db4objects.Db4o.Internal.Btree.BTreeNode
(_btree, _btree._halfNodeSize, _isLeaf, _parentID, GetID(), _nextID);
System.Array.Copy(_keys, _btree._halfNodeSize, res._keys, 0, _btree._halfNodeSize
);
for (int i = _btree._halfNodeSize; i < _keys.Length; i++)
{
_keys[i] = null;
}
if (_children != null)
{
res._children = new object[_btree.NodeSize()];
System.Array.Copy(_children, _btree._halfNodeSize, res._children, 0, _btree._halfNodeSize
);
for (int i = _btree._halfNodeSize; i < _children.Length; i++)
{
_children[i] = null;
}
}
_count = _btree._halfNodeSize;
res.Write(trans.SystemTransaction());
_btree.AddNode(res);
int splitID = res.GetID();
PointNextTo(trans, splitID);
SetNextID(trans, splitID);
if (_children != null)
{
for (int i = 0; i < _btree._halfNodeSize; i++)
{
if (res._children[i] == null)
{
break;
}
res.Child(i).SetParentID(trans, splitID);
}
}
_btree.NotifySplit(trans, this, res);
return res;
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:40,代码来源:BTreeNode.cs
示例20: RemoveNode
internal virtual void RemoveNode(BTreeNode node)
{
_nodes = (TreeIntObject)((TreeInt)_nodes.RemoveLike(new TreeInt(node.GetID())));
}
开发者ID:erdincay,项目名称:db4o,代码行数:4,代码来源:BTree.cs
注:本文中的Db4objects.Db4o.Internal.Btree.BTreeNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论