lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [27/50] lucenenet git commit: Lucene.Net.Queries.Function.ValueSources.EnumFieldSource: Use Collections.Equals() and Collections.GetHashCode() to compare the dictionaries
Date Thu, 30 Mar 2017 18:00:22 GMT
Lucene.Net.Queries.Function.ValueSources.EnumFieldSource: Use Collections.Equals() and Collections.GetHashCode()
to compare the dictionaries


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d21dd797
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d21dd797
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d21dd797

Branch: refs/heads/api-work
Commit: d21dd7971e9955305614d2fcb6154b64bbd0453b
Parents: 39333d0
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Mar 30 09:09:06 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Mar 30 09:12:52 2017 +0700

----------------------------------------------------------------------
 .../Function/ValueSources/EnumFieldSource.cs          | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d21dd797/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
index 4dd4c02..532155c 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/EnumFieldSource.cs
@@ -309,11 +309,14 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
             EnumFieldSource that = (EnumFieldSource)o;
 
-            if (!enumIntToStringMap.Equals(that.enumIntToStringMap))
+            // LUCENENET TODO: Make an EquatableDictionary so we can use Equatable.Wrap()
here ?
+            // LUCENENET specific: must use Collections.Equals() to ensure values
+            // contained within the dictionaries are compared for equality
+            if (!Collections.Equals(enumIntToStringMap, that.enumIntToStringMap))
             {
                 return false;
             }
-            if (!enumStringToIntMap.Equals(that.enumStringToIntMap))
+            if (!Collections.Equals(enumStringToIntMap, that.enumStringToIntMap))
             {
                 return false;
             }
@@ -329,8 +332,11 @@ namespace Lucene.Net.Queries.Function.ValueSources
         {
             int result = base.GetHashCode();
             result = 31 * result + parser.GetHashCode();
-            result = 31 * result + enumIntToStringMap.GetHashCode();
-            result = 31 * result + enumStringToIntMap.GetHashCode();
+            // LUCENENET TODO: Make an EquatableDictionary so we can use Equatable.Wrap()
here ?
+            // LUCENENET specific: must use Collections.GetHashCode() to ensure values
+            // contained within the dictionaries are compared for equality
+            result = 31 * result + Collections.GetHashCode(enumIntToStringMap);
+            result = 31 * result + Collections.GetHashCode(enumStringToIntMap);
             return result;
         }
     }


Mime
View raw message