当前位置: 首页>>代码示例>>C#>>正文


C# Node.ToString方法代码示例

本文整理汇总了C#中System.Data.Node.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Node.ToString方法的具体用法?C# Node.ToString怎么用?C# Node.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.Node的用法示例。


在下文中一共展示了Node.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: searchPath

        public bool searchPath(Dictionary<string, string> pathMap)
        {
            PriorityQueue<Node> priorityQueue;
            priorityQueue = new PriorityQueue<Node>();

            priorityQueue.Push(this.begainNode);

            while (!priorityQueue.Empty())
            {
                Node topNode = priorityQueue.Pop();

                #region 判断是否找到目状态
                if (matched(topNode, this.targetNode))
                {
                    MessageBox.Show("Finished!");
                    return true;
                }
                #endregion

                int row = topNode.row_0;
                int col = topNode.col_0;

                if (row > 0 && topNode.cannotAct != Direction.up)
                {
                    Node curNode = new Node(topNode);

                    exchange(curNode, row, col, row - 1, col);
                    curNode.ToString();
                    curNode.cannotAct = Direction.down;

                    if (!pathMap.ContainsKey(curNode.state))
                    {
                        curNode.deepth = topNode.deepth + 1;
                        curNode.value = getValue(curNode, this.targetNode);
                        curNode.row_0 = row - 1;
                        curNode.col_0 = col;
                        priorityQueue.Push(curNode);
                        pathMap.Add(curNode.state, topNode.state);
                    }
                }

                if (row < 2 && topNode.cannotAct != Direction.down)
                {
                    Node curNode = new Node(topNode);

                    exchange(curNode, row, col, row + 1, col);
                    curNode.ToString();
                    curNode.cannotAct = Direction.up;

                    if (!pathMap.ContainsKey(curNode.state))
                    {
                        curNode.deepth = topNode.deepth + 1;
                        curNode.value = getValue(curNode, this.targetNode);
                        curNode.row_0 = row + 1;
                        curNode.col_0 = col;
                        priorityQueue.Push(curNode);
                        pathMap.Add(curNode.state, topNode.state);
                    }
                }

                if (col > 0 && topNode.cannotAct != Direction.left)
                {
                    Node curNode = new Node(topNode);

                    exchange(curNode, row, col, row, col - 1);
                    curNode.ToString();
                    curNode.cannotAct = Direction.left;
                    if (!pathMap.ContainsKey(curNode.state))
                    {
                        curNode.deepth = topNode.deepth + 1;
                        curNode.value = getValue(curNode, this.targetNode);
                        curNode.row_0 = row;
                        curNode.col_0 = col - 1;
                        priorityQueue.Push(curNode);
                        pathMap.Add(curNode.state, topNode.state);
                    }
                }

                if (col < 2 && topNode.cannotAct != Direction.right)
                {
                    Node curNode = new Node(topNode);
                    exchange(curNode, row, col, row, col + 1);
                    curNode.ToString();
                    curNode.cannotAct = Direction.right;
                    if (!pathMap.ContainsKey(curNode.state))
                    {
                        curNode.deepth = topNode.deepth + 1;
                        curNode.value = getValue(curNode, this.targetNode);
                        curNode.row_0 = row;
                        curNode.col_0 = col + 1;
                        priorityQueue.Push(curNode);
                        pathMap.Add(curNode.state, topNode.state);
                    }
                }
            }

            return false;
        }
开发者ID:xgdsmileboy,项目名称:CSharp-Lib,代码行数:98,代码来源:PlayForm.cs

示例2: AddNode

        private void AddNode(Node node)
        {
            List<TreeNode> ChildNodes = new List<TreeNode>();

            ChildNodes.Add(new TreeNode(node.ToString()));
            TreeNode Tn = new TreeNode("Status - " + node.IsOnline_ToString());
            Tn.Name = "Status";

            ChildNodes.Add(Tn);

            Tn = new TreeNode();
            Tn.Name = "Version";
            ChildNodes.Add(Tn);

            Tn = new TreeNode();
            Tn.Name = "CRC";
            ChildNodes.Add(Tn);

            Tn = new TreeNode();
            Tn.Name = "Ckp Count";
            ChildNodes.Add(Tn);

            Tn = new TreeNode();
            Tn.Name = "DeviceType";
            ChildNodes.Add(Tn);

            Tn = new TreeNode();
            Tn.Name = "Serial";
            ChildNodes.Add(Tn);

            Tn = new TreeNode();
            Tn.Name = "AppName";
            ChildNodes.Add(Tn);

            TreeNode NewParentNode = new TreeNode("Node - 0x" + node.NodeId.ToString("X2"), ChildNodes.ToArray<TreeNode>());
            NewParentNode.Tag = node;

            tvNodes.Nodes.Add(NewParentNode);
        }
开发者ID:embededhell,项目名称:TFTServiceTool,代码行数:39,代码来源:Form1.cs

示例3: RefreshGUI

 private void RefreshGUI(TreeNodeCollection Tree, Node<int> Node)
 {
     if (Node != null)
     {
         String text = Node.ToString();
         if (AdvancedBTree<int>.isLeft(Node))
             text += " (Левый)";
         else
             if (AdvancedBTree<int>.isParent(Node))
                 text += " (Корень)";
             else
                 text += " (Правый)";
         Tree.Add(text);
         RefreshGUI(Tree[Tree.Count - 1].Nodes, Node.Left);
         RefreshGUI(Tree[Tree.Count - 1].Nodes, Node.Right);
     }
 }
开发者ID:idenx,项目名称:Semestr2_TSD,代码行数:17,代码来源:Form1.cs


注:本文中的System.Data.Node.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。