Apache Lucene open-source search software
LUCENE-452 - add .equals/.hashCode
Erik Hatchera53a1235253b
diff --git a/src/java/org/apache/lucene/search/PrefixQuery.java b/src/java/org/apache/lucene/search/PrefixQuery.javaindex 4c2d0e5be0e..45188a01f1d 100644--- a/src/java/org/apache/lucene/search/PrefixQuery.java+++ b/src/java/org/apache/lucene/search/PrefixQuery.java@@ -76,4 +76,17 @@ public class PrefixQuery extends Query {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();+ }}