LUCENE-3902: fix oal.util missing public javadocs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1303860 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-03-22 16:03:33 +00:00
parent aa8cfa0d12
commit 55515820f9
6 changed files with 31 additions and 13 deletions

View File

@ -48,6 +48,8 @@ public final class ByteBlockPool {
public final static int BYTE_BLOCK_SIZE = 1 << BYTE_BLOCK_SHIFT; public final static int BYTE_BLOCK_SIZE = 1 << BYTE_BLOCK_SHIFT;
public final static int BYTE_BLOCK_MASK = BYTE_BLOCK_SIZE - 1; public final static int BYTE_BLOCK_MASK = BYTE_BLOCK_SIZE - 1;
/** Abstract class for allocating and freeing byte
* blocks. */
public abstract static class Allocator { public abstract static class Allocator {
protected final int blockSize; protected final int blockSize;
@ -67,6 +69,7 @@ public final class ByteBlockPool {
} }
} }
/** A simple {@link Allocator} that never recycles. */
public static final class DirectAllocator extends Allocator { public static final class DirectAllocator extends Allocator {
public DirectAllocator() { public DirectAllocator() {
@ -80,9 +83,10 @@ public final class ByteBlockPool {
@Override @Override
public void recycleByteBlocks(byte[][] blocks, int start, int end) { public void recycleByteBlocks(byte[][] blocks, int start, int end) {
} }
} }
/** A simple {@link Allocator} that never recycles, but
* tracks how much total RAM is in use. */
public static class DirectTrackingAllocator extends Allocator { public static class DirectTrackingAllocator extends Allocator {
private final Counter bytesUsed; private final Counter bytesUsed;
@ -99,6 +103,7 @@ public final class ByteBlockPool {
bytesUsed.addAndGet(blockSize); bytesUsed.addAndGet(blockSize);
return new byte[blockSize]; return new byte[blockSize];
} }
@Override @Override
public void recycleByteBlocks(byte[][] blocks, int start, int end) { public void recycleByteBlocks(byte[][] blocks, int start, int end) {
bytesUsed.addAndGet(-((end-start)* blockSize)); bytesUsed.addAndGet(-((end-start)* blockSize));
@ -106,7 +111,6 @@ public final class ByteBlockPool {
blocks[i] = null; blocks[i] = null;
} }
} }
}; };

View File

@ -500,6 +500,7 @@ public final class BytesRefHash {
} }
} }
/** Manages allocation of the per-term addresses. */
public abstract static class BytesStartArray { public abstract static class BytesStartArray {
/** /**
* Initializes the BytesStartArray. This call will allocate memory * Initializes the BytesStartArray. This call will allocate memory
@ -533,9 +534,9 @@ public final class BytesRefHash {
public abstract Counter bytesUsed(); public abstract Counter bytesUsed();
} }
/** /** A simple {@link BytesStartArray} that tracks all
* A direct {@link BytesStartArray} that tracks all memory allocation using an {@link Counter} instance. * memory allocation using a shared {@link Counter}
*/ * instance. */
public static class TrackingDirectBytesStartArray extends BytesStartArray { public static class TrackingDirectBytesStartArray extends BytesStartArray {
protected final int initSize; protected final int initSize;
private int[] bytesStart; private int[] bytesStart;
@ -577,7 +578,14 @@ public final class BytesRefHash {
} }
} }
/** A simple {@link BytesStartArray} that tracks
* memory allocation using a private {@link AtomicLong}
* instance. */
public static class DirectBytesStartArray extends BytesStartArray { public static class DirectBytesStartArray extends BytesStartArray {
// TODO: can't we just merge this w/
// TrackingDirectBytesStartArray...? Just add a ctor
// that makes a private bytesUsed?
protected final int initSize; protected final int initSize;
private int[] bytesStart; private int[] bytesStart;
private final Counter bytesUsed; private final Counter bytesUsed;
@ -587,7 +595,6 @@ public final class BytesRefHash {
this.initSize = initSize; this.initSize = initSize;
} }
@Override @Override
public int[] clear() { public int[] clear() {
return bytesStart = null; return bytesStart = null;

View File

@ -21,11 +21,11 @@ import java.io.IOException;
import java.util.Comparator; import java.util.Comparator;
/** /**
* A simple iterator interface for {@link BytesRef} iteration * A simple iterator interface for {@link BytesRef} iteration.
*
*/ */
public interface BytesRefIterator { public interface BytesRefIterator {
/** Singleton BytesRefIterator that iterates over 0 BytesRefs. */
public static final BytesRefIterator EMPTY_ITERATOR = new EmptyBytesRefIterator(); public static final BytesRefIterator EMPTY_ITERATOR = new EmptyBytesRefIterator();
/** /**
@ -48,7 +48,9 @@ public interface BytesRefIterator {
* single instance & reuse it. * single instance & reuse it.
*/ */
public Comparator<BytesRef> getComparator(); public Comparator<BytesRef> getComparator();
// TODO: private?
/** Iterates over 0 BytesRefs. */
public final static class EmptyBytesRefIterator implements BytesRefIterator { public final static class EmptyBytesRefIterator implements BytesRefIterator {
@Override @Override
@ -59,7 +61,5 @@ public interface BytesRefIterator {
public Comparator<BytesRef> getComparator() { public Comparator<BytesRef> getComparator() {
return null; return null;
} }
} }
} }

View File

@ -44,6 +44,7 @@ import java.util.Map;
final public class DoubleBarrelLRUCache<K extends DoubleBarrelLRUCache.CloneableKey,V> { final public class DoubleBarrelLRUCache<K extends DoubleBarrelLRUCache.CloneableKey,V> {
/** Object providing clone(); the key class must subclass this. */
public static abstract class CloneableKey { public static abstract class CloneableKey {
@Override @Override
abstract public Object clone(); abstract public Object clone();

View File

@ -19,7 +19,9 @@ package org.apache.lucene.util;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;
/** OpenBitSet with added methods to bulk-update the bits
* from a {@link DocIdSetIterator}. */
public class OpenBitSetDISI extends OpenBitSet { public class OpenBitSetDISI extends OpenBitSet {
/** Construct an OpenBitSetDISI with its bits set /** Construct an OpenBitSetDISI with its bits set

View File

@ -45,6 +45,10 @@ public final class PagedBytes {
private static final byte[] EMPTY_BYTES = new byte[0]; private static final byte[] EMPTY_BYTES = new byte[0];
/** Provides methods to read BytesRefs from a frozen
* PagedBytes.
*
* @see #freeze */
public final static class Reader { public final static class Reader {
private final byte[][] blocks; private final byte[][] blocks;
private final int[] blockEnds; private final int[] blockEnds;