1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package zeus.actors.rtn.util;
25
26 import java.util.*;
27 import zeus.util.*;
28 import zeus.concepts.*;
29
30 /***
31 * This structure holds contract related information being communicated
32 * between two agents. During the contracting phase, the information will
33 * mostly realate to the evolving stages of the contract (e.g. call,
34 * proposal, counter, accept, etc.). Following the contracting phase, and
35 * during the execution/monitoring phase the information will relate to
36 * deliverables, payment, invoice, exceptions, etc.
37 */
38
39 public class DelegationStruct {
40 /*** The agent sending the message */
41 public String agent = null;
42
43 /*** The type of message, e.g. cfp, propose, accept, reject, etc. */
44 public String msg_type = null;
45
46 /*** The delegation reference that uniquely identifies the goal/contract */
47 public String key = null;
48
49 /***
50 * A vector containing: (a) the goals, during contracting phase, and (b)
51 * facts, during the execution/monitoring phase.
52 */
53 public Vector goals = null;
54
55 public DelegationStruct(String agent, String type,
56 String key, Vector goals) {
57 this.agent = agent;
58 this.msg_type = type;
59 this.key = key;
60 this.goals = goals;
61 }
62 public DelegationStruct(String agent, String type,
63 String key, Goal goal) {
64 this.agent = agent;
65 this.msg_type = type;
66 this.key = key;
67 this.goals = new Vector();
68 this.goals.addElement(goal);
69 }
70 public DelegationStruct(String agent, String type,
71 String key, Fact goal) {
72 this.agent = agent;
73 this.msg_type = type;
74 this.key = key;
75 this.goals = new Vector();
76 this.goals.addElement(goal);
77 }
78
79 public String toString() {
80 String output = "(agent " + agent + "\n" +
81 " msg_type " + msg_type + "\n" +
82 " key " + key + "\n" +
83 " goals " + goals + "\n" + ")";
84 return output;
85 }
86 }