lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject svn commit: r178059 - /lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanNearQuery.java
Date Tue, 24 May 2005 01:35:16 GMT
Author: ehatcher
Date: Mon May 23 18:35:13 2005
New Revision: 178059

URL: http://svn.apache.org/viewcvs?rev=178059&view=rev
Log:
implement .equals/.hashCode

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

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanNearQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanNearQuery.java?rev=178059&r1=178058&r2=178059&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanNearQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/spans/SpanNearQuery.java Mon May 23
18:35:13 2005
@@ -110,4 +110,27 @@
     return new NearSpans(this, reader);
   }
 
+  /** Returns true iff <code>o</code> is equal to this. */
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    final SpanNearQuery spanNearQuery = (SpanNearQuery) o;
+
+    if (inOrder != spanNearQuery.inOrder) return false;
+    if (slop != spanNearQuery.slop) return false;
+    if (!clauses.equals(spanNearQuery.clauses)) return false;
+    if (!field.equals(spanNearQuery.field)) return false;
+
+    return true;
+  }
+  
+  public int hashCode() {
+    int result;
+    result = clauses.hashCode();
+    result = 29 * result + slop;
+    result = 29 * result + (inOrder ? 1 : 0);
+    result = 29 * result + field.hashCode();
+    return result;
+  }
 }



Mime
View raw message