lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject svn commit: r234254 - /lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java
Date Sun, 21 Aug 2005 15:45:44 GMT
Author: ehatcher
Date: Sun Aug 21 08:45:42 2005
New Revision: 234254

URL: http://svn.apache.org/viewcvs?rev=234254&view=rev
Log:
Add .equals/.hashCode to allow for comparisons of SpanOrQuerys

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java?rev=234254&r1=234253&r2=234254&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanOrQuery.java Sun Aug 21
08:45:42 2005
@@ -79,6 +79,25 @@
     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 {
     public SpanQueue(int size) {
       initialize(size);



Mime
View raw message