You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/02/13 14:40:12 UTC

svn commit: r1659558 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java

Author: elecharny
Date: Fri Feb 13 13:40:11 2015
New Revision: 1659558

URL: http://svn.apache.org/r1659558
Log:
o Fixed the hasNext() method which was returning false when teh cursor was on the end of a page

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java?rev=1659558&r1=1659557&r2=1659558&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java Fri Feb 13 13:40:11 2015
@@ -196,6 +196,25 @@ public class TupleCursor<K, V>
 
         if ( parentPos.pos == AFTER_LAST )
         {
+            // Ok, here, we have reached the last value in the leaf. We have to go up and
+            // see if we have some remaining values
+            int currentDepth = depth - 1;
+
+            while ( currentDepth >= 0 )
+            {
+                parentPos = stack[currentDepth];
+
+                if ( parentPos.pos < parentPos.page.getNbElems() )
+                {
+                    // The parent has some remaining values on the right, get out
+                    return true;
+                }
+                else
+                {
+                    currentDepth--;
+                }
+            }
+
             return false;
         }