You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2007/06/22 19:12:27 UTC

svn commit: r549883 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java

Author: rajdavies
Date: Fri Jun 22 10:12:26 2007
New Revision: 549883

URL: http://svn.apache.org/viewvc?view=rev&rev=549883
Log:
added equals() hashCode() methods

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java?view=diff&rev=549883&r1=549882&r2=549883
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/SubscriptionInfo.java Fri Jun 22 10:12:26 2007
@@ -89,5 +89,23 @@
     public String toString() {
         return IntrospectionSupport.toString(this);
     }
+    
+    public int hasCode() {
+        int h1 = clientId != null ? clientId.hashCode():-1;
+        int h2 = subcriptionName != null ? subcriptionName.hashCode():-1;
+        return h1 ^ h2;
+    }
+    
+    public boolean equals(Object obj){
+        boolean result=false;
+        if(obj instanceof SubscriptionInfo){
+            SubscriptionInfo other=(SubscriptionInfo)obj;
+            result=(clientId==null&&other.clientId==null||clientId!=null&&other.clientId!=null
+                    &&clientId.equals(other.clientId))
+                    &&(subcriptionName==null&&other.subcriptionName==null||subcriptionName!=null
+                            &&other.subcriptionName!=null&&subcriptionName.equals(other.subcriptionName));
+        }
+        return result;
+    }
 
 }