You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/01/29 03:20:41 UTC
[07/10] git commit: Refactored check next logic
Refactored check next logic
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b7e3cf29
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b7e3cf29
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b7e3cf29
Branch: refs/heads/USERGRID-2862-limitfix
Commit: b7e3cf290f162221bf96a01a5f8e115ce59b33d9
Parents: 2303624
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Jan 27 10:11:56 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Jan 28 18:36:11 2014 -0700
----------------------------------------------------------------------
.../persistence/query/ir/result/MergeIterator.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b7e3cf29/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/MergeIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/MergeIterator.java b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/MergeIterator.java
index e09cff5..81eacd8 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/MergeIterator.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/MergeIterator.java
@@ -62,7 +62,7 @@ public abstract class MergeIterator implements ResultIterator {
@Override
public boolean hasNext() {
//if next isn't set, try to advance
- if(next != null){
+ if(checkNext()){
return true;
}
@@ -70,7 +70,16 @@ public abstract class MergeIterator implements ResultIterator {
doAdvance();
- return next != null;
+ return checkNext();
+ }
+
+
+ /**
+ * Single source of logic to check if a next is present.
+ * @return
+ */
+ protected boolean checkNext(){
+ return next != null && next.size() > 0;
}