Add .equals/.hashCode to allow for comparisons of SpanOrQuerys

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@234254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2005-08-21 15:45:42 +00:00
parent 9b3aa1aec0
commit 718380d17e
1 changed files with 19 additions and 0 deletions

View File

@ -79,6 +79,25 @@ public class SpanOrQuery extends SpanQuery {
return buffer.toString(); return buffer.toString();
} }
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final SpanOrQuery that = (SpanOrQuery) o;
if (!clauses.equals(that.clauses)) return false;
if (!field.equals(that.field)) return false;
return true;
}
public int hashCode() {
int result;
result = clauses.hashCode();
result = 29 * result + field.hashCode();
return result;
}
private class SpanQueue extends PriorityQueue { private class SpanQueue extends PriorityQueue {
public SpanQueue(int size) { public SpanQueue(int size) {
initialize(size); initialize(size);