KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > legacy > connection > EndPointInfoImpl


1 /*
2  * @(#)EndPointInfoImpl.java 1.35 04/06/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.legacy.connection;
9
10 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
11 import com.sun.corba.se.spi.transport.SocketInfo;
12
13 public class EndPointInfoImpl
14     implements
15     SocketInfo,
16     LegacyServerSocketEndPointInfo
17 {
18
19     protected String JavaDoc type;
20     protected String JavaDoc hostname;
21     protected int port;
22     protected int locatorPort;
23     protected String JavaDoc name;
24
25     public EndPointInfoImpl(String JavaDoc type, int port, String JavaDoc hostname) {
26     this.type = type;
27     this.port = port;
28     this.hostname = hostname;
29     this.locatorPort = -1;
30     this.name = LegacyServerSocketEndPointInfo.NO_NAME;
31     }
32
33     public String JavaDoc getType() {
34     return type;
35     }
36
37     public String JavaDoc getHost() {
38     return hostname;
39     }
40
41     public String JavaDoc getHostName() {
42     return hostname;
43     }
44
45     public int getPort() {
46     return port;
47     }
48
49     public int getLocatorPort ()
50     {
51     return locatorPort;
52     }
53
54     public void setLocatorPort (int port)
55     {
56     locatorPort = port;
57     }
58
59     public String JavaDoc getName()
60     {
61     return name;
62     }
63
64     public int hashCode() {
65         return type.hashCode() ^ hostname.hashCode() ^ port;
66     }
67
68     public boolean equals(Object JavaDoc obj) {
69         if (!(obj instanceof EndPointInfoImpl)) {
70             return false;
71     }
72         EndPointInfoImpl other = (EndPointInfoImpl)obj;
73     if (type == null) {
74         if (other.type != null) {
75         return false;
76         }
77     } else if (!type.equals(other.type)) {
78         return false;
79     }
80         if (port != other.port) {
81             return false;
82     }
83         if (!hostname.equals(other.hostname)) {
84             return false;
85         }
86         return true;
87     }
88
89     public String JavaDoc toString ()
90     {
91     return
92         type + " " +
93         name + " " +
94         hostname + " " +
95         port;
96     }
97 }
98
99 // End of file.
100
Popular Tags