2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.apache.lucene.index;
20 import java.io.IOException;
22 /** Base class for enumerating all but deleted docs.
24 * <p>NOTE: this class is meant only to be used internally
25 * by Lucene; it's only public so it can be shared across
26 * packages. This means the API is freely subject to
27 * change, and, the class could be removed entirely, in any
28 * Lucene release. Use directly at your own risk! */
29 public abstract class AbstractAllTermDocs implements TermDocs {
32 protected int doc = -1;
34 protected AbstractAllTermDocs(int maxDoc) {
38 public void seek(Term term) throws IOException {
42 throw new UnsupportedOperationException();
46 public void seek(TermEnum termEnum) throws IOException {
47 throw new UnsupportedOperationException();
58 public boolean next() throws IOException {
62 public int read(int[] docs, int[] freqs) throws IOException {
63 final int length = docs.length;
65 while (i < length && doc < maxDoc) {
66 if (!isDeleted(doc)) {
76 public boolean skipTo(int target) throws IOException {
78 while (doc < maxDoc) {
79 if (!isDeleted(doc)) {
87 public void close() throws IOException {
90 public abstract boolean isDeleted(int doc);