예제 #1
0
 public List<CompositeNode> GetAllChildrenNodes(CompositeNode fatherNode)
 {
     var dependentNodes = Edges.Where(e => e.StartingNode == fatherNode).Select(e => e.EndingNode);
     if (dependentNodes != null)
     {
         return dependentNodes.ToList();
     }
     else
         return null;
 }
 public override void Handle(CompositeNodeStateType type, CompositeNode node)
 {
     if (type == CompositeNodeStateType.Completed)
     {
         Console.WriteLine("Node state changed to Completed");
         node.State = new CompletedState();
     }
     else
         Console.WriteLine("Invalid State");
 }
예제 #3
0
 private void Subscribe(CompositeNode node)
 {
     node.Event += node_Event;
 }
예제 #4
0
 public bool VerifyFatherState(CompositeNode childrenNode)
 {
     bool fathersCompleted = true;
     var FatherNodes = Edges.Where(e => e.EndingNode == childrenNode).Select(e => e.StartingNode).ToList();
     foreach (var node in FatherNodes)
     {
         if (node.State.GetType() != typeof(CompletedState))
         {
             fathersCompleted = false;
             break;
         }
     }
     return fathersCompleted;
 }
예제 #5
0
 public override void Handle(CompositeNodeStateType type, CompositeNode node)
 {
     Console.WriteLine("Node job is completed");
 }
 public abstract void Handle(CompositeNodeStateType type, CompositeNode node);