usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [11/42] git commit: Refactored check next logic
Date Wed, 05 Feb 2014 01:21:21 GMT
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/pull/27/merge
Commit: b7e3cf290f162221bf96a01a5f8e115ce59b33d9
Parents: 2303624
Author: Todd Nine <tnine@apigee.com>
Authored: Mon Jan 27 10:11:56 2014 -0700
Committer: Todd Nine <tnine@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;
     }
 
 


Mime
View raw message