本文整理汇总了C#中NeoDatis.GetKeyAt方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetKeyAt方法的具体用法?C# NeoDatis.GetKeyAt怎么用?C# NeoDatis.GetKeyAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.GetKeyAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckIfCanMergeWith
private void CheckIfCanMergeWith(NeoDatis.Btree.IBTreeNode node)
{
if (nbKeys + node.GetNbKeys() > maxNbKeys)
{
throw new NeoDatis.Btree.Exception.BTreeException("Trying to merge two nodes with too many keys "
+ nbKeys + " + " + node.GetNbKeys() + " > " + maxNbKeys);
}
if (nbKeys > 0)
{
System.IComparable greatestOfThis = keys[nbKeys - 1];
System.IComparable smallestOfOther = node.GetKeyAt(0);
if (greatestOfThis.CompareTo(smallestOfOther) >= 0)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Trying to merge two nodes that have intersections : "
+ ToString() + " / " + node);
}
}
if (nbKeys < nbChildren)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Trying to merge two nodes where the first one has more children than keys"
);
}
}
示例2: MergeWith
/// <summary>
/// Can only merge node without intersection => the greater key of this must
/// be smaller than the smallest key of the node
/// </summary>
public virtual void MergeWith(NeoDatis.Btree.IBTreeNode node)
{
NeoDatis.Btree.Tool.BTreeValidator.ValidateNode(this);
NeoDatis.Btree.Tool.BTreeValidator.ValidateNode(node);
CheckIfCanMergeWith(node);
int j = nbKeys;
for (int i = 0; i < node.GetNbKeys(); i++)
{
SetKeyAndValueAt(node.GetKeyAt(i), node.GetValueAsObjectAt(i), j, false, false);
SetChildAt(node, i, j, false);
j++;
}
// in this, we have to take the last child
if (node.GetNbChildren() > node.GetNbKeys())
{
SetChildAt(node, node.GetNbChildren() - 1, j, true);
}
nbKeys += node.GetNbKeys();
nbChildren += node.GetNbChildren();
NeoDatis.Btree.Tool.BTreeValidator.ValidateNode(this);
}