public void addAndExecute(BaseCommand command) { if (root == null) { root = command; active = root; } else { command.Parent = active; active.addChild(command); active = command; } active.execute(); }
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; }
public void setActive(BaseCommand command) { //TODO: Implement recursive function to crawl up and down tree; }
//Inherited methods public void addChild(BaseCommand child) { children.Add(child); }