public HeadStream(MutableObjectIterator<E> iterator, TypeComparator<E> comparator) throws IOException { this.iterator = iterator; this.comparator = comparator; if (!nextHead()) { throw new IllegalStateException(); } }
/** * Gets the next smallest element, with respect to the definition of order implied by * the {@link TypeSerializer} provided to this iterator. * * @return The next element if the iterator has another element, null otherwise. * * @see org.apache.flink.util.MutableObjectIterator#next() */ @Override public E next() throws IOException { if (this.heap.size() > 0) { // get the smallest element final HeadStream<E> top = this.heap.peek(); E result = top.getHead(); // read an element if (!top.nextHead()) { this.heap.poll(); } else { this.heap.adjustTop(); } return result; } else { return null; } }
/** * Gets the next smallest element, with respect to the definition of order implied by * the {@link TypeSerializer} provided to this iterator. * * @return The next element if the iterator has another element, null otherwise. * * @see org.apache.flink.util.MutableObjectIterator#next() */ @Override public E next() throws IOException { if (this.heap.size() > 0) { // get the smallest element final HeadStream<E> top = this.heap.peek(); E result = top.getHead(); // read an element if (!top.nextHead()) { this.heap.poll(); } else { this.heap.adjustTop(); } return result; } else { return null; } }
/** * Gets the next smallest element, with respect to the definition of order implied by * the {@link TypeSerializer} provided to this iterator. * * @return The next element if the iterator has another element, null otherwise. * * @see org.apache.flink.util.MutableObjectIterator#next() */ @Override public E next() throws IOException { if (this.heap.size() > 0) { // get the smallest element final HeadStream<E> top = this.heap.peek(); E result = top.getHead(); // read an element if (!top.nextHead()) { this.heap.poll(); } else { this.heap.adjustTop(); } return result; } else { return null; } }
/** * Gets the next smallest element, with respect to the definition of order implied by * the {@link TypeSerializer} provided to this iterator. * * @return The next element if the iterator has another element, null otherwise. * * @see org.apache.flink.util.MutableObjectIterator#next() */ @Override public E next() throws IOException { if (this.heap.size() > 0) { // get the smallest element final HeadStream<E> top = this.heap.peek(); E result = top.getHead(); // read an element if (!top.nextHead()) { this.heap.poll(); } else { this.heap.adjustTop(); } return result; } else { return null; } }
/** * @param iterators * @param comparator * @throws IOException */ public MergeIterator(List<MutableObjectIterator<E>> iterators, TypeComparator<E> comparator) throws IOException { this.heap = new PartialOrderPriorityQueue<HeadStream<E>>(new HeadStreamComparator<E>(), iterators.size()); for (MutableObjectIterator<E> iterator : iterators) { this.heap.add(new HeadStream<E>(iterator, comparator.duplicate())); } }
public HeadStream(MutableObjectIterator<E> iterator, TypeComparator<E> comparator) throws IOException { this.iterator = iterator; this.comparator = comparator; if (!nextHead()) { throw new IllegalStateException(); } }
/** * @param iterators * @param comparator * @throws IOException */ public MergeIterator(List<MutableObjectIterator<E>> iterators, TypeComparator<E> comparator) throws IOException { this.heap = new PartialOrderPriorityQueue<HeadStream<E>>(new HeadStreamComparator<E>(), iterators.size()); for (MutableObjectIterator<E> iterator : iterators) { this.heap.add(new HeadStream<E>(iterator, comparator.duplicate())); } }
public HeadStream(MutableObjectIterator<E> iterator, TypeComparator<E> comparator) throws IOException { this.iterator = iterator; this.comparator = comparator; if (!nextHead()) { throw new IllegalStateException(); } }
/** * @param iterators * @param comparator * @throws IOException */ public MergeIterator(List<MutableObjectIterator<E>> iterators, TypeComparator<E> comparator) throws IOException { this.heap = new PartialOrderPriorityQueue<HeadStream<E>>(new HeadStreamComparator<E>(), iterators.size()); for (MutableObjectIterator<E> iterator : iterators) { this.heap.add(new HeadStream<E>(iterator, comparator.duplicate())); } }
public HeadStream(MutableObjectIterator<E> iterator, TypeComparator<E> comparator) throws IOException { this.iterator = iterator; this.comparator = comparator; if (!nextHead()) { throw new IllegalStateException(); } }
/** * @param iterators * @param comparator * @throws IOException */ public MergeIterator(List<MutableObjectIterator<E>> iterators, TypeComparator<E> comparator) throws IOException { this.heap = new PartialOrderPriorityQueue<HeadStream<E>>(new HeadStreamComparator<E>(), iterators.size()); for (MutableObjectIterator<E> iterator : iterators) { this.heap.add(new HeadStream<E>(iterator, comparator.duplicate())); } }