lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r887872 - /lucene/java/trunk/src/java/org/apache/lucene/util/PriorityQueue.java
Date Mon, 07 Dec 2009 09:57:38 GMT
Author: mikemccand
Date: Mon Dec  7 09:57:38 2009
New Revision: 887872

URL: http://svn.apache.org/viewvc?rev=887872&view=rev
Log:
LUCENE-2119: add some more comments in PQ around the +1

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/util/PriorityQueue.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/util/PriorityQueue.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/util/PriorityQueue.java?rev=887872&r1=887871&r2=887872&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/util/PriorityQueue.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/util/PriorityQueue.java Mon Dec  7 09:57:38
2009
@@ -91,9 +91,14 @@
         // causes a confusing NegativeArraySizeException.
         // Note that very likely this will simply then hit
         // an OOME, but at least that's more indicative to
-        // caller that this values is too big:
+        // caller that this values is too big.  We don't +1
+        // in this case, but it's very unlikely in practice
+        // one will actually insert this many objects into
+        // the PQ:
         heapSize = Integer.MAX_VALUE;
       } else {
+        // NOTE: we add +1 because all access to heap is
+        // 1-based not 0-based.  heap[0] is unused.
         heapSize = maxSize + 1;
       }
     }



Mime
View raw message