From 21a6450e8330c9544c09e32b9fdf5c2732542f58 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Wed, 4 Jul 2012 00:43:04 +0000 Subject: [PATCH] make some fields private/final; add whitespace git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/pforcodec_3892@1357026 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/lucene/codecs/pfor/ForFactory.java | 23 ++++++++++++------- .../lucene/codecs/pfor/PForFactory.java | 23 ++++++++++++------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java b/lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java index 11eb65009bb..fcdaea29cd8 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/pfor/ForFactory.java @@ -67,21 +67,27 @@ public final class ForFactory extends IntStreamFactory { // wrap input and output with buffer support private class ForIndexInput extends FixedIntBlockIndexInput { + ForIndexInput(final IndexInput in) throws IOException { super(in); } + class ForBlockReader implements FixedIntBlockIndexInput.BlockReader { - byte[] encoded; - int[] buffer; - IndexInput in; - IntBuffer encodedBuffer; + private final byte[] encoded; + private final int[] buffer; + private final IndexInput in; + private final IntBuffer encodedBuffer; + ForBlockReader(final IndexInput in, final int[] buffer) { this.encoded = new byte[blockSize*8+4]; - this.in=in; - this.buffer=buffer; - this.encodedBuffer=ByteBuffer.wrap(encoded).asIntBuffer(); + this.in = in; + this.buffer = buffer; + this.encodedBuffer = ByteBuffer.wrap(encoded).asIntBuffer(); } - public void seek(long pos) {} + + public void seek(long pos) { + } + // TODO: implement public void skipBlock() {} ? public void readBlock() throws IOException { final int numBytes = in.readInt(); @@ -90,6 +96,7 @@ public final class ForFactory extends IntStreamFactory { ForUtil.decompress(encodedBuffer,buffer); } } + @Override protected BlockReader getBlockReader(final IndexInput in, final int[] buffer) throws IOException { return new ForBlockReader(in,buffer); diff --git a/lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java b/lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java index b6c990662ce..9ba2e71463d 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/pfor/PForFactory.java @@ -67,21 +67,27 @@ public final class PForFactory extends IntStreamFactory { // wrap input and output with buffer support private class PForIndexInput extends FixedIntBlockIndexInput { + PForIndexInput(final IndexInput in) throws IOException { super(in); } + class PForBlockReader implements FixedIntBlockIndexInput.BlockReader { - byte[] encoded; - int[] buffer; - IndexInput in; - IntBuffer encodedBuffer; + private final byte[] encoded; + private final int[] buffer; + private final IndexInput in; + private final IntBuffer encodedBuffer; + PForBlockReader(final IndexInput in, final int[] buffer) { this.encoded = new byte[blockSize*8+4]; - this.in=in; - this.buffer=buffer; - this.encodedBuffer=ByteBuffer.wrap(encoded).asIntBuffer(); + this.in = in; + this.buffer = buffer; + this.encodedBuffer = ByteBuffer.wrap(encoded).asIntBuffer(); } - public void seek(long pos) {} + + public void seek(long pos) { + } + // TODO: implement public void skipBlock() {} ? public void readBlock() throws IOException { final int numBytes = in.readInt(); @@ -90,6 +96,7 @@ public final class PForFactory extends IntStreamFactory { PForUtil.decompress(encodedBuffer,buffer); } } + @Override protected BlockReader getBlockReader(final IndexInput in, final int[] buffer) throws IOException { return new PForBlockReader(in,buffer);