LUCENE-2119: add some more comments in PQ around the +1

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@887872 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-12-07 09:57:38 +00:00
parent 470c89a2b2
commit d2bf223b21
1 changed files with 6 additions and 1 deletions

View File

@ -91,9 +91,14 @@ public abstract class PriorityQueue<T> {
// 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;
}
}