示例#1
0
文件: Search.cs 项目: GSKSan/Towel
        internal static Stepper <Node> BuildPath <AlgorithmNode, Node, Numeric>(BaseAlgorithmNode <AlgorithmNode, Node> node)
            where AlgorithmNode : BaseAlgorithmNode <AlgorithmNode, Node>
        {
            PathNode <Node> start = BuildPathRecursive <AlgorithmNode, Node, Numeric>(node, out PathNode <Node> end);

            return(step =>
            {
                PathNode <Node> current = start;
                while (current != null)
                {
                    step(current.Value);
                    current = current.Next;
                }
            });
        }
示例#2
0
文件: Search.cs 项目: GSKSan/Towel
 internal static PathNode <Node> BuildPathRecursive <AlgorithmNode, Node, Numeric>(BaseAlgorithmNode <AlgorithmNode, Node> currentNode, out PathNode <Node> currentPathNode)
     where AlgorithmNode : BaseAlgorithmNode <AlgorithmNode, Node>
 {
     if (currentNode.Previous == null)
     {
         PathNode <Node> start = new PathNode <Node>()
         {
             Value = currentNode.Value
         };
         currentPathNode = start;
         return(start);
     }
     else
     {
         PathNode <Node> start = BuildPathRecursive <AlgorithmNode, Node, Numeric>(currentNode.Previous, out PathNode <Node> previous);
         currentPathNode = new PathNode <Node>()
         {
             Value = currentNode.Value
         };
         previous.Next = currentPathNode;
         return(start);
     }
 }