summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/TcpEndpoint.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-03-15 17:31:40 +0000
committerMark Spruiell <mes@zeroc.com>2002-03-15 17:31:40 +0000
commitcc2d33bed4baaaef7b88ac2073902c8ba56a2af3 (patch)
tree661bea1cf5921d6fd1ed99e58556d537b736ac54 /java/src/IceInternal/TcpEndpoint.java
parentFixed up the slice2docbook for the SslExtension and SslSystem related (diff)
downloadice-cc2d33bed4baaaef7b88ac2073902c8ba56a2af3.tar.bz2
ice-cc2d33bed4baaaef7b88ac2073902c8ba56a2af3.tar.xz
ice-cc2d33bed4baaaef7b88ac2073902c8ba56a2af3.zip
adding hashCode
Diffstat (limited to 'java/src/IceInternal/TcpEndpoint.java')
-rw-r--r--java/src/IceInternal/TcpEndpoint.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/java/src/IceInternal/TcpEndpoint.java b/java/src/IceInternal/TcpEndpoint.java
index fd0fd5b6241..ac4ac6a2a5d 100644
--- a/java/src/IceInternal/TcpEndpoint.java
+++ b/java/src/IceInternal/TcpEndpoint.java
@@ -19,6 +19,7 @@ public final class TcpEndpoint extends Endpoint
_host = ho;
_port = po;
_timeout = ti;
+ calcHashValue();
}
public
@@ -114,6 +115,8 @@ public final class TcpEndpoint extends Endpoint
{
_host = _instance.defaultHost();
}
+
+ calcHashValue();
}
public
@@ -125,6 +128,7 @@ public final class TcpEndpoint extends Endpoint
_port = s.readInt();
_timeout = s.readInt();
s.endReadEncaps();
+ calcHashValue();
}
//
@@ -294,6 +298,12 @@ public final class TcpEndpoint extends Endpoint
return tcpAcceptor.equivalent(_host, _port);
}
+ public int
+ hashCode()
+ {
+ return _hashCode;
+ }
+
//
// Compare endpoints for sorting purposes
//
@@ -368,8 +378,17 @@ public final class TcpEndpoint extends Endpoint
return 0;
}
+ private void
+ calcHashValue()
+ {
+ _hashCode = _host.hashCode();
+ _hashCode = 5 * _hashCode + _port;
+ _hashCode = 5 * _hashCode + _timeout;
+ }
+
private Instance _instance;
private String _host;
private int _port;
private int _timeout;
+ private int _hashCode;
}