directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1551212 - in /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted: BTreeFactory.java Node.java PersistedBTreeBuilder.java PersistedLeaf.java TupleCursorImpl.java
Date Mon, 16 Dec 2013 14:06:31 GMT
Author: elecharny
Date: Mon Dec 16 14:06:31 2013
New Revision: 1551212

URL: http://svn.apache.org/r1551212
Log:
o Removed the children array from the persisted Node class
o Updated the persisted classes accordingly

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/BTreeFactory.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/Node.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedBTreeBuilder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedLeaf.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/TupleCursorImpl.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/BTreeFactory.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/BTreeFactory.java?rev=1551212&r1=1551211&r2=1551212&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/BTreeFactory.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/BTreeFactory.java
Mon Dec 16 14:06:31 2013
@@ -302,7 +302,7 @@ public class BTreeFactory
 
             while ( true )
             {
-                Page<K, V> p = node.children[node.getNbElems()].getValue();
+                Page<K, V> p = node.getPage( node.getNbElems() );
 
                 last = new ParentPos<K, V>( p, p.getNbElems() );
                 stack.push( last );
@@ -347,7 +347,7 @@ public class BTreeFactory
 
             while ( true )
             {
-                Page<K, V> page = node.children[0].getValue();
+                Page<K, V> page = node.getPage( 0 );
 
                 first = new ParentPos<K, V>( page, 0 );
                 stack.push( first );

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/Node.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/Node.java?rev=1551212&r1=1551211&r2=1551212&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/Node.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/Node.java
Mon Dec 16 14:06:31 2013
@@ -57,10 +57,6 @@ import org.apache.directory.mavibot.btre
  */
 /* No qualifier */class Node<K, V> extends AbstractPage<K, V>
 {
-    /** Children pages associated with keys. */
-    protected PersistedPageHolder<K, V>[] children;
-
-
     /**
      * Creates a new Node which will contain only one key, with references to
      * a left and right page. This is a specific constructor used by the btree

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedBTreeBuilder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedBTreeBuilder.java?rev=1551212&r1=1551211&r2=1551212&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedBTreeBuilder.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedBTreeBuilder.java
Mon Dec 16 14:06:31 2013
@@ -181,7 +181,7 @@ public class PersistedBTreeBuilder<K, V>
                 setKey( btree, node, i - 1, page.getLeftMostKey() );
             }
 
-            node.children[i] = new PersistedPageHolder<K, V>( btree, page );
+            node.setPageHolder( i, new PersistedPageHolder<K, V>( btree, page ) );
 
             i++;
             totalNodes++;

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedLeaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedLeaf.java?rev=1551212&r1=1551211&r2=1551212&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedLeaf.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/PersistedLeaf.java
Mon Dec 16 14:06:31 2013
@@ -222,7 +222,7 @@ import org.apache.directory.mavibot.btre
                 // Check in both next and previous page, if they have the same parent
                 // and select the biggest page with the same parent to borrow an element.
                 int siblingPos = selectSibling( ( Node<K, V> ) parent, parentPos );
-                PersistedLeaf<K, V> sibling = ( PersistedLeaf<K, V> ) ( ( ( Node<K,
V> ) parent ).children[siblingPos].getValue() );
+                PersistedLeaf<K, V> sibling = ( PersistedLeaf<K, V> ) ( ( ( Node<K,
V> ) parent ).getPage( siblingPos ) );
 
                 if ( sibling.getNbElems() == halfSize )
                 {

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/TupleCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/TupleCursorImpl.java?rev=1551212&r1=1551211&r2=1551212&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/TupleCursorImpl.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/TupleCursorImpl.java
Mon Dec 16 14:06:31 2013
@@ -183,7 +183,7 @@ public class TupleCursorImpl<K, V> exten
             {
                 // We can pick the next element at this level
                 parentPos.pos++;
-                child = ((Node<K, V>)parentPos.page).children[parentPos.pos].getValue();
+                child = ((Node<K, V>)parentPos.page).getPage( parentPos.pos );
                 
                 // and go down the tree through the nodes
                 while ( currentDepth < depth - 1 )
@@ -192,7 +192,7 @@ public class TupleCursorImpl<K, V> exten
                     parentPos = stack[currentDepth];
                     parentPos.pos = 0;
                     parentPos.page = child;
-                    child = ((Node<K, V>)child).children[0].getValue();
+                    child = ((Node<K, V>)child).getPage( 0 );
                 }
 
                 // and the leaf
@@ -242,13 +242,13 @@ public class TupleCursorImpl<K, V> exten
             else
             {
                 // We can pick the next element at this level
-                child = ((Node<K, V>)parentPos.page).children[parentPos.pos + 1].getValue();
+                child = ((Node<K, V>)parentPos.page).getPage( parentPos.pos + 1 );
                 
                 // and go down the tree through the nodes
                 while ( currentDepth < depth - 1 )
                 {
                     currentDepth++;
-                    child = ((Node<K, V>)child).children[0].getValue();
+                    child = ((Node<K, V>)child).getPage( 0 );
                 }
 
                 return true;
@@ -292,13 +292,13 @@ public class TupleCursorImpl<K, V> exten
             else
             {
                 // We can pick the previous element at this level
-                child = ((Node<K, V>)parentPos.page).children[parentPos.pos - 1].getValue();
+                child = ((Node<K, V>)parentPos.page).getPage( parentPos.pos - 1 );
                 
                 // and go down the tree through the nodes
                 while ( currentDepth < depth - 1 )
                 {
                     currentDepth++;
-                    child = ((Node<K, V>)child).children[child.getNbElems()].getValue();
+                    child = ((Node<K, V>)child).getPage( child.getNbElems() );
                 }
 
                 return true;
@@ -343,7 +343,7 @@ public class TupleCursorImpl<K, V> exten
             {
                 // We can pick the next element at this level
                 parentPos.pos--;
-                child = ((Node<K, V>)parentPos.page).children[parentPos.pos].getValue();
+                child = ((Node<K, V>)parentPos.page).getPage( parentPos.pos );
                 
                 // and go down the tree through the nodes
                 while ( currentDepth < depth - 1 )
@@ -352,7 +352,7 @@ public class TupleCursorImpl<K, V> exten
                     parentPos = stack[currentDepth];
                     parentPos.pos = child.getNbElems();
                     parentPos.page = child;
-                    child = ((Node<K, V>)parentPos.page).children[parentPos.page.getNbElems()].getValue();
+                    child = ((Node<K, V>)parentPos.page).getPage( parentPos.page.getNbElems()
);
                 }
 
                 // and the leaf
@@ -797,7 +797,7 @@ public class TupleCursorImpl<K, V> exten
                 parentPos.page = child;
             }
 
-            child = ((Node<K, V>)parentPos.page).children[0].getValue();
+            child = ((Node<K, V>)parentPos.page).getPage( 0 );
         }
 
         // and leaf
@@ -845,7 +845,7 @@ public class TupleCursorImpl<K, V> exten
                 parentPos.pos = parentPos.page.getNbElems();
             }
 
-            child = ((Node<K, V>)parentPos.page).children[parentPos.pos].getValue();
+            child = ((Node<K, V>)parentPos.page).getPage( parentPos.pos );
         }
         
         // and leaf



Mime
View raw message