本文整理汇总了C#中TreeNode.getData方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.getData方法的具体用法?C# TreeNode.getData怎么用?C# TreeNode.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode.getData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: internalInsert
private void internalInsert(TreeNode node, int data)
{
if (data.Equals(node.getData()))
{
return;
}
else if (data < node.getData())
{
if (node.getLeft()==null)
{
node.left = new TreeNode(null, null, data);
}
else
{
internalInsert(node.getLeft(), data);
}
}
else if (data > node.getData())
{
if (node.getRight()==null)
{
node.right = new TreeNode(null, null, data);
}
else
{
internalInsert(node.getRight(), data);
}
}
}
示例2: internalInorder
private void internalInorder(TreeNode node, ref string output)
{
if (node != null)
{
internalInorder(node.getLeft(), ref output);
output += Convert.ToString(node.getData());
output += " ";
internalInorder(node.getRight(), ref output);
}
}
示例3: dot
/*!
\brief This function pretty print the tree for debugging.
\details The synthax of this pretty print function can be given to dot (graphiz)
\param node The root of the tree
\param str The string where to append the text
*/
public void PPRecTree(TreeNode<PromoterNodeData> node, ref string str)
{
if (node != null)
{
if (node.getLeftNode() != null)
{
str += "\"" + node.getData().value + "\"" + "->" + "\"" +node.getLeftNode().getData().value + "\"\n";
PPRecTree(node.getLeftNode(), ref str);
}
if (node.getRightNode() != null)
{
str += "\"" + node.getData().value + "\"" + "->" + "\"" + node.getRightNode().getData().value + "\"\n";
PPRecTree(node.getRightNode(), ref str);
}
}
}
示例4: execWord
// FIXME : check issues like node == null etc;
/*!
Execute a Node of type : Word
\param node The node of the tree to execute
\param molecules The list of molecules
\return return the concentration of the molecule in the node.
*/
private Molecule execWord(TreeNode<PromoterNodeData> node, ArrayList molecules)
{
return ReactionEngine.getMoleculeFromName(node.getData().value, molecules);
}
示例5: execNum
// FIXME : check issues like bad parse and node == null
/*!
Execute a Node of type : Num
\param node The node of the tree to execute
\param molecules The list of molecules
\return The value that contain the node
*/
private float execNum(TreeNode<PromoterNodeData> node, ArrayList molecules)
{
return float.Parse(node.getData().value.Replace(",", "."));
}
示例6: execNode
/*!
Execute a Node.
\param node The node of the tree to execute
\param molecules The list of molecules
\return The result of the function
*/
private float execNode(TreeNode<PromoterNodeData> node, ArrayList molecules)
{
if (node != null)
{
if (node.getData().token == PromoterParser.eNodeType.OR)
return Math.Max(execNode(node.getLeftNode(), molecules), execNode(node.getRightNode(), molecules));
else if (node.getData().token == PromoterParser.eNodeType.AND)
return Math.Min(execNode(node.getLeftNode(), molecules), execNode(node.getRightNode(), molecules));
else if (node.getData().token == PromoterParser.eNodeType.NOT)
return 1f - execNode(node.getLeftNode(), molecules);
else if (node.getData().token == PromoterParser.eNodeType.CONSTANT)
return execConstant(node, molecules);
else if (node.getData().token == PromoterParser.eNodeType.BOOL)
return execBool(node);
else if (node.getData().token == PromoterParser.eNodeType.WORD)
{
Molecule mol = ReactionEngine.getMoleculeFromName(node.getData().value, molecules);
if (mol != null)
return mol.getConcentration();
}
else if (node.getData().token == PromoterParser.eNodeType.NUM)
return float.Parse(node.getData().value.Replace(",", "."));
}
return 1.0f;
}
示例7: execBool
// FIXME : check issues like node == null etc;
/*!
Execute a Node of type : Bool
\param node The node of the tree to execute
\return 1 if the value of the node is True, 0 else
*/
private float execBool(TreeNode<PromoterNodeData> node)
{
if (node.getData().value == "T")
return 1f;
return 0f;
}
示例8: internalPostOrder
private void internalPostOrder(TreeNode node, ref string output)
{
if (node != null)
{
internalPostOrder(node.left, ref output);
internalPostOrder(node.right, ref output);
output += Convert.ToString(node.getData());
output += " ";
}
}