コード例 #1
0
 public void addAndExecute(BaseCommand command)
 {
     if (root == null)
     {
         root = command;
         active = root;
     }
     else
     {
         command.Parent = active;
         active.addChild(command);
         active = command;
     }
     active.execute();
 }
コード例 #2
0
        private static BaseCommand reParseTree(BaseCommand node, int id)
        {
            BaseCommand activeNode = null;

            if(node.id == id)
            {
                activeNode = node;
            }
            if(!node.Children.Equals(null) && node.Children.Count > 0)
            {

                foreach (BaseCommand child in node.Children)
                {
                    child.Parent = node;
                    BaseCommand recNode = CommandTree.reParseTree(child, id);
                    if (recNode != null) activeNode = recNode;

                }
            }
            return activeNode;
        }
コード例 #3
0
 public void setActive(BaseCommand command)
 {
     //TODO: Implement recursive function to crawl up and down tree;
 }
コード例 #4
0
 //Inherited methods
 public void addChild(BaseCommand child)
 {
     children.Add(child);
 }