public void Traverse(GeneralPlan <T> node, TreeVisitor <T> visitor) { visitor(node.data); foreach (GeneralPlan <T> kid in node.children) { Traverse(kid, visitor); } }
public void Validate() { CosmosAccount.Validate(); StorageAccount.Validate(); GeneralPlan.Validate(); if (Collections.Length == 0) { throw new CosbakException("No collection defined"); } foreach (var collection in Collections) { collection.Validate(); } }
// Use this for initialization void Start() { // Make a Tree structure WinRoot.AddChild("AvoidEnemy"); WinRoot.AddChild("ScrewOver"); WinRoot.AddChild("Move1"); GeneralPlan <string> AvoidEnemy = WinRoot.GetChild(1); GeneralPlan <string> ScrewOver = WinRoot.GetChild(2); GeneralPlan <string> Move = WinRoot.GetChild(3); AvoidEnemy.AddChild("Method1"); AvoidEnemy.AddChild("Method2"); GeneralPlan <string> Method1 = AvoidEnemy.GetChild(1); GeneralPlan <string> Method2 = AvoidEnemy.GetChild(2); // Method1 Arc Method1.AddChild("Idle1"); GeneralPlan <string> Idle = Method1.GetChild(1); Idle.AddChild("MoveToEnclave1"); GeneralPlan <string> MoveToEnclave = Idle.GetChild(1); MoveToEnclave.AddChild("Idle2"); //Method2 Arc Method2.AddChild("StepBack"); GeneralPlan <string> stepBack = Method2.GetChild(1); stepBack.AddChild("MoveToEnclave2"); GeneralPlan <string> MoveToEnclave1 = stepBack.GetChild(1); MoveToEnclave1.AddChild("Idle3"); //Screwover ScrewOver.AddChild("Teleport"); GeneralPlan <string> Teleport = ScrewOver.GetChild(1); Teleport.AddChild("Move2"); transverse(); }