1
2 /*
3 * The contents of this file are subject to the BT "ZEUS" Open Source
4 * Licence (L77741), Version 1.0 (the "Licence"); you may not use this file
5 * except in compliance with the Licence. You may obtain a copy of the Licence
6 * from $ZEUS_INSTALL/licence.html or alternatively from
7 * http://www.labs.bt.com/projects/agents/zeus/licence.htm
8 *
9 * Except as stated in Clause 7 of the Licence, software distributed under the
10 * Licence is distributed WITHOUT WARRANTY OF ANY KIND, either express or
11 * implied. See the Licence for the specific language governing rights and
12 * limitations under the Licence.
13 *
14 * The Original Code is within the package zeus.*.
15 * The Initial Developer of the Original Code is British Telecommunications
16 * public limited company, whose registered office is at 81 Newgate Street,
17 * London, EC1A 7AJ, England. Portions created by British Telecommunications
18 * public limited company are Copyright 1996-2001. All Rights Reserved.
19 *
20 * THIS NOTICE MUST BE INCLUDED ON ANY COPY OF THIS FILE
21 */
22
23
24 package zeus.concepts;
25
26
27 /***
28 AMS_Description holds a description of an AMS as per fipa
29 */
30
31 public class AMS_Description {
32
33 private FIPA_AID_Address name = null;
34 private String ownership = null;
35 private String state = null;
36
37
38 public void setName (FIPA_AID_Address aid) {
39 this.name = aid;
40 }
41
42
43 public FIPA_AID_Address getName () {
44 return this.name;
45 }
46
47
48 public void setOwnership (String ownership) {
49 this.ownership = ownership;
50 }
51
52
53 public String getOwnership () {
54 return ownership;
55 }
56
57 public void setState (String state) {
58 this.state = state;
59 }
60
61
62 public String getState () {
63 return state;
64 }
65
66
67 public String toString () {
68 String retVal = new String ("(ams-agent-description ");
69
70 if (name!=null) {
71 retVal += ":name " + "(" + name.toFIPAString() + ") ";
72 }
73 if (ownership != null) {
74 retVal += ":ownership " + ownership +" ";
75 }
76
77 if (state != null ) {
78 retVal += ":state " + state + " ";
79 }
80 retVal += ")\n";
81 return retVal;
82
83 }
84
85
86
87 public boolean match (AMS_Description desc) {
88 boolean match = true;
89 debug ("in match");
90 if (name != null ) {
91 if (!desc.getName().equals (this.getName())) {
92 debug ("name doesnt match " + desc.getName().toString() +" " + name.toString() );
93 return false;
94 }
95 }
96 if (ownership!= null ) {
97 if (!desc.getOwnership().equals (this.getOwnership())) {
98 debug ("ownership doesn't match " + desc.getOwnership() +" " + ownership);
99 return false;
100 }
101 }
102 if (state != null ) {
103 if (!desc.getState().equals (this.getState())) {
104 debug ("state doesn't match " + desc.getState() + " " + state);
105 return false;
106 }
107 }
108 return (match);
109 }
110
111
112
113
114 void debug (String str) {
115 //System.out.println(str);
116
117 }
118
119 }