activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r885541 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs
Date Mon, 30 Nov 2009 19:09:59 GMT
Author: tabish
Date: Mon Nov 30 19:09:59 2009
New Revision: 885541

URL: http://svn.apache.org/viewvc?rev=885541&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-215

Add equality checks for the MessageDispatch command so that the command can be correctly used
in collections.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs?rev=885541&r1=885540&r2=885541&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageDispatch.cs
Mon Nov 30 19:09:59 2009
@@ -91,6 +91,48 @@
             set { this.redeliveryCounter = value; }
         }
 
+        public override int GetHashCode()
+        {
+            int answer = 0;
+
+            answer = (answer * 37) + HashCode(ConsumerId);
+            answer = (answer * 37) + HashCode(Destination);
+            answer = (answer * 37) + HashCode(Message);
+            answer = (answer * 37) + HashCode(RedeliveryCounter);
+
+            return answer;
+        }
+
+        public override bool Equals(object that)
+        {
+            if(that is MessageDispatch)
+            {
+                return Equals((MessageDispatch) that);
+            }
+            return false;
+        }
+
+        public virtual bool Equals(MessageDispatch that)
+        {
+            if(!Equals(this.ConsumerId, that.ConsumerId))
+            {
+                return false;
+            }
+            if(!Equals(this.Destination, that.Destination))
+            {
+                return false;
+            }
+            if(!Equals(this.Message, that.Message))
+            {
+                return false;
+            }
+            if(!Equals(this.RedeliveryCounter, that.RedeliveryCounter))
+            {
+                return false;
+            }
+
+            return true;
+        }
         ///
         /// <summery>
         ///  Return an answer of true to the isMessageDispatch() query.



Mime
View raw message