mirror of https://github.com/apache/lucene.git
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:
parent
9b4b499548
commit
9513c471f6
|
@ -284,4 +284,24 @@ public class MultiPhraseQuery extends Query {
|
||||||
|
|
||||||
return buffer.toString();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue