Exemplo n.º 1
0
 /**
  * Finds a node that is yet to be visited and returns it
  *@param node the node to find
  *@param visited nodes that have already been visited
  *@return null if the node doesn't exist, or the node
  */
 public ActionNode findNode(ActionNode node, List<int> visited)
 {
     List<ActionNode> next = new List<ActionNode>();
     next.Add(this);
     for (int i = 0; i < next.Count; i++)
     {
         if (!visited.Contains(next[i].id) && node.equals(next[i]))
         {
             return next[i];
         }
         for (int j = 0; j < next[i].children.Count; j++)
         {
             next.Add(next[i].children[j]);
         }
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Finda a node and returns it
  *@param node the node to find
  *@return null if node doesn't exist, or the node
  */
 public ActionNode findNode(ActionNode node)
 {
     List<ActionNode> next = new List<ActionNode>();
     for (int j = 0; j < children.Count; j++)
     {
         next.Add(children[j]);
     }
     for (int i = 0; i < next.Count; i++)
     {
         if (node.equals(next[i]))
         {
             return next[i];
         }
         for (int j = 0; j < next[i].children.Count; j++)
         {
             next.Add(next[i].children[j]);
         }
     }
     return null;
 }