| Index: lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java |
| =================================================================== |
| --- lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java (revision 1634505) |
| +++ lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java (working copy) |
| @@ -45,12 +45,6 @@ |
| public int docID() { |
| return exhausted ? NO_MORE_DOCS : -1; |
| } |
| - @Override |
| - public int nextDoc() { |
| - assert !exhausted; |
| - exhausted = true; |
| - return NO_MORE_DOCS; |
| - } |
| |
| @Override |
| public long cost() { |
| @@ -86,10 +80,15 @@ |
| * |
| * <b>NOTE:</b> after the iterator has exhausted you should not call this |
| * method, as it may result in unpredicted behavior. |
| - * |
| + * |
| + * The default implementation returns |
| + * {@link #advance(int) advance(docID() + 1)}. |
| + * |
| * @since 2.9 |
| */ |
| - public abstract int nextDoc() throws IOException; |
| + public int nextDoc() throws IOException { |
| + return advance(docID() + 1); |
| + } |
| |
| /** |
| * Advances to the first beyond the current whose document number is greater |
| Index: lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java |
| =================================================================== |
| --- lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java (revision 1634505) |
| +++ lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java (working copy) |
| @@ -88,17 +88,6 @@ |
| } |
| |
| @Override |
| - public int nextDoc() { |
| - do { |
| - doc++; |
| - if (doc >= maxDoc) { |
| - return doc = NO_MORE_DOCS; |
| - } |
| - } while (!matchDoc(doc)); |
| - return doc; |
| - } |
| - |
| - @Override |
| public int advance(int target) { |
| for(doc=target; doc<maxDoc; doc++) { |
| if (matchDoc(doc)) { |
| @@ -133,11 +122,6 @@ |
| } |
| |
| @Override |
| - public int nextDoc() { |
| - return advance(doc + 1); |
| - } |
| - |
| - @Override |
| public int advance(int target) { |
| for(doc=target; doc<maxDoc; doc++) { |
| if (acceptDocs.get(doc) && matchDoc(doc)) { |
| Index: lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java |
| =================================================================== |
| --- lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java (revision 1634505) |
| +++ lucene/core/src/java/org/apache/lucene/search/SloppyPhraseScorer.java (working copy) |
| @@ -562,11 +562,6 @@ |
| public int docID() { |
| return max.doc; |
| } |
| - |
| - @Override |
| - public int nextDoc() throws IOException { |
| - return advance(max.doc + 1); // advance to the next doc after #docID() |
| - } |
| |
| @Override |
| public float score() { |
| Index: lucene/core/src/java/org/apache/lucene/util/BitSetIterator.java |
| =================================================================== |
| --- lucene/core/src/java/org/apache/lucene/util/BitSetIterator.java (revision 1634505) |
| +++ lucene/core/src/java/org/apache/lucene/util/BitSetIterator.java (working copy) |
| @@ -65,11 +65,6 @@ |
| } |
| |
| @Override |
| - public int nextDoc() { |
| - return advance(doc + 1); |
| - } |
| - |
| - @Override |
| public int advance(int target) { |
| if (target >= length) { |
| return doc = NO_MORE_DOCS; |
| Index: lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java |
| =================================================================== |
| --- lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java (revision 1634505) |
| +++ lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java (working copy) |
| @@ -81,11 +81,6 @@ |
| int nextSkippedDoc = -1; |
| |
| @Override |
| - public int nextDoc() throws IOException { |
| - return advance(doc + 1); |
| - } |
| - |
| - @Override |
| public int advance(int target) throws IOException { |
| doc = target; |
| if (doc > nextSkippedDoc) { |