mirror of https://github.com/apache/lucene.git
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:
parent
2237664f9c
commit
a53a123525
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue