lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r881308 - /lucene/solr/trunk/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
Date Tue, 17 Nov 2009 14:47:25 GMT
Author: gsingers
Date: Tue Nov 17 14:47:25 2009
New Revision: 881308

URL: http://svn.apache.org/viewvc?rev=881308&view=rev
Log:
SOLR-1302: clean up hashcode.

Modified:
    lucene/solr/trunk/src/java/org/apache/solr/search/function/distance/HaversineFunction.java

Modified: lucene/solr/trunk/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/search/function/distance/HaversineFunction.java?rev=881308&r1=881307&r2=881308&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
(original)
+++ lucene/solr/trunk/src/java/org/apache/solr/search/function/distance/HaversineFunction.java
Tue Nov 17 14:47:25 2009
@@ -133,12 +133,21 @@
             && x1.equals(other.x1) &&
             y1.equals(other.y1) &&
             x2.equals(other.x2) &&
-            y2.equals(other.y2);
+            y2.equals(other.y2) && radius == other.radius;
   }
 
+  @Override
   public int hashCode() {
-
-    return x1.hashCode() + x2.hashCode() + y1.hashCode() + y2.hashCode() + name().hashCode();
+    int result;
+    long temp;
+    result = x1.hashCode();
+    result = 31 * result + y1.hashCode();
+    result = 31 * result + x2.hashCode();
+    result = 31 * result + y2.hashCode();
+    result = 31 * result + name().hashCode();
+    temp = radius != +0.0d ? Double.doubleToLongBits(radius) : 0L;
+    result = 31 * result + (int) (temp ^ (temp >>> 32));
+    return result;
   }
 
   public String description() {



Mime
View raw message