lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [13/16] lucene-solr:jira/solr-8593: LUCENE-6664: add getter
Date Mon, 14 Nov 2016 16:06:54 GMT
LUCENE-6664: add getter


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a86f8076
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a86f8076
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a86f8076

Branch: refs/heads/jira/solr-8593
Commit: a86f807685403537c20aa697b7c7e06bd97cbdf9
Parents: 907bed8
Author: Mike McCandless <mikemccand@apache.org>
Authored: Mon Nov 14 06:33:11 2016 -0500
Committer: Mike McCandless <mikemccand@apache.org>
Committed: Mon Nov 14 06:33:11 2016 -0500

----------------------------------------------------------------------
 .../core/src/java/org/apache/lucene/util/RollingBuffer.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a86f8076/lucene/core/src/java/org/apache/lucene/util/RollingBuffer.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/util/RollingBuffer.java b/lucene/core/src/java/org/apache/lucene/util/RollingBuffer.java
index aad95b6..88d2361 100644
--- a/lucene/core/src/java/org/apache/lucene/util/RollingBuffer.java
+++ b/lucene/core/src/java/org/apache/lucene/util/RollingBuffer.java
@@ -102,7 +102,7 @@ public abstract class RollingBuffer<T extends RollingBuffer.Resettable>
{
       nextPos++;
       count++;
     }
-    assert inBounds(pos);
+    assert inBounds(pos): "pos=" + pos + " nextPos=" + nextPos + " count=" + count;
     final int index = getIndex(pos);
     //System.out.println("  pos=" + pos + " nextPos=" + nextPos + " -> index=" + index);
     //assert buffer[index].pos == pos;
@@ -110,11 +110,16 @@ public abstract class RollingBuffer<T extends RollingBuffer.Resettable>
{
   }
 
   /** Returns the maximum position looked up, or -1 if no
-  *  position has been looked up sinc reset/init.  */
+  *   position has been looked up since reset/init.  */
   public int getMaxPos() {
     return nextPos-1;
   }
 
+  /** Returns how many active positions are in the buffer. */
+  public int getBufferSize() {
+    return count;
+  }
+
   public void freeBefore(int pos) {
     final int toFree = count - (nextPos - pos);
     assert toFree >= 0;


Mime
View raw message