|
From: <rm...@hy...> - 2007-03-25 00:08:09
|
Author: rmorgan Date: 2007-03-24 16:08:05 -0800 (Sat, 24 Mar 2007) New Revision: 3873 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3873 Modified: trunk/src/org/hyperic/hq/agent/client/AgentConnection.java Log: Add equals() and hashCode(). Modified: trunk/src/org/hyperic/hq/agent/client/AgentConnection.java =================================================================== --- trunk/src/org/hyperic/hq/agent/client/AgentConnection.java 2007-03-24 23:19:21 UTC (rev 3872) +++ trunk/src/org/hyperic/hq/agent/client/AgentConnection.java 2007-03-25 00:08:05 UTC (rev 3873) @@ -68,6 +68,14 @@ _agentAPI = new AgentAPI(); } + public String getAgentAddress() { + return _agentAddress; + } + + public int getAgentPort() { + return _agentPort; + } + protected Socket getSocket() throws AgentConnectionException { @@ -213,4 +221,14 @@ } } } + + public boolean equals(Object o) { + return o instanceof AgentConnection && + ((AgentConnection)o).getAgentAddress().equals(getAgentAddress()) && + ((AgentConnection)o).getAgentPort() == getAgentPort(); + } + + public int hashCode() { + return getAgentAddress().hashCode() + getAgentPort(); + } } |