LUCENE-452 - add .equals/.hashCode

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@314869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2005-10-12 12:56:04 +00:00
parent 2237664f9c
commit a53a123525
1 changed files with 13 additions and 0 deletions

View File

@ -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();
}
}