jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r506908 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Date Tue, 13 Feb 2007 08:35:29 GMT
Author: mreutegg
Date: Tue Feb 13 00:35:28 2007
New Revision: 506908

URL: http://svn.apache.org/viewvc?view=rev&rev=506908
Log:
Implement proper equals() and hashCode() on CombinedIndexReader

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?view=diff&rev=506908&r1=506907&r2=506908
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Tue Feb 13 00:35:28 2007
@@ -54,6 +54,7 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.Arrays;
 
 /**
  * Implements a {@link org.apache.jackrabbit.core.query.QueryHandler} using
@@ -551,7 +552,7 @@
         /**
          * The sub readers.
          */
-        private CachingMultiReader[] subReaders;
+        final private CachingMultiReader[] subReaders;
 
         /**
          * Doc number starts for each sub reader
@@ -609,6 +610,21 @@
             return hi;
         }
 
+        public boolean equals(Object obj) {
+            if (obj instanceof CombinedIndexReader) {
+                CombinedIndexReader other = (CombinedIndexReader) obj;
+                return Arrays.equals(subReaders, other.subReaders);
+            }
+            return false;
+        }
+
+        public int hashCode() {
+            int hash = 0;
+            for (int i = 0; i < subReaders.length; i++) {
+                hash = 31 * hash + subReaders[i].hashCode();
+            }
+            return hash;
+        }
     }
 
     //--------------------------< properties >----------------------------------



Mime
View raw message