Author: elecharny
Date: Mon Jul  2 12:42:25 2012
New Revision: 1356206

URL: http://svn.apache.org/viewvc?rev=1356206&view=rev
Log:
Some more Javadoc cleanup

Modified:
    
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Cursor.java
    labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Leaf.java
    labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java

Modified: 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Cursor.java
URL: 
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Cursor.java?rev=1356206&r1=1356205&r2=1356206&view=diff
==============================================================================
--- 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Cursor.java 
(original)
+++ 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Cursor.java 
Mon Jul  2 12:42:25 2012
@@ -25,13 +25,14 @@ import java.util.LinkedList;
  * A Cursor is used to fetch elements in a BTree and is returned by the
  * @see BTree#browse method. The cursor <strng>must</strong> be closed
  * when the user is done with it.
+ * <p>
  * 
  * @author <a href="mailto:[email protected]";>Mavibot labs Project</a>
  *
  * @param <K> The type for the Key
  * @param <V> The type for the stored value
  */
-public class Cursor<K, V>
+/* No qualifier */ class Cursor<K, V>
 {
     /** The transaction used for this cursor */
     private Transaction<K, V> transaction;
@@ -46,10 +47,9 @@ public class Cursor<K, V>
      * Creates a new instance of Cursor, starting on a page at a given 
position.
      * 
      * @param transaction The transaction this operation is protected by
-     * @param leaf The page in which the first element is present
-     * @param pos The position of the first element
+     * @param stack The stack of parent's from root to this page
      */
-    public Cursor( Transaction<K, V> transaction, LinkedList<ParentPos<K, V>> 
stack  )
+    /* No qualifier */ Cursor( Transaction<K, V> transaction, 
LinkedList<ParentPos<K, V>> stack  )
     {
         this.transaction = transaction;
         this.stack = stack;
@@ -61,7 +61,7 @@ public class Cursor<K, V>
      * 
      * @return A Tuple containing the found key and value
      */
-    public Tuple<K, V> next()
+    /* No qualifier */ Tuple<K, V> next()
     {
         ParentPos<K, V> parentPos = stack.getFirst();
         
@@ -74,7 +74,7 @@ public class Cursor<K, V>
         {
             // End of the leaf. We have to go back into the stack up to the
             // parent, and down to the leaf
-            parentPos = findNextLeaf();
+            parentPos = findNextParentPos();
             
             if ( parentPos.page == null )
             {
@@ -93,10 +93,17 @@ public class Cursor<K, V>
     }
     
     
-    private ParentPos<K, V> findNextLeaf()
+    /**
+     * Find the leaf containing the following elements.
+     * 
+     * @return the new ParentPos instance, or null if we have no following leaf
+     */
+    private ParentPos<K, V> findNextParentPos()
     {
         while ( true )
         {
+            // We first go up the tree, until we reach a page which current 
position
+            // is not the last one
             ParentPos<K, V> parentPos = stack.peek();
             
             if ( parentPos == null )
@@ -111,6 +118,7 @@ public class Cursor<K, V>
             }
             else
             {
+                // Then we go down the tree until we find a leaf which 
position is not the last one.
                 int newPos = ++parentPos.pos;
                 ParentPos<K, V> newParentPos = parentPos;
                 
@@ -131,10 +139,17 @@ public class Cursor<K, V>
     }
     
     
-    private ParentPos<K, V> findPreviousLeaf()
+    /**
+     * Find the leaf containing the previous elements.
+     * 
+     * @return the new ParentPos instance, or null if we have no previous leaf
+     */
+    private ParentPos<K, V> findPreviousParentPos()
     {
         while ( true )
         {
+            // We first go up the tree, until we reach a page which current 
position
+            // is not the first one
             ParentPos<K, V> parentPos = stack.peek();
             
             if ( parentPos == null )
@@ -149,6 +164,7 @@ public class Cursor<K, V>
             }
             else
             {
+                // Then we go down the tree until we find a leaf which 
position is not the first one.
                 int newPos = --parentPos.pos;
                 ParentPos<K, V> newParentPos = parentPos;
                 
@@ -174,7 +190,7 @@ public class Cursor<K, V>
      * 
      * @return A Tuple containing the found key and value
      */
-    public Tuple<K, V> prev()
+    /* No qualifier */ Tuple<K, V> prev()
     {
         ParentPos<K, V> parentPos = stack.peek();
         
@@ -187,7 +203,7 @@ public class Cursor<K, V>
         {
             // End of the leaf. We have to go back into the stack up to the
             // parent, and down to the leaf
-            parentPos = findPreviousLeaf();
+            parentPos = findPreviousParentPos();
             
             if ( parentPos.page == null )
             {
@@ -211,7 +227,7 @@ public class Cursor<K, V>
      * Tells if the cursor can return a next element
      * @return true if there are some more elements
      */
-    public boolean hasNext()
+    /* No qualifier */ boolean hasNext()
     {
         ParentPos<K, V> parentPos = stack.peek();
         
@@ -227,7 +243,7 @@ public class Cursor<K, V>
             
             // End of the leaf. We have to go back into the stack up to the
             // parent, and down to the leaf
-            parentPos = findNextLeaf();
+            parentPos = findNextParentPos();
             
             return ( parentPos != null ) && ( parentPos.page != null );
         }
@@ -242,7 +258,7 @@ public class Cursor<K, V>
      * Tells if the cursor can return a previous element
      * @return true if there are some more elements
      */
-    public boolean hasPrev()
+    /* No qualifier */ boolean hasPrev()
     {
         ParentPos<K, V> parentPos = stack.peek();
         
@@ -258,7 +274,7 @@ public class Cursor<K, V>
             
             // Start of the leaf. We have to go back into the stack up to the
             // parent, and down to the leaf
-            parentPos = findPreviousLeaf();
+            parentPos = findPreviousParentPos();
             
             return ( parentPos != null ) && ( parentPos.page != null );
         }

Modified: 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Leaf.java
URL: 
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Leaf.java?rev=1356206&r1=1356205&r2=1356206&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Leaf.java 
(original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Leaf.java 
Mon Jul  2 12:42:25 2012
@@ -38,7 +38,7 @@ public class Leaf<K, V> extends Abstract
     /**
      * Empty constructor
      */
-    public Leaf( BTree<K, V> btree )
+    /* No qualifier */ Leaf( BTree<K, V> btree )
     {
         super( btree );
     }
@@ -101,6 +101,7 @@ public class Leaf<K, V> extends Abstract
     /**
      * {@inheritDoc}
      */
+    @SuppressWarnings("unchecked")
     public DeleteResult<K, V> delete( long revision, K key, Page<K, V> parent, 
int parentPos )
     {
         // Check that the leaf is not empty
@@ -186,8 +187,10 @@ public class Leaf<K, V> extends Abstract
     
     /**
      * Merge the sibling with the current leaf, after having removed the 
element in the page.
+     * 
      * @param revision The new revision
      * @param sibling The sibling we will merge with
+     * @param isLeft Tells if the sibling is on the left or on the right
      * @param pos The position of the removed element
      * @return The new created leaf containing the sibling and the old page.
      */
@@ -331,6 +334,10 @@ public class Leaf<K, V> extends Abstract
     /**
      * Select the sibling (the prev or next page with the same parent) which 
has
      * the more element assuming it's above N/2
+     * 
+     * @param parent The parent of the current page
+     * @param The position of the current page reference in its parent
+     * @return The position of the sibling, or -1 if we hav'nt found any 
sibling
      */
     private int selectSibling( Node<K, V> parent, int parentPos )
     {
@@ -369,9 +376,7 @@ public class Leaf<K, V> extends Abstract
      * Remove the element at a given position. The
      * 
      * @param revision The revision of the modified page
-     * @param key The key to insert
-     * @param value The value to insert
-     * @param pos The position into the page
+     * @param pos The position into the page of the element to remove
      * @return The modified page with the <K,V> element added
      */
     private DeleteResult<K, V> removeElement( long revision,int pos )
@@ -497,6 +502,7 @@ public class Leaf<K, V> extends Abstract
      * Copy the current page and all of the keys, values and children, if it's 
not a leaf.
      * 
      * @param revision The new revision
+     * @param nbElems The number of elements to copy
      * @return The copied page
      */
     private Page<K, V> copy( long revision, int nbElems )
@@ -515,8 +521,9 @@ public class Leaf<K, V> extends Abstract
      * Copy the current page if needed, and replace the value at the position 
we have found the key.
      * 
      * @param revision The new page revision
-     * @param pos The position of the key in the page
+     * @param key The new key
      * @param value the new value
+     * @param pos The position of the key in the page
      * @return The copied page
      */
     private InsertResult<K, V> replaceElement( long revision, K key, V value, 
int pos )
@@ -656,7 +663,6 @@ public class Leaf<K, V> extends Abstract
         // Get the pivot
         K pivot = rightLeaf.keys[0];
         
-        // Prepare the result
         // Create the result
         InsertResult<K, V> result = new SplitResult<K, V>( pivot, leftLeaf, 
rightLeaf );
         

Modified: 
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java
URL: 
http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java?rev=1356206&r1=1356205&r2=1356206&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java 
(original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java 
Mon Jul  2 12:42:25 2012
@@ -29,7 +29,7 @@ import java.util.LinkedList;
  *
  * @author <a href="mailto:[email protected]";>Mavibot labs Project</a>
  */
-public interface Page<K, V>
+/* No qualifier */ interface Page<K, V>
 {
     /**
      * @return The number of keys present in this page
@@ -54,7 +54,7 @@ public interface Page<K, V>
      * @param value Inserted value
      * @return Either a modified Page or an Overflow element if the Page was 
full
      */
-    InsertResult<K, V> insert( long revision, K key, V value );
+    /* No qualifier */ InsertResult<K, V> insert( long revision, K key, V 
value );
 
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to