From 18af480017472337091d277fc6713418269c39e1 Mon Sep 17 00:00:00 2001 From: jianran Date: Fri, 12 Aug 2016 00:42:12 +0800 Subject: [PATCH] Rename fields in OrderedMergeIterator (#3149) * code readable * fix the pre middle manager peon no stop * Revert "fix the pre middle manager peon no stop" This reverts commit 6cef4980bfbeed6c26f49f55de47d575c35bb639. --- .../collections/OrderedMergeIterator.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/io/druid/collections/OrderedMergeIterator.java b/common/src/main/java/io/druid/collections/OrderedMergeIterator.java index 1510d5015dc..ef382984e0c 100644 --- a/common/src/main/java/io/druid/collections/OrderedMergeIterator.java +++ b/common/src/main/java/io/druid/collections/OrderedMergeIterator.java @@ -45,7 +45,7 @@ import java.util.PriorityQueue; */ public class OrderedMergeIterator implements Iterator { - private final PriorityQueue> pQueue; + private final PriorityQueue> firstElementComparedPQueue; private PeekingIterator> iterOfIterators; private final Comparator comparator; @@ -56,7 +56,7 @@ public class OrderedMergeIterator implements Iterator ) { this.comparator = comparator; - pQueue = new PriorityQueue>( + firstElementComparedPQueue = new PriorityQueue>( 16, new Comparator>() { @@ -96,7 +96,7 @@ public class OrderedMergeIterator implements Iterator @Override public boolean hasNext() { - return !pQueue.isEmpty() || iterOfIterators.hasNext(); + return !firstElementComparedPQueue.isEmpty() || iterOfIterators.hasNext(); } @Override @@ -106,26 +106,26 @@ public class OrderedMergeIterator implements Iterator throw new NoSuchElementException(); } - final PeekingIterator it; + final PeekingIterator littleIt; if (!iterOfIterators.hasNext()) { - it = pQueue.remove(); - } else if (pQueue.isEmpty()) { - it = iterOfIterators.next(); + littleIt = firstElementComparedPQueue.remove(); + } else if (firstElementComparedPQueue.isEmpty()) { + littleIt = iterOfIterators.next(); } else { - T pQueueValue = pQueue.peek().peek(); + T pQueueValue = firstElementComparedPQueue.peek().peek(); T iterItersValue = iterOfIterators.peek().peek(); if (comparator.compare(pQueueValue, iterItersValue) <= 0) { - it = pQueue.remove(); + littleIt = firstElementComparedPQueue.remove(); } else { - it = iterOfIterators.next(); + littleIt = iterOfIterators.next(); } } - T retVal = it.next(); + T retVal = littleIt.next(); - if (it.hasNext()) { - pQueue.add(it); + if (littleIt.hasNext()) { + firstElementComparedPQueue.add(littleIt); } return retVal;