View Javadoc

1   /*
2   * The contents of this file are subject to the BT "ZEUS" Open Source 
3   * Licence (L77741), Version 1.0 (the "Licence"); you may not use this file 
4   * except in compliance with the Licence. You may obtain a copy of the Licence
5   * from $ZEUS_INSTALL/licence.html or alternatively from
6   * http://www.labs.bt.com/projects/agents/zeus/licence.htm
7   * 
8   * Except as stated in Clause 7 of the Licence, software distributed under the
9   * Licence is distributed WITHOUT WARRANTY OF ANY KIND, either express or 
10  * implied. See the Licence for the specific language governing rights and 
11  * limitations under the Licence.
12  * 
13  * The Original Code is within the package zeus.*.
14  * The Initial Developer of the Original Code is British Telecommunications
15  * public limited company, whose registered office is at 81 Newgate Street, 
16  * London, EC1A 7AJ, England. Portions created by British Telecommunications 
17  * public limited company are Copyright 1996-9. All Rights Reserved.
18  * 
19  * THIS NOTICE MUST BE INCLUDED ON ANY COPY OF THIS FILE
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  }