mirror of https://github.com/apache/lucene.git
LUCENE-6952: Make most Filter* classes abstract.
This commit is contained in:
parent
f9fbf8bc1d
commit
9393a3190c
|
@ -135,6 +135,10 @@ API Changes
|
|||
|
||||
* LUCENE-7056: Geo3D classes are in different packages now. (David Smiley)
|
||||
|
||||
* LUCENE-6952: These classes are now abstract: FilterCodecReader, FilterLeafReader,
|
||||
FilterCollector, FilterDirectory. And some Filter* classes in
|
||||
lucene-test-framework too. (David Smiley)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-6891: Use prefix coding when writing points in
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.lucene.util.Bits;
|
|||
* uses as its basic source of data, possibly transforming the data along the
|
||||
* way or providing additional functionality.
|
||||
*/
|
||||
public class FilterCodecReader extends CodecReader {
|
||||
public abstract class FilterCodecReader extends CodecReader {
|
||||
/**
|
||||
* The underlying CodecReader instance.
|
||||
*/
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.lucene.util.BytesRef;
|
|||
* overridden as well if the {@link #getLiveDocs() live docs} are not changed
|
||||
* either.
|
||||
*/
|
||||
public class FilterLeafReader extends LeafReader {
|
||||
public abstract class FilterLeafReader extends LeafReader {
|
||||
|
||||
/** Get the wrapped instance by <code>reader</code> as long as this reader is
|
||||
* an instance of {@link FilterLeafReader}. */
|
||||
|
@ -57,7 +57,7 @@ public class FilterLeafReader extends LeafReader {
|
|||
|
||||
/** Base class for filtering {@link Fields}
|
||||
* implementations. */
|
||||
public static class FilterFields extends Fields {
|
||||
public abstract static class FilterFields extends Fields {
|
||||
/** The underlying Fields instance. */
|
||||
protected final Fields in;
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class FilterLeafReader extends LeafReader {
|
|||
* these terms are going to be intersected with automata, you could consider
|
||||
* overriding {@link #intersect} for better performance.
|
||||
*/
|
||||
public static class FilterTerms extends Terms {
|
||||
public abstract static class FilterTerms extends Terms {
|
||||
/** The underlying Terms instance. */
|
||||
protected final Terms in;
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class FilterLeafReader extends LeafReader {
|
|||
}
|
||||
|
||||
/** Base class for filtering {@link TermsEnum} implementations. */
|
||||
public static class FilterTermsEnum extends TermsEnum {
|
||||
public abstract static class FilterTermsEnum extends TermsEnum {
|
||||
/** The underlying TermsEnum instance. */
|
||||
protected final TermsEnum in;
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class FilterLeafReader extends LeafReader {
|
|||
}
|
||||
|
||||
/** Base class for filtering {@link PostingsEnum} implementations. */
|
||||
public static class FilterPostingsEnum extends PostingsEnum {
|
||||
public abstract static class FilterPostingsEnum extends PostingsEnum {
|
||||
/** The underlying PostingsEnum instance. */
|
||||
protected final PostingsEnum in;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.index.LeafReaderContext;
|
|||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class FilterCollector implements Collector {
|
||||
public abstract class FilterCollector implements Collector {
|
||||
|
||||
protected final Collector in;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.IOException;
|
|||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class FilterLeafCollector implements LeafCollector {
|
||||
public abstract class FilterLeafCollector implements LeafCollector {
|
||||
|
||||
protected final LeafCollector in;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.Collection;
|
|||
* {@link Directory} or {@link BaseDirectory} rather than try to reuse
|
||||
* functionality of existing {@link Directory}s by extending this class.
|
||||
* @lucene.internal */
|
||||
public class FilterDirectory extends Directory {
|
||||
public abstract class FilterDirectory extends Directory {
|
||||
|
||||
/** Get the wrapped instance by <code>dir</code> as long as this reader is
|
||||
* an instance of {@link FilterDirectory}. */
|
||||
|
|
|
@ -196,7 +196,7 @@ public class TestFilterLeafReader extends LuceneTestCase {
|
|||
w.addDocument(new Document());
|
||||
DirectoryReader dr = w.getReader();
|
||||
LeafReader r = dr.leaves().get(0).reader();
|
||||
FilterLeafReader r2 = new FilterLeafReader(r);
|
||||
FilterLeafReader r2 = new FilterLeafReader(r) {};
|
||||
assertEquals(r, r2.getDelegate());
|
||||
assertEquals(r, FilterLeafReader.unwrap(r2));
|
||||
w.close();
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TestFilterDirectory extends BaseDirectoryTestCase {
|
|||
|
||||
@Override
|
||||
protected Directory getDirectory(Path path) throws IOException {
|
||||
return new FilterDirectory(new RAMDirectory());
|
||||
return new FilterDirectory(new RAMDirectory()) {};
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -48,7 +48,7 @@ public class TestFilterDirectory extends BaseDirectoryTestCase {
|
|||
|
||||
public void testUnwrap() throws IOException {
|
||||
Directory dir = FSDirectory.open(createTempDir());
|
||||
FilterDirectory dir2 = new FilterDirectory(dir);
|
||||
FilterDirectory dir2 = new FilterDirectory(dir) {};
|
||||
assertEquals(dir, dir2.getDelegate());
|
||||
assertEquals(dir, FilterDirectory.unwrap(dir2));
|
||||
dir2.close();
|
||||
|
|
|
@ -159,7 +159,7 @@ public class MockRandomMergePolicy extends MergePolicy {
|
|||
if (LuceneTestCase.VERBOSE) {
|
||||
System.out.println("NOTE: MockRandomMergePolicy now swaps in a SlowCodecReaderWrapper for merging reader=" + readers.get(i));
|
||||
}
|
||||
readers.set(i, SlowCodecReaderWrapper.wrap(new FilterLeafReader(readers.get(i))));
|
||||
readers.set(i, SlowCodecReaderWrapper.wrap(new FilterLeafReader(readers.get(i)) {}));
|
||||
} else if (thingToDo == 1) {
|
||||
// renumber fields
|
||||
// NOTE: currently this only "blocks" bulk merges just by
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Objects;
|
|||
* source of data, possibly transforming the data along the
|
||||
* way or providing additional functionality.
|
||||
*/
|
||||
public class FilterFileChannel extends FileChannel {
|
||||
public abstract class FilterFileChannel extends FileChannel {
|
||||
|
||||
/**
|
||||
* The underlying {@code FileChannel} instance.
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Objects;
|
|||
* source of data, possibly transforming the data along the
|
||||
* way or providing additional functionality.
|
||||
*/
|
||||
public class FilterFileStore extends FileStore {
|
||||
public abstract class FilterFileStore extends FileStore {
|
||||
|
||||
/**
|
||||
* The underlying {@code FileStore} instance.
|
||||
|
|
|
@ -131,7 +131,7 @@ public class FilterFileSystem extends FileSystem {
|
|||
|
||||
@Override
|
||||
public FileStore next() {
|
||||
return new FilterFileStore(iterator.next(), parent.getScheme());
|
||||
return new FilterFileStore(iterator.next(), parent.getScheme()) {};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,7 +48,7 @@ import java.util.concurrent.ExecutorService;
|
|||
* source of data, possibly transforming the data along the
|
||||
* way or providing additional functionality.
|
||||
*/
|
||||
public class FilterFileSystemProvider extends FileSystemProvider {
|
||||
public abstract class FilterFileSystemProvider extends FileSystemProvider {
|
||||
|
||||
/**
|
||||
* The underlying {@code FileSystemProvider}.
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.Objects;
|
|||
* that just overrides {@code close} will not force bytes to be
|
||||
* written one-at-a-time.
|
||||
*/
|
||||
public class FilterOutputStream2 extends OutputStream {
|
||||
public abstract class FilterOutputStream2 extends OutputStream {
|
||||
|
||||
/**
|
||||
* The underlying {@code OutputStream} instance.
|
||||
|
|
Loading…
Reference in New Issue