You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by eh...@apache.org on 2005/10/12 14:56:06 UTC

svn commit: r314869 - /lucene/java/trunk/src/java/org/apache/lucene/search/PrefixQuery.java

Author: ehatcher
Date: Wed Oct 12 05:56:04 2005
New Revision: 314869

URL: http://svn.apache.org/viewcvs?rev=314869&view=rev
Log:
LUCENE-452 - add .equals/.hashCode

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

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/PrefixQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/PrefixQuery.java?rev=314869&r1=314868&r2=314869&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/PrefixQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/PrefixQuery.java Wed Oct 12 05:56:04 2005
@@ -76,4 +76,17 @@
     return buffer.toString();
   }
 
+  /** Returns true iff <code>o</code> is equal to this. */
+  public boolean equals(Object o) {
+    if (!(o instanceof PrefixQuery))
+      return false;
+    PrefixQuery other = (PrefixQuery)o;
+    return (this.getBoost() == other.getBoost())
+      && this.prefix.equals(other.prefix);
+  }
+
+  /** Returns a hash code value for this object.*/
+  public int hashCode() {
+    return Float.floatToIntBits(getBoost()) ^ prefix.hashCode();
+  }
 }