本文整理汇总了C#中ITreeAdaptor.GetNodeText方法的典型用法代码示例。如果您正苦于以下问题:C# ITreeAdaptor.GetNodeText方法的具体用法?C# ITreeAdaptor.GetNodeText怎么用?C# ITreeAdaptor.GetNodeText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITreeAdaptor
的用法示例。
在下文中一共展示了ITreeAdaptor.GetNodeText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNodeText
protected virtual string GetNodeText( ITreeAdaptor adaptor, object t )
{
string text = adaptor.GetNodeText(t);
string uniqueName = "n" + GetNodeNumber( t );
return string.Format( NodeFormat, uniqueName, FixString( text ) );
}
示例2: _Equals
protected static bool _Equals(object t1, object t2, ITreeAdaptor adaptor)
{
// make sure both are non-null
if (t1 == null || t2 == null)
{
return false;
}
// check roots
if (adaptor.GetNodeType(t1) != adaptor.GetNodeType(t2))
{
return false;
}
if (!adaptor.GetNodeText(t1).Equals(adaptor.GetNodeText(t2)))
{
return false;
}
// check children
int n1 = adaptor.GetChildCount(t1);
int n2 = adaptor.GetChildCount(t2);
if (n1 != n2)
{
return false;
}
for (int i = 0; i < n1; i++)
{
object child1 = adaptor.GetChild(t1, i);
object child2 = adaptor.GetChild(t2, i);
if (!_Equals(child1, child2, adaptor))
{
return false;
}
}
return true;
}
示例3: DefineEdges
protected virtual IEnumerable<string> DefineEdges( object tree, ITreeAdaptor adaptor )
{
if ( tree == null )
yield break;
int n = adaptor.GetChildCount( tree );
if ( n == 0 )
{
// must have already dumped as child from previous
// invocation; do nothing
yield break;
}
string parentName = "n" + GetNodeNumber( tree );
// for each child, do a parent -> child edge using unique node names
string parentText = adaptor.GetNodeText( tree );
for ( int i = 0; i < n; i++ )
{
object child = adaptor.GetChild( tree, i );
string childText = adaptor.GetNodeText(child);
string childName = "n" + GetNodeNumber( child );
yield return string.Format( EdgeFormat, parentName, childName, FixString( parentText ), FixString( childText ) );
foreach ( var t in DefineEdges( child, adaptor ) )
yield return t;
}
}