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.concepts;
25
26 import java.io.*;
27 import java.util.*;
28 import zeus.util.*;
29
30
31 public class ZeusAddress implements Address {
32 private String name;
33 private String host;
34 private int port;
35 private String type;
36
37 public ZeusAddress( String name, String host, int port, String type ) {
38 this.name = name;
39 this.host = host;
40 this.port = port;
41 this.type = type;
42 }
43
44 public ZeusAddress( Address addr ) {
45 name = addr.getName();
46 host = addr.getHost();
47 port = addr.getPort();
48 type = addr.getType();
49 }
50
51 public String getName() {
52 return name; }
53 public String getHost() { return host; }
54 public String getType() { return type; }
55 public int getPort() { return port; }
56
57 public boolean equals(Address addr ) {
58 return name.equals(addr.getName()) &&
59 host.equals(addr.getHost()) &&
60 port == addr.getPort() &&
61 type.equals(addr.getType());
62 }
63
64 public boolean sameAddress(Address addr ) {
65 return host.equals(addr.getHost()) &&
66 port == addr.getPort();
67 }
68
69 public String toString() {
70 return( "(" +
71 ":name " + name + " " +
72 ":host \"" + host + "\" " +
73 ":port " + port + " " +
74 ":type " + type +
75 ")"
76 );
77 }
78
79 public void setName (String name ) {
80 this.name = name;
81 }
82
83 /***
84 * allow the type to be manipulated
85 */
86 public void setType(String type) {
87 this.type = type;
88 }
89
90 }
91
92