View Javadoc

1   // BSD License (http://www.galagosearch.org/license)
2   package org.galagosearch.core.retrieval.structured;
3   
4   import java.io.IOException;
5   import org.galagosearch.core.util.ExtentArray;
6   
7   /***
8    * This is base interface for all inverted lists that return count information.
9    * See the CountIterator class for documentation on most of these methods.
10   * 
11   * @author trevor
12   */
13  public abstract class ExtentIterator extends CountIterator {
14      public abstract void nextDocument() throws IOException;
15      public abstract int document();
16      public abstract int count();
17      public abstract ExtentArray extents();
18      public abstract boolean isDone();
19      public abstract void reset() throws IOException;
20  
21      @Override
22      public boolean skipToDocument(int document) throws IOException {
23          if (isDone()) {
24              return false;
25          }
26          while (!isDone() && document() < document) {
27              nextDocument();
28          }
29          return !isDone() && document == document();
30      }
31  }