Lines Matching defs:queue

28  * An unbounded {@linkplain BlockingQueue blocking queue} that uses
30 * blocking retrieval operations. While this queue is logically
33 * {@code null} elements. A priority queue relying on {@linkplain
77 * @param <E> the type of elements held in this queue
114 * Priority queue represented as a balanced binary heap: the two
115 * children of queue[n] are queue[2*n+1] and queue[2*(n+1)]. The
116 * priority queue is ordered by comparator, or by the elements'
119 * lowest value is in queue[0], assuming the queue is nonempty.
121 private transient Object[] queue;
124 * The number of elements in the priority queue.
129 * The comparator, or null if priority queue uses elements'
170 * @param initialCapacity the initial capacity for this priority queue
183 * @param initialCapacity the initial capacity for this priority queue
185 * priority queue. If {@code null}, the {@linkplain Comparable
197 this.queue = new Object[initialCapacity];
204 * priority queue will be ordered according to the same ordering.
205 * Otherwise, this priority queue will be ordered according to the
209 * into this priority queue
212 * queue's ordering
244 this.queue = a;
274 if (newCap > oldCap && queue == array)
283 if (newArray != null && queue == array) {
284 queue = newArray;
297 Object[] array = queue;
408 Object[] array = queue;
423 * Inserts the specified element into this priority queue.
428 * with elements currently in the priority queue according to the
429 * priority queue's ordering
437 * Inserts the specified element into this priority queue.
438 * As the queue is unbounded, this method will never return {@code false}.
443 * with elements currently in the priority queue according to the
444 * priority queue's ordering
454 while ((n = size) >= (cap = (array = queue).length))
471 * Inserts the specified element into this priority queue.
472 * As the queue is unbounded, this method will never block.
476 * with elements currently in the priority queue according to the
477 * priority queue's ordering
485 * Inserts the specified element into this priority queue.
486 * As the queue is unbounded, this method will never block or
495 * with elements currently in the priority queue according to the
496 * priority queue's ordering
544 return (size == 0) ? null : (E) queue[0];
551 * Returns the comparator used to order the elements in this queue,
552 * or {@code null} if this queue uses the {@linkplain Comparable
555 * @return the comparator used to order the elements in this queue,
556 * or {@code null} if this queue uses the natural
584 Object[] array = queue;
594 * Removes the ith element from queue.
597 Object[] array = queue;
620 * Removes a single instance of the specified element from this queue,
622 * that {@code o.equals(e)}, if this queue contains one or more such
623 * elements. Returns {@code true} if and only if this queue contained
624 * the specified element (or equivalently, if this queue changed as a
627 * @param o element to be removed from this queue, if present
628 * @return {@code true} if this queue changed as a result of the call
651 Object[] array = queue;
664 * Returns {@code true} if this queue contains the specified element.
665 * More formally, returns {@code true} if and only if this queue contains
668 * @param o object to be checked for containment in this queue
669 * @return {@code true} if this queue contains the specified element
713 c.add((E) queue[0]); // In this order, in case add() throws.
723 * Atomically removes all of the elements from this queue.
724 * The queue will be empty after this call returns.
730 Object[] array = queue;
741 * Returns an array containing all of the elements in this queue.
745 * maintained by this queue. (In other words, this method must allocate
751 * @return an array containing all of the elements in this queue
757 return Arrays.copyOf(queue, size);
764 * Returns an array containing all of the elements in this queue; the
767 * If the queue fits in the specified array, it is returned therein.
769 * specified array and the size of this queue.
771 * <p>If this queue fits in the specified array with room to spare
772 * (i.e., the array has more elements than this queue), the element in
773 * the array immediately following the end of the queue is set to
781 * <p>Suppose {@code x} is a queue known to contain only strings.
782 * The following code can be used to dump the queue into a newly
790 * @param a the array into which the elements of the queue are to
793 * @return an array containing all of the elements in this queue
796 * this queue
806 return (T[]) Arrays.copyOf(queue, size, a.getClass());
807 System.arraycopy(queue, 0, a, 0, n);
817 * Returns an iterator over the elements in this queue. The
823 * @return an iterator over the elements in this queue
862 * Saves this queue to a stream (that is, serializes it).
886 * Reconstitutes this queue from a stream (that is, deserializes it).
896 this.queue = new Object[q.size()];
907 final PriorityBlockingQueue<E> queue;
912 PBQSpliterator(PriorityBlockingQueue<E> queue, Object[] array,
914 this.queue = queue;
923 hi = fence = (array = queue.toArray()).length;
930 new PBQSpliterator<E>(queue, array, lo, index = mid);
939 fence = (a = queue.toArray()).length;
965 * Returns a {@link Spliterator} over the elements in this queue.
976 * @return a {@code Spliterator} over the elements in this queue