本文整理汇总了C#中NeoDatis.GetChildAt方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetChildAt方法的具体用法?C# NeoDatis.GetChildAt怎么用?C# NeoDatis.GetChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.GetChildAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetChildAt
public override void SetChildAt(NeoDatis.Btree.IBTreeNode node, int childIndex, int
index, bool throwExceptionIfDoesNotExist)
{
NeoDatis.Btree.IBTreeNode child = node.GetChildAt(childIndex, throwExceptionIfDoesNotExist
);
children[index] = child;
if (child != null)
{
child.SetParent(this);
}
}
示例2: CheckDuplicateChildren
public static void CheckDuplicateChildren(NeoDatis.Btree.IBTreeNode node1, NeoDatis.Btree.IBTreeNode
node2)
{
if (!on)
{
return;
}
for (int i = 0; i < node1.GetNbChildren(); i++)
{
NeoDatis.Btree.IBTreeNode child1 = node1.GetChildAt(i, true);
for (int j = 0; j < node2.GetNbChildren(); j++)
{
if (child1 == node2.GetChildAt(j, true))
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Duplicated node : "
+ child1);
}
}
}
}
示例3: ValidateNode
public static void ValidateNode(NeoDatis.Btree.IBTreeNode node)
{
if (!on)
{
return;
}
int nbKeys = node.GetNbKeys();
if (node.HasParent() && nbKeys < node.GetDegree() - 1)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Node with less than "
+ (node.GetDegree() - 1) + " keys");
}
int maxNbKeys = node.GetDegree() * 2 - 1;
int nbChildren = node.GetNbChildren();
int maxNbChildren = node.GetDegree() * 2;
if (nbChildren != 0 && nbKeys == 0)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Node with no key but with children : "
+ node);
}
for (int i = 0; i < nbKeys; i++)
{
if (node.GetKeyAndValueAt(i) == null)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Null key at " +
i + " on node " + node.ToString());
}
CheckValuesOfChild(node.GetKeyAndValueAt(i), node.GetChildAt(i, false));
}
for (int i = nbKeys; i < maxNbKeys; i++)
{
if (node.GetKeyAndValueAt(i) != null)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Not Null key at "
+ i + " on node " + node.ToString());
}
}
NeoDatis.Btree.IBTreeNode previousNode = null;
for (int i = 0; i < nbChildren; i++)
{
if (node.GetChildAt(i, false) == null)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Null child at index "
+ i + " on node " + node.ToString());
}
if (previousNode != null && previousNode == node.GetChildAt(i, false))
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Two equals children at index "
+ i + " : " + previousNode.ToString());
}
previousNode = node.GetChildAt(i, false);
}
for (int i = nbChildren; i < maxNbChildren; i++)
{
if (node.GetChildAt(i, false) != null)
{
throw new NeoDatis.Btree.Exception.BTreeNodeValidationException("Not Null child at "
+ i + " on node " + node.ToString());
}
}
}
示例4: BuildDisplay
private void BuildDisplay(NeoDatis.Btree.IBTreeNode node, int currentHeight, int
childIndex, object parentId, bool withIds)
{
if (currentHeight > lines.Length - 1)
{
return;
}
// get string buffer of this line
System.Text.StringBuilder line = lines[currentHeight];
if (withIds)
{
line.Append(node.GetId()).Append(":[");
}
else
{
line.Append("[");
}
for (int i = 0; i < node.GetNbKeys(); i++)
{
if (i > 0)
{
line.Append(" , ");
}
NeoDatis.Btree.IKeyAndValue kav = node.GetKeyAndValueAt(i);
line.Append(kav.GetKey());
}
if (withIds)
{
line.Append("]:").Append(node.GetParentId()).Append("/").Append(parentId).Append(
" ");
}
else
{
line.Append("] ");
}
for (int i = 0; i < node.GetNbChildren(); i++)
{
NeoDatis.Btree.IBTreeNode child = node.GetChildAt(i, false);
if (child != null)
{
BuildDisplay(child, currentHeight + 1, i, node.GetId(), withIds);
}
else
{
lines[currentHeight + 1].Append("[Child " + (i + 1) + " null!] ");
}
}
}