lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r358693 - /lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java
Date Fri, 23 Dec 2005 03:37:52 GMT
Author: yonik
Date: Thu Dec 22 19:37:50 2005
New Revision: 358693

URL: http://svn.apache.org/viewcvs?rev=358693&view=rev
Log:
improve hashcodes: LUCENE-460

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java?rev=358693&r1=358692&r2=358693&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/RangeQuery.java Thu Dec 22 19:37:50
2005
@@ -155,9 +155,13 @@
 
     /** Returns a hash code value for this object.*/
     public int hashCode() {
-        return Float.floatToIntBits(getBoost()) ^
-            (lowerTerm != null ? lowerTerm.hashCode() : 0) ^
-            (upperTerm != null ? upperTerm.hashCode() : 0) ^
-            (this.inclusive ? 1 : 0);
+      int h = Float.floatToIntBits(getBoost());
+      h ^= lowerTerm != null ? lowerTerm.hashCode() : 0;
+      // reversible mix to make lower and upper position dependent and
+      // to prevent them from cancelling out.
+      h ^= (h << 25) | (h >>> 8);
+      h ^= upperTerm != null ? upperTerm.hashCode() : 0;
+      h ^= this.inclusive ? 0x2742E74A : 0;
+      return h;
     }
 }



Mime
View raw message