You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/03/22 16:52:51 UTC
svn commit: r1303854 - in
/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util:
ByteBlockPool.java BytesRefHash.java BytesRefIterator.java
DoubleBarrelLRUCache.java OpenBitSetDISI.java PagedBytes.java
UnicodeUtil.java
Author: mikemccand
Date: Thu Mar 22 15:52:51 2012
New Revision: 1303854
URL: http://svn.apache.org/viewvc?rev=1303854&view=rev
Log:
LUCENE-3902: fix oal.util missing public javadocs
Modified:
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/ByteBlockPool.java
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/OpenBitSetDISI.java
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java
lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/ByteBlockPool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/ByteBlockPool.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/ByteBlockPool.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/ByteBlockPool.java Thu Mar 22 15:52:51 2012
@@ -49,6 +49,8 @@ public final class ByteBlockPool {
public final static int BYTE_BLOCK_SIZE = 1 << BYTE_BLOCK_SHIFT;
public final static int BYTE_BLOCK_MASK = BYTE_BLOCK_SIZE - 1;
+ /** Abstract class for allocating and freeing byte
+ * blocks. */
public abstract static class Allocator {
protected final int blockSize;
@@ -68,6 +70,7 @@ public final class ByteBlockPool {
}
}
+ /** A simple {@link Allocator} that never recycles. */
public static final class DirectAllocator extends Allocator {
public DirectAllocator() {
@@ -81,9 +84,10 @@ public final class ByteBlockPool {
@Override
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 {
private final AtomicLong bytesUsed;
@@ -100,6 +104,7 @@ public final class ByteBlockPool {
bytesUsed.addAndGet(blockSize);
return new byte[blockSize];
}
+
@Override
public void recycleByteBlocks(byte[][] blocks, int start, int end) {
bytesUsed.addAndGet(-((end-start)* blockSize));
@@ -107,7 +112,6 @@ public final class ByteBlockPool {
blocks[i] = null;
}
}
-
};
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefHash.java Thu Mar 22 15:52:51 2012
@@ -500,6 +500,7 @@ public final class BytesRefHash {
}
}
+ /** Manages allocation of the per-term addresses. */
public abstract static class BytesStartArray {
/**
* Initializes the BytesStartArray. This call will allocate memory
@@ -533,9 +534,9 @@ public final class BytesRefHash {
public abstract AtomicLong bytesUsed();
}
- /**
- * A direct {@link BytesStartArray} that tracks all memory allocation using an {@link AtomicLong} instance.
- */
+ /** A simple {@link BytesStartArray} that tracks all
+ * memory allocation using a shared {@link AtomicLong}
+ * instance. */
public static class TrackingDirectBytesStartArray extends BytesStartArray {
protected final int initSize;
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 {
+ // TODO: can't we just merge this w/
+ // TrackingDirectBytesStartArray...? Just add a ctor
+ // that makes a private bytesUsed?
+
protected final int initSize;
private int[] bytesStart;
private final AtomicLong bytesUsed;
@@ -587,7 +595,6 @@ public final class BytesRefHash {
this.initSize = initSize;
}
-
@Override
public int[] clear() {
return bytesStart = null;
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/BytesRefIterator.java Thu Mar 22 15:52:51 2012
@@ -21,11 +21,11 @@ import java.io.IOException;
import java.util.Comparator;
/**
- * A simple iterator interface for {@link BytesRef} iteration
- *
+ * A simple iterator interface for {@link BytesRef} iteration.
*/
public interface BytesRefIterator {
-
+
+ /** Singleton BytesRefIterator that iterates over 0 BytesRefs. */
public static final BytesRefIterator EMPTY_ITERATOR = new EmptyBytesRefIterator();
/**
@@ -48,7 +48,9 @@ public interface BytesRefIterator {
* single instance & reuse it.
*/
public Comparator<BytesRef> getComparator();
-
+
+ // TODO: private?
+ /** Iterates over 0 BytesRefs. */
public final static class EmptyBytesRefIterator implements BytesRefIterator {
//@Override - not until Java 6
@@ -59,7 +61,5 @@ public interface BytesRefIterator {
public Comparator<BytesRef> getComparator() {
return null;
}
-
}
-
}
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/DoubleBarrelLRUCache.java Thu Mar 22 15:52:51 2012
@@ -44,6 +44,7 @@ import java.util.Map;
final public class DoubleBarrelLRUCache<K extends DoubleBarrelLRUCache.CloneableKey,V> {
+ /** Object providing clone(); the key class must subclass this. */
public static abstract class CloneableKey {
@Override
abstract public Object clone();
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/OpenBitSetDISI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/OpenBitSetDISI.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/OpenBitSetDISI.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/OpenBitSetDISI.java Thu Mar 22 15:52:51 2012
@@ -19,7 +19,9 @@ package org.apache.lucene.util;
import java.io.IOException;
import org.apache.lucene.search.DocIdSetIterator;
-
+
+/** OpenBitSet with added methods to bulk-update the bits
+ * from a {@link DocIdSetIterator}. */
public class OpenBitSetDISI extends OpenBitSet {
/** Construct an OpenBitSetDISI with its bits set
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/PagedBytes.java Thu Mar 22 15:52:51 2012
@@ -45,6 +45,10 @@ public final class PagedBytes {
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 {
private final byte[][] blocks;
private final int[] blockEnds;
Modified: lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java?rev=1303854&r1=1303853&r2=1303854&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java (original)
+++ lucene/dev/branches/branch_3x/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java Thu Mar 22 15:52:51 2012
@@ -114,6 +114,8 @@ public final class UnicodeUtil {
(UNI_SUR_HIGH_START << HALF_SHIFT) - UNI_SUR_LOW_START;
/**
+ * Holds decoded UTF8 code units.
+ *
* @lucene.internal
*/
public static final class UTF8Result {
@@ -129,6 +131,8 @@ public final class UnicodeUtil {
}
/**
+ * Holds decoded UTF16 code units.
+ *
* @lucene.internal
*/
public static final class UTF16Result {