You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2014/03/12 19:36:05 UTC

svn commit: r1576847 - /activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs

Author: jgomes
Date: Wed Mar 12 18:36:05 2014
New Revision: 1576847

URL: http://svn.apache.org/r1576847
Log:
Added GetHashCode() implementation. When overriding Equals(), this should also be implemented.

Modified:
    activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs

Modified: activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs?rev=1576847&r1=1576846&r2=1576847&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.AMQP/trunk/src/main/csharp/BaseMessage.cs Wed Mar 12 18:36:05 2014
@@ -209,6 +209,62 @@ namespace Apache.NMS.Amqp
             return true;
         }
 
+		public override int GetHashCode()
+		{
+			int hashCode = 0;
+
+			if(propertiesMap != null)
+			{
+				hashCode ^= propertiesMap.GetHashCode();
+			}
+
+			if(destination != null)
+			{
+				hashCode ^= destination.GetHashCode();
+			}
+
+			if(correlationId != null)
+			{
+				hashCode ^= correlationId.GetHashCode();
+			}
+
+			if(timeToLive != null)
+			{
+				hashCode ^= timeToLive.GetHashCode();
+			}
+
+			if(messageId != null)
+			{
+				hashCode ^= messageId.GetHashCode();
+			}
+
+			hashCode ^= deliveryMode.GetHashCode();
+			hashCode ^= priority.GetHashCode();
+
+			if(replyTo != null)
+			{
+				hashCode ^= replyTo.GetHashCode();
+			}
+
+			if(content != null)
+			{
+				hashCode ^= content.GetHashCode();
+			}
+
+			if(type != null)
+			{
+				hashCode ^= type.GetHashCode();
+			}
+
+			if(timestamp != null)
+			{
+				hashCode ^= timestamp.GetHashCode();
+			}
+
+			hashCode ^= readOnlyMsgBody.GetHashCode();
+			return hashCode;
+		}
+
         public bool ReadOnlyBody
         {
             get { return readOnlyMsgBody; }