lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject svn commit: r1375267 - /incubator/lucene.net/trunk/src/contrib/Spatial/Util/TermsFilter.cs
Date Mon, 20 Aug 2012 21:56:44 GMT
Author: synhershko
Date: Mon Aug 20 21:56:44 2012
New Revision: 1375267

URL: http://svn.apache.org/viewvc?rev=1375267&view=rev
Log:
Fixing TermsFilter cachability

Modified:
    incubator/lucene.net/trunk/src/contrib/Spatial/Util/TermsFilter.cs

Modified: incubator/lucene.net/trunk/src/contrib/Spatial/Util/TermsFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/contrib/Spatial/Util/TermsFilter.cs?rev=1375267&r1=1375266&r2=1375267&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/contrib/Spatial/Util/TermsFilter.cs (original)
+++ incubator/lucene.net/trunk/src/contrib/Spatial/Util/TermsFilter.cs Mon Aug 20 21:56:44
2012
@@ -80,5 +80,38 @@ namespace Lucene.Net.Spatial.Util
 			}
 			return result;
 		}
+
+		public override bool Equals(object obj)
+		{
+			if (this == obj)
+				return true;
+
+			if ((obj == null) || (obj.GetType() != this.GetType()))
+				return false;
+
+			var test = (TermsFilter)obj;
+			if (terms == test.terms)
+				return true;
+			if (terms == null || terms.Count != test.terms.Count)
+				return false;
+
+			var e1 = terms.GetEnumerator();
+			var e2 = test.terms.GetEnumerator();
+			while (e1.MoveNext() && e2.MoveNext())
+			{
+				if (!e1.Current.Equals(e2.Current)) return false;
+			}
+			return true;
+		}
+
+		public override int GetHashCode()
+		{
+			int hash = 9;
+			foreach (Term term in terms)
+			{
+				hash = 31 * hash + term.GetHashCode();
+			}
+			return hash;
+		}
 	}
 }



Mime
View raw message