Example #1
0
 public ExecutionNode(Task nodeTask)
 {
     parent = null;
       task = nodeTask;
       // Register with the task event
       Load();
       if (task != null)
     task.TaskChange += new Task.Changed(task_TaskChange);
 }
Example #2
0
 public void Add(ExecutionNode aNode)
 {
     if (TreeView != null && TreeView.InvokeRequired) {
     AddCallBack d = new AddCallBack(Add);
     TreeView.Invoke(d, new object[] { aNode });
       } else {
     Nodes.Add(aNode);
     aNode.Parent = this;
       }
 }
Example #3
0
 public void Add(Task owner, Task child)
 {
     if (task.Equals(owner)) {
     ExecutionNode n = new ExecutionNode(child);
     Add(n);
       } else {
     foreach (ExecutionNode c in Nodes)
       c.Add(owner, child);
       }
 }
Example #4
0
 public ExecutionTree(ref Environment environment)
 {
     env = environment;
       root = new ExecutionNode(new RootTask());
 }
Example #5
0
 /// <summary>
 /// Received a response from the operator with the results of the client
 /// task request in the environment. Check if a valid agent is registered
 /// and form a coordination group with the respective agents if required.
 /// </summary>
 /// <param name="destination">Client agent which made the original request</param>
 /// <param name="task">The results of the Client task request in the enivornment</param>
 private void HandleInformMessage(Agent destination, ClientTask task)
 {
     if (task.RegisteredAgents.Count > 0) {
     // Create an entry in the execution tree. For now the order
     // is placed as a task in the tree with the current client as
     // the target.
     ExecutionNode n = new ExecutionNode(task);
     tree.Root.Add(n);
     // Greedy method means that the best payoff result will be assigned to the
     // coordination group.
     // Send a message to the client and the manufacturer informing them of
     // the current situation
     InformMessage i = new InformMessage(this, task);
     // Send the message first to the client
     messageQueue.SendPost(task.Agent, i);
     // Generate a manufacturer task
     ManufacturerTask mTask = new ManufacturerTask((ClientAgent)task.Agent);
     mTask.Agent = task.RegisteredAgents[0].TaskAgent;
     tree.AddChild(task, mTask);
     i = new InformMessage(this, mTask);
     // Send the message also to the manufacturer
     communicationNode.AddEdge(task.RegisteredAgents[0].TaskAgent.CommunicationNode);
     messageQueue.SendPost(task.RegisteredAgents[0].TaskAgent, i);
       }
 }
Example #6
0
 public new void Remove()
 {
     if (TreeView != null && TreeView.InvokeRequired) {
     RemoveCallBack d = new RemoveCallBack(Remove);
     TreeView.Invoke(d, new object[] { });
       } else {
     foreach (ExecutionNode child in Nodes) {
       child.Remove();
     }
     Nodes.Remove(this);
     parent = null;
       }
 }