1 package au.gov.amsa.ais.rx;
2
3 public class HostPort {
4
5 private final String host;
6 private final int port;
7
8 public HostPort(String host, int port) {
9 super();
10 this.host = host;
11 this.port = port;
12 }
13
14 public String getHost() {
15 return host;
16 }
17
18 public int getPort() {
19 return port;
20 }
21
22 @Override
23 public int hashCode() {
24 final int prime = 31;
25 int result = 1;
26 result = prime * result + ((host == null) ? 0 : host.hashCode());
27 result = prime * result + port;
28 return result;
29 }
30
31 @Override
32 public boolean equals(Object obj) {
33 if (this == obj)
34 return true;
35 if (obj == null)
36 return false;
37 if (getClass() != obj.getClass())
38 return false;
39 HostPort other = (HostPort) obj;
40 if (host == null) {
41 if (other.host != null)
42 return false;
43 } else if (!host.equals(other.host))
44 return false;
45 if (port != other.port)
46 return false;
47 return true;
48 }
49
50 }