Lines Matching defs:array

75      * The implementation uses an array-based binary heap, with public
91 * Default array capacity.
96 * The maximum size of array to allocate.
97 * Some VMs reserve some header words in an array.
99 * OutOfMemoryError: Requested array size exceeds VM limit
241 * Tries to grow array to accommodate at least one more element
246 * @param array the heap array
247 * @param oldCap the length of the array
249 private void tryGrow(Object[] array, int oldCap) {
265 if (newCap > oldCap && queue == array)
274 if (newArray != null && queue == array) {
276 System.arraycopy(array, 0, newArray, 0, oldCap);
288 Object[] array = queue;
289 E result = (E) array[0];
290 E x = (E) array[n];
291 array[n] = null;
294 siftDownComparable(0, x, array, n);
296 siftDownUsingComparator(0, x, array, n, cmp);
315 * @param array the heap array
317 private static <T> void siftUpComparable(int k, T x, Object[] array) {
321 Object e = array[parent];
324 array[k] = e;
327 array[k] = key;
330 private static <T> void siftUpUsingComparator(int k, T x, Object[] array,
334 Object e = array[parent];
337 array[k] = e;
340 array[k] = x;
350 * @param array the heap array
353 private static <T> void siftDownComparable(int k, T x, Object[] array,
360 Object c = array[child];
363 ((Comparable<? super T>) c).compareTo((T) array[right]) > 0)
364 c = array[child = right];
367 array[k] = c;
370 array[k] = key;
374 private static <T> void siftDownUsingComparator(int k, T x, Object[] array,
381 Object c = array[child];
383 if (right < n && cmp.compare((T) c, (T) array[right]) > 0)
384 c = array[child = right];
387 array[k] = c;
390 array[k] = x;
399 Object[] array = queue;
405 siftDownComparable(i, (E) array[i], array, n);
409 siftDownUsingComparator(i, (E) array[i], array, n, cmp);
444 Object[] array;
445 while ((n = size) >= (cap = (array = queue).length))
446 tryGrow(array, cap);
450 siftUpComparable(n, e, array);
452 siftUpUsingComparator(n, e, array, cmp);
575 Object[] array = queue;
578 if (o.equals(array[i]))
588 Object[] array = queue;
591 array[i] = null;
593 E moved = (E) array[n];
594 array[n] = null;
597 siftDownComparable(i, moved, array, n);
599 siftDownUsingComparator(i, moved, array, n, cmp);
600 if (array[i] == moved) {
602 siftUpComparable(i, moved, array);
604 siftUpUsingComparator(i, moved, array, cmp);
642 Object[] array = queue;
644 if (o == array[i]) {
673 * Returns an array containing all of the elements in this queue.
674 * The returned array elements are in no particular order.
676 * <p>The returned array will be "safe" in that no references to it are
678 * a new array). The caller is thus free to modify the returned array.
680 * <p>This method acts as bridge between array-based and collection-based
683 * @return an array containing all of the elements in this queue
761 Object[] array = queue;
765 array[i] = null;
772 * Returns an array containing all of the elements in this queue; the
773 * runtime type of the returned array is that of the specified array.
774 * The returned array elements are in no particular order.
775 * If the queue fits in the specified array, it is returned therein.
776 * Otherwise, a new array is allocated with the runtime type of the
777 * specified array and the size of this queue.
779 * <p>If this queue fits in the specified array with room to spare
780 * (i.e., the array has more elements than this queue), the element in
781 * the array immediately following the end of the queue is set to
785 * array-based and collection-based APIs. Further, this method allows
786 * precise control over the runtime type of the output array, and may,
791 * allocated array of {@code String}:
798 * @param a the array into which the elements of the queue are to
799 * be stored, if it is big enough; otherwise, a new array of the
801 * @return an array containing all of the elements in this queue
802 * @throws ArrayStoreException if the runtime type of the specified array
805 * @throws NullPointerException if the specified array is null
813 // Make a new array of a's runtime type, but my contents:
842 * Snapshot iterator that works off copy of underlying q array.
845 final Object[] array; // Array of all elements
849 Itr(Object[] array) {
851 this.array = array;
855 return cursor < array.length;
859 if (cursor >= array.length)
862 return (E)array[cursor++];
868 removeEQ(array[lastRet]);