improve hashcodes: LUCENE-460

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@358696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2005-12-23 04:03:06 +00:00
parent 9b4b499548
commit 9513c471f6
1 changed files with 20 additions and 0 deletions

View File

@ -284,4 +284,24 @@ public class MultiPhraseQuery extends Query {
return buffer.toString();
}
/** Returns true if <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof MultiPhraseQuery)) return false;
MultiPhraseQuery other = (MultiPhraseQuery)o;
return this.getBoost() == other.getBoost()
&& this.slop == other.slop
&& this.termArrays.equals(other.termArrays)
&& this.positions.equals(other.positions);
}
/** Returns a hash code value for this object.*/
public int hashCode() {
return Float.floatToIntBits(getBoost())
^ slop
^ termArrays.hashCode()
^ positions.hashCode()
^ 0x4AC65113;
}
}