directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1551913 [1/3] - in /directory/mavibot/trunk/mavibot/src: main/java/org/apache/directory/mavibot/btree/ main/java/org/apache/directory/mavibot/btree/util/ test/java/org/apache/directory/mavibot/btree/
Date Wed, 18 Dec 2013 11:12:49 GMT
Author: elecharny
Date: Wed Dec 18 11:12:48 2013
New Revision: 1551913

URL: http://svn.apache.org/r1551913
Log:
Formatted the code

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBorrowedFromSiblingResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractDeleteResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractPage.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractValueHolder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTree.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTreeFactory.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BorrowedFromSiblingResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Cursor.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/DeleteResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTree.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTreeBuilder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryLeaf.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryNode.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InsertResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/KeyHolder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ModifyResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/NotPresentResult.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Page.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PageHolder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ParentPos.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeConfiguration.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedNode.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedPageHolder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedValueHolder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RevisionName.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RevisionNameComparator.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RevisionNameSerializer.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ValueArrayCursor.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ValueBTreeCursor.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ValueHolder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/util/Strings.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/util/TupleReaderWriter.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeBuilderTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeDuplicateKeyTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeFlushTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBTreeTestOps.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryBulkDataSorterTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/InMemoryLeafTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilderTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeDuplicateKeyTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedReadTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedStoreTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerFreePageTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerPrivateMethodTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerWithDuplicatesTest.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java Wed Dec 18 11:12:48 2013
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mavibot.btree;
 
+
 import java.io.IOException;
 import java.util.Comparator;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -27,6 +28,7 @@ import java.util.concurrent.locks.Reentr
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
 
+
 /**
  * A BTree abstract class containing the methods shared by the PersistedBTree or the InMemoryBTree
  * implementations.
@@ -67,10 +69,11 @@ import org.apache.directory.mavibot.btre
 
     /** The thread responsible for the cleanup of timed out reads */
     protected Thread readTransactionsThread;
-    
+
     /** The BTree type : either in-memory, disk backed or persisted */
     private BTreeTypeEnum type;
 
+
     /**
      * Starts a Read Only transaction. If the transaction is not closed, it will be 
      * automatically closed after the timeout
@@ -97,9 +100,9 @@ import org.apache.directory.mavibot.btre
 
         // Fetch the root page for this revision
         ParentPos<K, V>[] stack = new ParentPos[32];
-        
+
         TupleCursor<K, V> cursor = rootPage.browse( transaction, stack, 0 );
-        
+
         // Set the position before the first element
         cursor.beforeFirst();
 
@@ -116,7 +119,7 @@ import org.apache.directory.mavibot.btre
 
         // Fetch the root page for this revision
         Page<K, V> revisionRootPage = getRootPage( revision );
-        
+
         ParentPos<K, V>[] stack = new ParentPos[32];
 
         // And get the cursor
@@ -124,8 +127,8 @@ import org.apache.directory.mavibot.btre
 
         return cursor;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -230,15 +233,15 @@ import org.apache.directory.mavibot.btre
      * @param key The key for the entry we try to remove
      * @return A Tuple<K, V> containing the removed entry, or null if it's not found.
      */
-    /*no qualifier*/ Tuple<K, V> delete( K key, long revision ) throws IOException
+    /*no qualifier*/Tuple<K, V> delete( K key, long revision ) throws IOException
     {
         return delete( key, null, revision );
     }
 
 
     /*no qualifier*/abstract Tuple<K, V> delete( K key, V value, long revision ) throws IOException;
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -269,7 +272,7 @@ import org.apache.directory.mavibot.btre
         return existingValue;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -336,8 +339,8 @@ import org.apache.directory.mavibot.btre
 
         return rootPage.hasKey( key );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -354,7 +357,7 @@ import org.apache.directory.mavibot.btre
         return revisionRootPage.hasKey( key );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -545,7 +548,7 @@ import org.apache.directory.mavibot.btre
         this.writeBufferSize = writeBufferSize;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -603,7 +606,7 @@ import org.apache.directory.mavibot.btre
      * Create a thread that is responsible of cleaning the transactions when
      * they hit the timeout
      */
-    /*no qualifier*/ void createTransactionManager()
+    /*no qualifier*/void createTransactionManager()
     {
         Runnable readTransactionTask = new Runnable()
         {

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBorrowedFromSiblingResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBorrowedFromSiblingResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBorrowedFromSiblingResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBorrowedFromSiblingResult.java Wed Dec 18 11:12:48 2013
@@ -57,7 +57,7 @@ import java.util.List;
      * @param modifiedSibling The modified sibling
      * @param removedElement The removed element (can be null if the key wasn't present in the tree)
      */
-    /* No qualifier*/ AbstractBorrowedFromSiblingResult( Page<K, V> modifiedPage, Page<K, V> modifiedSibling,
+    /* No qualifier*/AbstractBorrowedFromSiblingResult( Page<K, V> modifiedPage, Page<K, V> modifiedSibling,
         Tuple<K, V> removedElement, SiblingPosition position )
     {
         super( modifiedPage, removedElement );
@@ -74,7 +74,7 @@ import java.util.List;
      * @param modifiedSibling The modified sibling
      * @param removedElement The removed element (can be null if the key wasn't present in the tree)
      */
-    /* No qualifier*/ AbstractBorrowedFromSiblingResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
+    /* No qualifier*/AbstractBorrowedFromSiblingResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
         Page<K, V> modifiedSibling,
         Tuple<K, V> removedElement, SiblingPosition position )
     {

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractDeleteResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractDeleteResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractDeleteResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractDeleteResult.java Wed Dec 18 11:12:48 2013
@@ -47,7 +47,7 @@ import java.util.List;
      * @param modifiedPage The modified page
      * @param removedElement The removed element (can be null if the key wasn't present in the tree)
      */
-    /*no qualifier*/ AbstractDeleteResult( Page<K, V> modifiedPage, Tuple<K, V> removedElement )
+    /*no qualifier*/AbstractDeleteResult( Page<K, V> modifiedPage, Tuple<K, V> removedElement )
     {
         super();
         this.modifiedPage = modifiedPage;
@@ -62,7 +62,7 @@ import java.util.List;
      * @param modifiedPage The modified page
      * @param removedElement The removed element (can be null if the key wasn't present in the tree)
      */
-    /*no qualifier*/ AbstractDeleteResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
+    /*no qualifier*/AbstractDeleteResult( List<Page<K, V>> copiedPages, Page<K, V> modifiedPage,
         Tuple<K, V> removedElement )
     {
         super( copiedPages );
@@ -92,7 +92,7 @@ import java.util.List;
     /**
      * @param modifiedPage the modifiedPage to set
      */
-    /*no qualifier*/ void setModifiedPage( Page<K, V> modifiedPage )
+    /*no qualifier*/void setModifiedPage( Page<K, V> modifiedPage )
     {
         this.modifiedPage = modifiedPage;
     }

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractPage.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractPage.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractPage.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractPage.java Wed Dec 18 11:12:48 2013
@@ -65,6 +65,7 @@ import org.apache.directory.mavibot.btre
     protected KeyNotFoundException KEY_NOT_FOUND_EXCEPTION = new KeyNotFoundException(
         "Cannot find an entry associated with this key" );
 
+
     /**
      * Creates a default empty AbstractPage
      * 
@@ -75,6 +76,7 @@ import org.apache.directory.mavibot.btre
         this.btree = btree;
     }
 
+
     /**
      * Internal constructor used to create Page instance used when a page is being copied or overflow
      */
@@ -107,7 +109,7 @@ import org.apache.directory.mavibot.btre
         this.nbElems = nbElems;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -122,8 +124,8 @@ import org.apache.directory.mavibot.btre
             return null;
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -166,7 +168,7 @@ import org.apache.directory.mavibot.btre
             return null;
         }
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -183,7 +185,7 @@ import org.apache.directory.mavibot.btre
 
         // We first stack the current page
         stack[depth++] = new ParentPos<K, V>( this, pos );
-        
+
         Page<K, V> page = children[pos].getValue();
 
         return page.browse( key, transaction, stack, depth );
@@ -230,7 +232,7 @@ import org.apache.directory.mavibot.btre
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -246,7 +248,7 @@ import org.apache.directory.mavibot.btre
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -279,7 +281,7 @@ import org.apache.directory.mavibot.btre
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -287,9 +289,9 @@ import org.apache.directory.mavibot.btre
         throws IOException
     {
         stack[depth++] = new ParentPos<K, V>( this, 0 );
-        
+
         Page<K, V> page = children[0].getValue();
-    
+
         return page.browse( transaction, stack, depth );
     }
 
@@ -319,8 +321,8 @@ import org.apache.directory.mavibot.btre
             return parentPos - 1;
         }
 
-        Page<K, V> prevPage = ((AbstractPage<K, V>)parent).getPage( parentPos - 1 );
-        Page<K, V> nextPage = ((AbstractPage<K, V>)parent).getPage( parentPos + 1 );
+        Page<K, V> prevPage = ( ( AbstractPage<K, V> ) parent ).getPage( parentPos - 1 );
+        Page<K, V> nextPage = ( ( AbstractPage<K, V> ) parent ).getPage( parentPos + 1 );
 
         int prevPageSize = prevPage.getNbElems();
         int nextPageSize = nextPage.getNbElems();
@@ -446,8 +448,8 @@ import org.apache.directory.mavibot.btre
     {
         this.revision = revision;
     }
-    
-    
+
+
     /**
      * Compares two keys
      * 
@@ -620,7 +622,7 @@ import org.apache.directory.mavibot.btre
         return sb.toString();
     }
 
-    
+
     /**
      * @see Object#toString()
      */

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractResult.java Wed Dec 18 11:12:48 2013
@@ -96,7 +96,7 @@ import java.util.List;
                 sb.append( ", " );
             }
 
-            sb.append( ((AbstractPage<K, V>)copiedPage).getOffset() );
+            sb.append( ( ( AbstractPage<K, V> ) copiedPage ).getOffset() );
         }
 
         sb.append( ">" );

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractValueHolder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractValueHolder.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractValueHolder.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractValueHolder.java Wed Dec 18 11:12:48 2013
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mavibot.btree;
 
+
 import java.io.IOException;
 import java.lang.reflect.Array;
 import java.util.Comparator;
@@ -36,19 +37,19 @@ import org.apache.directory.mavibot.btre
 {
     /** The BTree storing multiple value, if we have more than one value */
     protected BTree<V, V> valueBtree;
-    
+
     /** The array storing from 1 to N values */
     protected V[] valueArray;
-    
+
     /** The Value serializer */
     protected ElementSerializer<V> valueSerializer;
-    
+
     /** The configuration for the array <-> BTree switch. Default to 1 */
     protected int valueThresholdUp = 1;
     protected int valueThresholdLow = 1;
 
     protected int nbArrayElems;
-    
+
 
     /**
      * {@inheritDoc}
@@ -212,7 +213,7 @@ import org.apache.directory.mavibot.btre
         }
     }
 
-    
+
     /**
      * Check if the array of values contains a given value
      */
@@ -245,7 +246,7 @@ import org.apache.directory.mavibot.btre
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -260,8 +261,8 @@ import org.apache.directory.mavibot.btre
             return arrayContains( checkedValue );
         }
     }
-    
-    
+
+
     /**
      * Create a new Sub-BTree to store the values.
      */
@@ -314,30 +315,30 @@ import org.apache.directory.mavibot.btre
             {
                 // check that the value is not already present in the ValueHolder
                 int pos = findPos( value );
-    
+
                 if ( pos >= 0 )
                 {
                     // The value exists : nothing to do
                     return;
                 }
-    
+
                 // Ok, we just have to insert the new element at the right position
                 // We transform the position to a positive value 
                 pos = -( pos + 1 );
                 // First, copy the array
                 V[] newValueArray = ( V[] ) Array.newInstance( valueSerializer.getType(), valueArray.length + 1 );
-    
+
                 System.arraycopy( valueArray, 0, newValueArray, 0, pos );
                 newValueArray[pos] = value;
                 System.arraycopy( valueArray, pos, newValueArray, pos + 1, valueArray.length - pos );
-    
+
                 // And switch the arrays
                 valueArray = newValueArray;
             }
         }
     }
-    
-    
+
+
     /**
      * Add the value in the subBTree
      */
@@ -354,7 +355,7 @@ import org.apache.directory.mavibot.btre
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTree.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTree.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTree.java Wed Dec 18 11:12:48 2013
@@ -19,12 +19,14 @@
  */
 package org.apache.directory.mavibot.btree;
 
+
 import java.io.IOException;
 import java.util.Comparator;
 
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
 
+
 /**
  * A BTree interface, to be implemented by the PersistedBTree or the InMemoryBTree
  *
@@ -43,10 +45,10 @@ public interface BTree<K, V>
 
     /** Define a default delay for a read transaction. This is 10 seconds */
     static final long DEFAULT_READ_TIMEOUT = 10 * 1000L;
-    
+
     /** The BTree allows duplicate values */
     static final boolean ALLOW_DUPLICATES = true;
-    
+
     /** The BTree forbids duplicate values */
     static final boolean FORBID_DUPLICATES = false;
 

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTreeFactory.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTreeFactory.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTreeFactory.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BTreeFactory.java Wed Dec 18 11:12:48 2013
@@ -19,11 +19,13 @@
  */
 package org.apache.directory.mavibot.btree;
 
+
 import java.io.IOException;
 import java.util.LinkedList;
 
 import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
 
+
 /**
  * This class construct a BTree from a serialized version of a BTree. We need it
  * to avoid exposing all the methods of the BTree class.<br>
@@ -40,7 +42,7 @@ public class BTreeFactory<K, V>
     //--------------------------------------------------------------------------------------------
     // Create persisted btrees
     //--------------------------------------------------------------------------------------------
-    
+
     /**
      * Creates a new persisted BTree, with no initialization. 
      */
@@ -51,7 +53,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new persisted BTree using the BTreeConfiguration to initialize the 
      * BTree
@@ -64,8 +66,8 @@ public class BTreeFactory<K, V>
 
         return btree;
     }
-    
-    
+
+
     /**
      * Creates a new persisted BTree using the parameters to initialize the 
      * BTree
@@ -80,7 +82,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer )
     {
         PersistedBTreeConfiguration<K, V> configuration = new PersistedBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -94,7 +96,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new persisted BTree using the parameters to initialize the 
      * BTree
@@ -109,7 +111,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, boolean allowDuplicates )
     {
         PersistedBTreeConfiguration<K, V> configuration = new PersistedBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -122,8 +124,8 @@ public class BTreeFactory<K, V>
 
         return btree;
     }
-    
-    
+
+
     /**
      * Creates a new persisted BTree using the parameters to initialize the 
      * BTree
@@ -139,7 +141,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, boolean allowDuplicates, int cacheSize )
     {
         PersistedBTreeConfiguration<K, V> configuration = new PersistedBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -152,8 +154,8 @@ public class BTreeFactory<K, V>
 
         return btree;
     }
-    
-    
+
+
     /**
      * Creates a new persisted BTree using the parameters to initialize the 
      * BTree
@@ -168,7 +170,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, int pageSize )
     {
         PersistedBTreeConfiguration<K, V> configuration = new PersistedBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -182,7 +184,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new persisted BTree using the parameters to initialize the 
      * BTree
@@ -198,7 +200,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, int pageSize, boolean allowDuplicates )
     {
         PersistedBTreeConfiguration<K, V> configuration = new PersistedBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -211,8 +213,8 @@ public class BTreeFactory<K, V>
 
         return btree;
     }
-    
-    
+
+
     /**
      * Creates a new persisted BTree using the parameters to initialize the 
      * BTree
@@ -229,7 +231,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, int pageSize, boolean allowDuplicates, int cacheSize )
     {
         PersistedBTreeConfiguration<K, V> configuration = new PersistedBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -270,8 +272,8 @@ public class BTreeFactory<K, V>
 
         return btree;
     }
-    
-    
+
+
     /**
      * Creates a new in-memory BTree using the parameters to initialize the 
      * BTree
@@ -284,7 +286,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer )
     {
         InMemoryBTreeConfiguration<K, V> configuration = new InMemoryBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -297,7 +299,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new in-memory BTree using the parameters to initialize the 
      * BTree
@@ -312,7 +314,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, boolean allowDuplicates )
     {
         InMemoryBTreeConfiguration<K, V> configuration = new InMemoryBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -325,7 +327,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new in-memory BTree using the parameters to initialize the 
      * BTree
@@ -340,7 +342,7 @@ public class BTreeFactory<K, V>
         ElementSerializer<V> valueSerializer, int pageSize )
     {
         InMemoryBTreeConfiguration<K, V> configuration = new InMemoryBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setKeySerializer( keySerializer );
         configuration.setValueSerializer( valueSerializer );
@@ -353,7 +355,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new in-memory BTree using the parameters to initialize the 
      * BTree
@@ -364,11 +366,12 @@ public class BTreeFactory<K, V>
      * @param valueSerializer Value serializer
      * @throws IOException
      */
-    public static <K, V> BTree<K, V> createInMemoryBTree( String name, String filePath, ElementSerializer<K> keySerializer,
+    public static <K, V> BTree<K, V> createInMemoryBTree( String name, String filePath,
+        ElementSerializer<K> keySerializer,
         ElementSerializer<V> valueSerializer )
     {
         InMemoryBTreeConfiguration<K, V> configuration = new InMemoryBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setFilePath( filePath );
         configuration.setKeySerializer( keySerializer );
@@ -382,7 +385,7 @@ public class BTreeFactory<K, V>
         return btree;
     }
 
-    
+
     /**
      * Creates a new in-memory BTree using the parameters to initialize the 
      * BTree
@@ -394,11 +397,12 @@ public class BTreeFactory<K, V>
      * @param pageSize Size of the page
      * @throws IOException
      */
-    public static <K, V> BTree<K, V> createInMemoryBTree( String name, String filePath, ElementSerializer<K> keySerializer,
+    public static <K, V> BTree<K, V> createInMemoryBTree( String name, String filePath,
+        ElementSerializer<K> keySerializer,
         ElementSerializer<V> valueSerializer, int pageSize )
     {
         InMemoryBTreeConfiguration<K, V> configuration = new InMemoryBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setFilePath( filePath );
         configuration.setKeySerializer( keySerializer );
@@ -411,8 +415,8 @@ public class BTreeFactory<K, V>
 
         return btree;
     }
-    
-    
+
+
     /**
      * Creates a new in-memory BTree using the parameters to initialize the 
      * BTree
@@ -425,11 +429,12 @@ public class BTreeFactory<K, V>
      * @param allowDuplicates Tells if the BTree allows multiple value for a given key
      * @throws IOException
      */
-    public static <K, V> BTree<K, V> createInMemoryBTree( String name, String filePath, ElementSerializer<K> keySerializer,
+    public static <K, V> BTree<K, V> createInMemoryBTree( String name, String filePath,
+        ElementSerializer<K> keySerializer,
         ElementSerializer<V> valueSerializer, int pageSize, boolean allowDuplicates )
     {
         InMemoryBTreeConfiguration<K, V> configuration = new InMemoryBTreeConfiguration<K, V>();
-        
+
         configuration.setName( name );
         configuration.setFilePath( filePath );
         configuration.setKeySerializer( keySerializer );
@@ -456,7 +461,7 @@ public class BTreeFactory<K, V>
      * 
      * @return A Leaf instance
      */
-    /* no qualifier*/ static <K, V> Page<K, V> createLeaf( BTree<K, V> btree, long revision, int nbElems )
+    /* no qualifier*/static <K, V> Page<K, V> createLeaf( BTree<K, V> btree, long revision, int nbElems )
     {
         if ( btree.getType() == BTreeTypeEnum.PERSISTED )
         {
@@ -467,8 +472,8 @@ public class BTreeFactory<K, V>
             return new InMemoryLeaf<K, V>( btree, revision, nbElems );
         }
     }
-    
-    
+
+
     /**
      * Create a new Node for the given BTree.
      * 
@@ -477,7 +482,7 @@ public class BTreeFactory<K, V>
      * @param nbElems The number or elements in this node
      * @return A Node instance
      */
-    /* no qualifier*/ static <K, V> Page<K, V> createNode( BTree<K, V> btree, long revision, int nbElems )
+    /* no qualifier*/static <K, V> Page<K, V> createNode( BTree<K, V> btree, long revision, int nbElems )
     {
         if ( btree.getType() == BTreeTypeEnum.PERSISTED )
         {
@@ -501,10 +506,10 @@ public class BTreeFactory<K, V>
      * @param pos The position in the keys array
      * @param key The key to inject
      */
-    /* no qualifier*/ static <K, V> void setKey( BTree<K, V> btree, Page<K, V> page, int pos, K key )
+    /* no qualifier*/static <K, V> void setKey( BTree<K, V> btree, Page<K, V> page, int pos, K key )
     {
         KeyHolder<K> keyHolder;
-        
+
         if ( btree.getType() == BTreeTypeEnum.PERSISTED )
         {
             keyHolder = new PersistedKeyHolder<K>( btree.getKeySerializer(), key );
@@ -523,15 +528,15 @@ public class BTreeFactory<K, V>
      * @param pos The position in the values array
      * @param value the value to inject
      */
-    /* no qualifier*/ static <K, V> void setValue( BTree<K, V> btree, Page<K, V> page, int pos, ValueHolder<V> value )
+    /* no qualifier*/static <K, V> void setValue( BTree<K, V> btree, Page<K, V> page, int pos, ValueHolder<V> value )
     {
         if ( btree.getType() == BTreeTypeEnum.PERSISTED )
         {
-            ((PersistedLeaf<K, V>)page).setValue( pos, value );
+            ( ( PersistedLeaf<K, V> ) page ).setValue( pos, value );
         }
         else
         {
-            ((InMemoryLeaf<K, V>)page).setValue( pos, value );
+            ( ( InMemoryLeaf<K, V> ) page ).setValue( pos, value );
         }
     }
 
@@ -544,18 +549,18 @@ public class BTreeFactory<K, V>
      * @param pos The position in the values array
      * @param value the value to inject
      */
-    /* no qualifier*/ static <K, V> void setPage( BTree<K, V> btree, Page<K, V> page, int pos, Page<K, V> child )
+    /* no qualifier*/static <K, V> void setPage( BTree<K, V> btree, Page<K, V> page, int pos, Page<K, V> child )
     {
         if ( btree.getType() == BTreeTypeEnum.PERSISTED )
         {
-            ((PersistedNode<K, V>)page).setValue( pos, new PersistedPageHolder<K, V>( btree, child ) );
+            ( ( PersistedNode<K, V> ) page ).setValue( pos, new PersistedPageHolder<K, V>( btree, child ) );
         }
         else
         {
-            ((InMemoryNode<K, V>)page).setPageHolder( pos, new PageHolder<K, V>( btree, child ) );
+            ( ( InMemoryNode<K, V> ) page ).setPageHolder( pos, new PageHolder<K, V>( btree, child ) );
         }
     }
-    
+
 
     //--------------------------------------------------------------------------------------------
     // Update BTree
@@ -569,7 +574,7 @@ public class BTreeFactory<K, V>
      * @throws InstantiationException 
      * @throws IllegalAccessException
      */
-    /* no qualifier*/ static <K, V> void setKeySerializer( BTree<K, V> btree, String keySerializerFqcn )
+    /* no qualifier*/static <K, V> void setKeySerializer( BTree<K, V> btree, String keySerializerFqcn )
         throws ClassNotFoundException, IllegalAccessException, InstantiationException
     {
         Class<?> keySerializer = Class.forName( keySerializerFqcn );
@@ -588,7 +593,7 @@ public class BTreeFactory<K, V>
      * @throws InstantiationException 
      * @throws IllegalAccessException
      */
-    /* no qualifier*/ static <K, V> void setValueSerializer( BTree<K, V> btree, String valueSerializerFqcn )
+    /* no qualifier*/static <K, V> void setValueSerializer( BTree<K, V> btree, String valueSerializerFqcn )
         throws ClassNotFoundException, IllegalAccessException, InstantiationException
     {
         Class<?> valueSerializer = Class.forName( valueSerializerFqcn );
@@ -597,7 +602,7 @@ public class BTreeFactory<K, V>
         btree.setValueSerializer( instance );
     }
 
-    
+
     /**
      * Set the new root page for this tree. Used for debug purpose only. The revision
      * will always be 0;
@@ -605,9 +610,9 @@ public class BTreeFactory<K, V>
      * @param btree The BTree to update
      * @param root the new root page.
      */
-    /* no qualifier*/ static <K, V> void setRootPage( BTree<K, V> btree, Page<K, V> root )
+    /* no qualifier*/static <K, V> void setRootPage( BTree<K, V> btree, Page<K, V> root )
     {
-        ((AbstractBTree<K, V>)btree).setRootPage( root );
+        ( ( AbstractBTree<K, V> ) btree ).setRootPage( root );
     }
 
 
@@ -617,12 +622,12 @@ public class BTreeFactory<K, V>
      * @param btree The Btree we want to root page from
      * @return The root page
      */
-    /* no qualifier */ static <K, V> Page<K, V> getRootPage( BTree<K, V> btree )
+    /* no qualifier */static <K, V> Page<K, V> getRootPage( BTree<K, V> btree )
     {
         return btree.getRootPage();
     }
-    
-    
+
+
     /**
      * update the BTree number of elements
      * 
@@ -631,7 +636,7 @@ public class BTreeFactory<K, V>
      */
     /* no qualifier */static <K, V> void setNbElems( BTree<K, V> btree, long nbElems )
     {
-        ((AbstractBTree<K, V>)btree).setNbElems( nbElems );
+        ( ( AbstractBTree<K, V> ) btree ).setNbElems( nbElems );
     }
 
 
@@ -643,7 +648,7 @@ public class BTreeFactory<K, V>
      */
     /* no qualifier*/static <K, V> void setRevision( BTree<K, V> btree, long revision )
     {
-        ((AbstractBTree<K, V>)btree).setRevision( revision );
+        ( ( AbstractBTree<K, V> ) btree ).setRevision( revision );
     }
 
 
@@ -653,7 +658,7 @@ public class BTreeFactory<K, V>
      * @param btree The BTree to update
      * @param name the name to set
      */
-    /* no qualifier */ static <K, V> void setName( BTree<K, V> btree, String name )
+    /* no qualifier */static <K, V> void setName( BTree<K, V> btree, String name )
     {
         btree.setName( name );
     }
@@ -665,7 +670,7 @@ public class BTreeFactory<K, V>
      * @param btree The BTree to update
      * @param pageSize The requested page size
      */
-    /* no qualifier */ static <K, V> void setPageSize( BTree<K, V> btree, int pageSize )
+    /* no qualifier */static <K, V> void setPageSize( BTree<K, V> btree, int pageSize )
     {
         btree.setPageSize( pageSize );
     }
@@ -680,7 +685,7 @@ public class BTreeFactory<K, V>
      * @param btree the btree
      * @return a LinkedList of all the nodes and the final leaf
      */
-    /* no qualifier*/ static <K, V> LinkedList<ParentPos<K, V>> getPathToRightMostLeaf( BTree<K, V> btree )
+    /* no qualifier*/static <K, V> LinkedList<ParentPos<K, V>> getPathToRightMostLeaf( BTree<K, V> btree )
     {
         LinkedList<ParentPos<K, V>> stack = new LinkedList<ParentPos<K, V>>();
 
@@ -690,7 +695,7 @@ public class BTreeFactory<K, V>
         if ( btree.getRootPage().isLeaf() )
         {
             Page<K, V> leaf = btree.getRootPage();
-            ValueHolder<V> valueHolder = ((AbstractPage<K, V>)leaf).getValue( last.pos );
+            ValueHolder<V> valueHolder = ( ( AbstractPage<K, V> ) leaf ).getValue( last.pos );
             last.valueCursor = valueHolder.getCursor();
         }
         else
@@ -699,7 +704,7 @@ public class BTreeFactory<K, V>
 
             while ( true )
             {
-                Page<K, V> p = ((AbstractPage<K, V>)node).getPage( node.getNbElems() );
+                Page<K, V> p = ( ( AbstractPage<K, V> ) node ).getPage( node.getNbElems() );
 
                 last = new ParentPos<K, V>( p, p.getNbElems() );
                 stack.push( last );
@@ -707,7 +712,7 @@ public class BTreeFactory<K, V>
                 if ( p.isLeaf() )
                 {
                     Page<K, V> leaf = last.page;
-                    ValueHolder<V> valueHolder = ((AbstractPage<K, V>)leaf).getValue( last.pos );
+                    ValueHolder<V> valueHolder = ( ( AbstractPage<K, V> ) leaf ).getValue( last.pos );
                     last.valueCursor = valueHolder.getCursor();
                     break;
                 }
@@ -716,8 +721,8 @@ public class BTreeFactory<K, V>
 
         return stack;
     }
-    
-    
+
+
     //--------------------------------------------------------------------------------------------
     // Persisted BTree methods
     //--------------------------------------------------------------------------------------------
@@ -731,7 +736,7 @@ public class BTreeFactory<K, V>
     {
         if ( btree instanceof PersistedBTree )
         {
-            ((PersistedBTree<K, V>)btree).setRootPageOffset( rootPageOffset );
+            ( ( PersistedBTree<K, V> ) btree ).setRootPageOffset( rootPageOffset );
         }
         else
         {
@@ -739,45 +744,45 @@ public class BTreeFactory<K, V>
         }
     }
 
-    
+
     /**
      * Set the nextBTree offset
      * 
      * @param btree The btree to update
      * @param nextBTreeOffset The nextBTreeOffset to set
      */
-    /* no qualifier*/ static <K, V> void setNextBTreeOffset( BTree<K, V> btree, long nextBTreeOffset )
+    /* no qualifier*/static <K, V> void setNextBTreeOffset( BTree<K, V> btree, long nextBTreeOffset )
     {
         if ( btree instanceof PersistedBTree )
         {
-            ((PersistedBTree<K, V>)btree).setNextBTreeOffset( nextBTreeOffset );
+            ( ( PersistedBTree<K, V> ) btree ).setNextBTreeOffset( nextBTreeOffset );
         }
         else
         {
             throw new IllegalArgumentException( "The BTree must be a PersistedBTree" );
         }
     }
-    
-    
+
+
     /**
      * Set the RecordManager
      * 
      * @param btree The btree to update
      * @param recordManager The injected RecordManager
      */
-    /* no qualifier*/ static <K, V> void setRecordManager( BTree<K, V> btree, RecordManager recordManager )
+    /* no qualifier*/static <K, V> void setRecordManager( BTree<K, V> btree, RecordManager recordManager )
     {
         if ( btree instanceof PersistedBTree )
         {
-            ((PersistedBTree<K, V>)btree).setRecordManager( recordManager );
+            ( ( PersistedBTree<K, V> ) btree ).setRecordManager( recordManager );
         }
         else
         {
             throw new IllegalArgumentException( "The BTree must be a PersistedBTree" );
         }
     }
-    
-    
+
+
     /**
      * Set the key at a give position
      * 
@@ -786,7 +791,7 @@ public class BTreeFactory<K, V>
      * @param pos The position of this key in the page
      * @param buffer The byte[] containing the serialized key
      */
-    /* no qualifier*/ static <K, V> void setKey( BTree<K, V> btree, Page<K, V> page, int pos, byte[] buffer )
+    /* no qualifier*/static <K, V> void setKey( BTree<K, V> btree, Page<K, V> page, int pos, byte[] buffer )
     {
         if ( btree instanceof PersistedBTree )
         {
@@ -798,49 +803,49 @@ public class BTreeFactory<K, V>
             throw new IllegalArgumentException( "The BTree must be a PersistedBTree" );
         }
     }
-    
-    
+
+
     /**
      * Includes the intermediate nodes in the path up to and including the left most leaf of the tree
      * 
      * @param btree The btree to process
      * @return a LinkedList of all the nodes and the final leaf
      */
-    /* no qualifier*/ static <K, V> LinkedList<ParentPos<K, V>> getPathToLeftMostLeaf( BTree<K, V> btree )
+    /* no qualifier*/static <K, V> LinkedList<ParentPos<K, V>> getPathToLeftMostLeaf( BTree<K, V> btree )
     {
         if ( btree instanceof PersistedBTree )
         {
             LinkedList<ParentPos<K, V>> stack = new LinkedList<ParentPos<K, V>>();
-    
+
             ParentPos<K, V> first = new ParentPos<K, V>( btree.getRootPage(), 0 );
             stack.push( first );
-    
+
             if ( btree.getRootPage().isLeaf() )
             {
                 Page<K, V> leaf = btree.getRootPage();
-                ValueHolder<V> valueHolder = ((AbstractPage<K, V>)leaf).getValue( first.pos );
+                ValueHolder<V> valueHolder = ( ( AbstractPage<K, V> ) leaf ).getValue( first.pos );
                 first.valueCursor = valueHolder.getCursor();
             }
             else
             {
                 Page<K, V> node = btree.getRootPage();
-    
+
                 while ( true )
                 {
-                    Page<K, V> page = ((AbstractPage<K, V>)node).getPage( 0 );
-    
+                    Page<K, V> page = ( ( AbstractPage<K, V> ) node ).getPage( 0 );
+
                     first = new ParentPos<K, V>( page, 0 );
                     stack.push( first );
-    
+
                     if ( page.isLeaf() )
                     {
-                        ValueHolder<V> valueHolder = ((AbstractPage<K, V>)page).getValue( first.pos );
+                        ValueHolder<V> valueHolder = ( ( AbstractPage<K, V> ) page ).getValue( first.pos );
                         first.valueCursor = valueHolder.getCursor();
                         break;
                     }
                 }
             }
-    
+
             return stack;
         }
         else

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BorrowedFromSiblingResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BorrowedFromSiblingResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BorrowedFromSiblingResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/BorrowedFromSiblingResult.java Wed Dec 18 11:12:48 2013
@@ -20,7 +20,6 @@
 package org.apache.directory.mavibot.btree;
 
 
-
 /**
  * The result of an delete operation, when we have borrowed some element from a sibling.
  * 

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Cursor.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Cursor.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Cursor.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Cursor.java Wed Dec 18 11:12:48 2013
@@ -38,8 +38,9 @@ import org.apache.directory.mavibot.btre
 public interface Cursor<K>
 {
     /** Static value for the beforeFrst and afterLast positions */
-    static final int BEFORE_FIRST = -1; 
-    static final int AFTER_LAST = -2; 
+    static final int BEFORE_FIRST = -1;
+    static final int AFTER_LAST = -2;
+
 
     /**
      * Tells if the cursor can return a next element

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/DeleteResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/DeleteResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/DeleteResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/DeleteResult.java Wed Dec 18 11:12:48 2013
@@ -20,8 +20,6 @@
 package org.apache.directory.mavibot.btree;
 
 
-
-
 /**
  * The result of an delete operation.
  * 

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTree.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTree.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTree.java Wed Dec 18 11:12:48 2013
@@ -80,7 +80,7 @@ import org.slf4j.LoggerFactory;
     /**
      * Creates a new BTree, with no initialization.
      */
-    /* no qualifier */ InMemoryBTree()
+    /* no qualifier */InMemoryBTree()
     {
         super();
         btreeHeader = new BTreeHeader();
@@ -94,7 +94,7 @@ import org.slf4j.LoggerFactory;
      *
      * @param configuration The configuration to use
      */
-    /* no qualifier */ InMemoryBTree( InMemoryBTreeConfiguration<K, V> configuration )
+    /* no qualifier */InMemoryBTree( InMemoryBTreeConfiguration<K, V> configuration )
     {
         super();
         String name = configuration.getName();
@@ -268,7 +268,7 @@ import org.slf4j.LoggerFactory;
             if ( result instanceof RemoveResult )
             {
                 // The element was found, and removed
-                RemoveResult<K, V> removeResult = (RemoveResult<K, V> ) result;
+                RemoveResult<K, V> removeResult = ( RemoveResult<K, V> ) result;
 
                 Page<K, V> modifiedPage = removeResult.getModifiedPage();
 
@@ -313,7 +313,7 @@ import org.slf4j.LoggerFactory;
      * @param revision The revision to use
      * @return an instance of the InsertResult.
      */
-    /* no qualifier */ InsertResult<K, V> insert( K key, V value, long revision ) throws IOException
+    /* no qualifier */InsertResult<K, V> insert( K key, V value, long revision ) throws IOException
     {
         if ( key == null )
         {
@@ -331,7 +331,7 @@ import org.slf4j.LoggerFactory;
 
         if ( result instanceof ModifyResult )
         {
-            ModifyResult<K, V> modifyResult = ( (ModifyResult<K, V> ) result );
+            ModifyResult<K, V> modifyResult = ( ( ModifyResult<K, V> ) result );
 
             Page<K, V> modifiedPage = modifyResult.getModifiedPage();
 
@@ -345,7 +345,7 @@ import org.slf4j.LoggerFactory;
         {
             // We have split the old root, create a new one containing
             // only the pivotal we got back
-            SplitResult<K, V> splitResult = ( (SplitResult<K, V> ) result );
+            SplitResult<K, V> splitResult = ( ( SplitResult<K, V> ) result );
 
             K pivot = splitResult.getPivot();
             Page<K, V> leftPage = splitResult.getLeftPage();

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTreeBuilder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTreeBuilder.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTreeBuilder.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryBTreeBuilder.java Wed Dec 18 11:12:48 2013
@@ -65,7 +65,7 @@ public class InMemoryBTreeBuilder<K, V>
 
         int totalTupleCount = 0;
 
-        InMemoryLeaf<K, V> leaf1 = (InMemoryLeaf<K, V>)BTreeFactory.createLeaf( btree, 0, numKeysInNode );
+        InMemoryLeaf<K, V> leaf1 = ( InMemoryLeaf<K, V> ) BTreeFactory.createLeaf( btree, 0, numKeysInNode );
         lstLeaves.add( leaf1 );
 
         int leafIndex = 0;
@@ -86,7 +86,7 @@ public class InMemoryBTreeBuilder<K, V>
             if ( ( totalTupleCount % numKeysInNode ) == 0 )
             {
                 leafIndex = 0;
-                leaf1 = (InMemoryLeaf<K, V>)BTreeFactory.createLeaf( btree, 0, numKeysInNode );
+                leaf1 = ( InMemoryLeaf<K, V> ) BTreeFactory.createLeaf( btree, 0, numKeysInNode );
                 lstLeaves.add( leaf1 );
             }
         }
@@ -97,7 +97,7 @@ public class InMemoryBTreeBuilder<K, V>
         }
 
         // remove null keys and values from the last leaf and resize
-        InMemoryLeaf<K, V> lastLeaf = (InMemoryLeaf<K, V> ) lstLeaves.get( lstLeaves.size() - 1 );
+        InMemoryLeaf<K, V> lastLeaf = ( InMemoryLeaf<K, V> ) lstLeaves.get( lstLeaves.size() - 1 );
 
         for ( int i = 0; i < lastLeaf.getNbElems(); i++ )
         {
@@ -111,7 +111,7 @@ public class InMemoryBTreeBuilder<K, V>
                 System.arraycopy( keys, 0, lastLeaf.getKeys(), 0, n );
 
                 ValueHolder<V>[] values = lastLeaf.values;
-                lastLeaf.values = (InMemoryValueHolder<V>[] ) Array.newInstance( InMemoryValueHolder.class, n );
+                lastLeaf.values = ( InMemoryValueHolder<V>[] ) Array.newInstance( InMemoryValueHolder.class, n );
                 System.arraycopy( values, 0, lastLeaf.values, 0, n );
 
                 break;
@@ -120,9 +120,9 @@ public class InMemoryBTreeBuilder<K, V>
 
         Page<K, V> rootPage = attachNodes( lstLeaves, btree );
 
-        System.out.println("built rootpage : " + rootPage);
+        System.out.println( "built rootpage : " + rootPage );
 
-        ((AbstractBTree<K, V>)btree).setRootPage( rootPage );
+        ( ( AbstractBTree<K, V> ) btree ).setRootPage( rootPage );
 
         return btree;
     }
@@ -140,7 +140,7 @@ public class InMemoryBTreeBuilder<K, V>
 
         int numChildren = numKeysInNode + 1;
 
-        InMemoryNode<K, V> node = (InMemoryNode<K, V>)BTreeFactory.createNode( btree, 0, numKeysInNode );
+        InMemoryNode<K, V> node = ( InMemoryNode<K, V> ) BTreeFactory.createNode( btree, 0, numKeysInNode );
         lstNodes.add( node );
         int i = 0;
         int totalNodes = 0;
@@ -160,7 +160,7 @@ public class InMemoryBTreeBuilder<K, V>
             if ( ( totalNodes % numChildren ) == 0 )
             {
                 i = 0;
-                node = (InMemoryNode<K, V>)BTreeFactory.createNode( btree, 0, numKeysInNode );
+                node = ( InMemoryNode<K, V> ) BTreeFactory.createNode( btree, 0, numKeysInNode );
                 lstNodes.add( node );
             }
         }

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryLeaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryLeaf.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryLeaf.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryLeaf.java Wed Dec 18 11:12:48 2013
@@ -65,7 +65,7 @@ import org.apache.directory.mavibot.btre
     {
         super( btree, revision, nbElems );
 
-        this.values = (InMemoryValueHolder<V>[] ) Array.newInstance( InMemoryValueHolder.class, nbElems );
+        this.values = ( InMemoryValueHolder<V>[] ) Array.newInstance( InMemoryValueHolder.class, nbElems );
     }
 
 
@@ -215,7 +215,8 @@ 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( parent, parentPos );
-                InMemoryLeaf<K, V> sibling = (InMemoryLeaf<K, V> ) ( ( (InMemoryNode<K, V> ) parent ).getPage( siblingPos ) );
+                InMemoryLeaf<K, V> sibling = ( InMemoryLeaf<K, V> ) ( ( ( InMemoryNode<K, V> ) parent )
+                    .getPage( siblingPos ) );
 
                 if ( sibling.getNbElems() == halfSize )
                 {
@@ -343,7 +344,8 @@ import org.apache.directory.mavibot.btre
      * @return The resulting pages
      * @throws IOException If we have an error while trying to access the page
      */
-    private DeleteResult<K, V> borrowFromLeft( Tuple<K, V> removedElement, long revision, InMemoryLeaf<K, V> sibling, int pos )
+    private DeleteResult<K, V> borrowFromLeft( Tuple<K, V> removedElement, long revision, InMemoryLeaf<K, V> sibling,
+        int pos )
         throws IOException
     {
         // The sibling is on the left, borrow the rightmost element
@@ -351,7 +353,7 @@ import org.apache.directory.mavibot.btre
         ValueHolder<V> siblingValue = sibling.values[sibling.getNbElems() - 1];
 
         // Create the new sibling, with one less element at the end
-        InMemoryLeaf<K, V> newSibling = (InMemoryLeaf<K, V> ) sibling.copy( revision, sibling.getNbElems() - 1 );
+        InMemoryLeaf<K, V> newSibling = ( InMemoryLeaf<K, V> ) sibling.copy( revision, sibling.getNbElems() - 1 );
 
         // Create the new page and add the new element at the beginning
         // First copy the current page, with the same size
@@ -390,7 +392,8 @@ import org.apache.directory.mavibot.btre
      * @return The resulting pages
      * @throws IOException If we have an error while trying to access the page
      */
-    private DeleteResult<K, V> borrowFromRight( Tuple<K, V> removedElement, long revision, InMemoryLeaf<K, V> sibling, int pos )
+    private DeleteResult<K, V> borrowFromRight( Tuple<K, V> removedElement, long revision, InMemoryLeaf<K, V> sibling,
+        int pos )
         throws IOException
     {
         // The sibling is on the left, borrow the rightmost element
@@ -475,7 +478,7 @@ import org.apache.directory.mavibot.btre
 
         if ( pos < 0 )
         {
-            InMemoryValueHolder<V> valueHolder = (InMemoryValueHolder<V> ) values[-( pos + 1 )];
+            InMemoryValueHolder<V> valueHolder = ( InMemoryValueHolder<V> ) values[-( pos + 1 )];
 
             V value = valueHolder.getCursor().next();
 
@@ -503,7 +506,7 @@ import org.apache.directory.mavibot.btre
 
         if ( pos < 0 )
         {
-            InMemoryValueHolder<V> valueHolder = (InMemoryValueHolder<V> ) values[-( pos + 1 )];
+            InMemoryValueHolder<V> valueHolder = ( InMemoryValueHolder<V> ) values[-( pos + 1 )];
 
             return valueHolder.getCursor();
         }
@@ -726,7 +729,7 @@ import org.apache.directory.mavibot.btre
         if ( this.revision != revision )
         {
             // The page hasn't been modified yet, we need to copy it first
-            newLeaf = (InMemoryLeaf<K, V> ) copy( revision, nbElems );
+            newLeaf = ( InMemoryLeaf<K, V> ) copy( revision, nbElems );
         }
 
         // Get the previous value from the leaf (it's a copy)
@@ -989,7 +992,7 @@ import org.apache.directory.mavibot.btre
                     sb.append( ", " );
                 }
 
-                sb.append( "<" ).append( getKey( i) ).append( "," ).append( values[i] ).append( ">" );
+                sb.append( "<" ).append( getKey( i ) ).append( "," ).append( values[i] ).append( ">" );
             }
         }
 

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryNode.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryNode.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryNode.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InMemoryNode.java Wed Dec 18 11:12:48 2013
@@ -112,13 +112,13 @@ import java.util.List;
         if ( result instanceof ModifyResult )
         {
             // The child has been modified.
-            return replaceChild( revision, (ModifyResult<K, V> ) result, pos );
+            return replaceChild( revision, ( ModifyResult<K, V> ) result, pos );
         }
         else
         {
             // The child has been split. We have to insert the new pivot in the
             // current page, and to reference the two new pages
-            SplitResult<K, V> splitResult = (SplitResult<K, V> ) result;
+            SplitResult<K, V> splitResult = ( SplitResult<K, V> ) result;
             K pivot = splitResult.getPivot();
             Page<K, V> leftPage = splitResult.getLeftPage();
             Page<K, V> rightPage = splitResult.getRightPage();
@@ -556,7 +556,7 @@ import java.util.List;
         // If we just modified the child, return a modified page
         if ( deleteResult instanceof RemoveResult )
         {
-            RemoveResult<K, V> removeResult = handleRemoveResult( (RemoveResult<K, V> ) deleteResult, index, pos,
+            RemoveResult<K, V> removeResult = handleRemoveResult( ( RemoveResult<K, V> ) deleteResult, index, pos,
                 found );
 
             return removeResult;
@@ -566,7 +566,7 @@ import java.util.List;
         // the current page
         if ( deleteResult instanceof BorrowedFromSiblingResult )
         {
-            RemoveResult<K, V> removeResult = handleBorrowedResult( (BorrowedFromSiblingResult<K, V> ) deleteResult,
+            RemoveResult<K, V> removeResult = handleBorrowedResult( ( BorrowedFromSiblingResult<K, V> ) deleteResult,
                 pos );
 
             return removeResult;
@@ -576,7 +576,7 @@ import java.util.List;
         // an element from the local page, and to deal with the result.
         if ( deleteResult instanceof MergedWithSiblingResult )
         {
-            MergedWithSiblingResult<K, V> mergedResult = (MergedWithSiblingResult<K, V> ) deleteResult;
+            MergedWithSiblingResult<K, V> mergedResult = ( MergedWithSiblingResult<K, V> ) deleteResult;
 
             // If the parent is null, then this page is the root page.
             if ( parent == null )
@@ -604,9 +604,10 @@ import java.util.List;
                 // We will remove one element from a page that will have less than N/2 elements,
                 // which will lead to some reorganization : either we can borrow an element from
                 // a sibling, or we will have to merge two pages
-                int siblingPos = selectSibling( (InMemoryNode<K, V> ) parent, parentPos );
+                int siblingPos = selectSibling( ( InMemoryNode<K, V> ) parent, parentPos );
 
-                InMemoryNode<K, V> sibling = (InMemoryNode<K, V> ) ( ( (InMemoryNode<K, V> ) parent ).children[siblingPos].getValue() );
+                InMemoryNode<K, V> sibling = ( InMemoryNode<K, V> ) ( ( ( InMemoryNode<K, V> ) parent ).children[siblingPos]
+                    .getValue() );
 
                 if ( sibling.getNbElems() > halfSize )
                 {
@@ -809,7 +810,7 @@ import java.util.List;
         // to point on the modified child
         Page<K, V> modifiedPage = result.getModifiedPage();
 
-        ( (InMemoryNode<K, V> ) newPage ).children[pos] = new PageHolder<K, V>( btree, modifiedPage );
+        ( ( InMemoryNode<K, V> ) newPage ).children[pos] = new PageHolder<K, V>( btree, modifiedPage );
 
         // We can return the result, where we update the modifiedPage,
         // to avoid the creation of a new object
@@ -921,7 +922,8 @@ import java.util.List;
             System.arraycopy( children, middle, newRightPage.children, 0, middle + 1 );
 
             // Create the result
-            InsertResult<K, V> result = new SplitResult<K, V>( copiedPages, getKey( middle - 1 ), newLeftPage, newRightPage );
+            InsertResult<K, V> result = new SplitResult<K, V>( copiedPages, getKey( middle - 1 ), newLeftPage,
+                newRightPage );
             result.addCopiedPage( this );
 
             return result;
@@ -1017,8 +1019,8 @@ import java.util.List;
 
         return children[nbElems - 1].getValue().getRightMostKey();
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -1026,8 +1028,8 @@ import java.util.List;
     {
         return false;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InsertResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InsertResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InsertResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/InsertResult.java Wed Dec 18 11:12:48 2013
@@ -20,8 +20,6 @@
 package org.apache.directory.mavibot.btree;
 
 
-
-
 /**
  * The result of an insert operation. This is just a container that stores either
  * the new pivot that has been extracted after a page split, or a modified page if

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/KeyHolder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/KeyHolder.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/KeyHolder.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/KeyHolder.java Wed Dec 18 11:12:48 2013
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mavibot.btree;
 
+
 /**
  * The data structure holding a key and the way to access it
  * 
@@ -41,8 +42,8 @@ package org.apache.directory.mavibot.btr
     {
         this.key = key;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -51,7 +52,7 @@ package org.apache.directory.mavibot.btr
         this.key = key;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ModifyResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ModifyResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ModifyResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ModifyResult.java Wed Dec 18 11:12:48 2013
@@ -78,7 +78,7 @@ import java.util.List;
         return modifiedPage;
     }
 
-    
+
     /**
      * Set the modified page
      * @param modifiedPage The new modified page

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/NotPresentResult.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/NotPresentResult.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/NotPresentResult.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/NotPresentResult.java Wed Dec 18 11:12:48 2013
@@ -20,8 +20,6 @@
 package org.apache.directory.mavibot.btree;
 
 
-
-
 /**
  * The result of an delete operation, when the key to delete is not present in the tree.
  * 

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Page.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Page.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Page.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/Page.java Wed Dec 18 11:12:48 2013
@@ -256,15 +256,15 @@ import org.apache.directory.mavibot.btre
      * @throws IOException If we have an error while trying to access the page
      */
     boolean hasKey( K key ) throws IOException;
-    
-    
+
+
     /**
      * Tells if the page is a leaf or not
      * @return true if the page is a leaf
      */
     boolean isLeaf();
-    
-    
+
+
     /**
      * Tells if the page is a node or not
      * @return true if the page is a node

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PageHolder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PageHolder.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PageHolder.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PageHolder.java Wed Dec 18 11:12:48 2013
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mavibot.btree;
 
+
 /**
  * A Page holder. It stores the page and provide a way to access it.
  * 
@@ -31,10 +32,11 @@ package org.apache.directory.mavibot.btr
 {
     /** The BTree */
     protected BTree<K, V> btree;
-    
+
     /** The stored page */
     private Page<K, V> page;
 
+
     /**
      * Create a new holder storing an offset and a SoftReference containing the element.
      * 
@@ -47,7 +49,7 @@ package org.apache.directory.mavibot.btr
         this.page = page;
     }
 
-    
+
     /**
      * @return the stored page
      */

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ParentPos.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ParentPos.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ParentPos.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/ParentPos.java Wed Dec 18 11:12:48 2013
@@ -20,7 +20,6 @@
 package org.apache.directory.mavibot.btree;
 
 
-
 /**
  * This class is used to store the parent page and the position in it during
  * a browse operation. We have as many ParentPos instance than the depth of the tree.

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java Wed Dec 18 11:12:48 2013
@@ -78,7 +78,7 @@ public class PersistedBTree<K, V> extend
     /**
      * Creates a new BTree, with no initialization. 
      */
-    /* no qualifier */ PersistedBTree()
+    /* no qualifier */PersistedBTree()
     {
         btreeHeader = new BTreeHeader();
         setType( BTreeTypeEnum.PERSISTED );
@@ -91,7 +91,7 @@ public class PersistedBTree<K, V> extend
      * 
      * @param configuration The configuration to use
      */
-    /* no qualifier */ PersistedBTree( PersistedBTreeConfiguration<K, V> configuration )
+    /* no qualifier */PersistedBTree( PersistedBTreeConfiguration<K, V> configuration )
     {
         super();
         String name = configuration.getName();
@@ -126,12 +126,12 @@ public class PersistedBTree<K, V> extend
         // Create the first root page, with revision 0L. It will be empty
         // and increment the revision at the same time
         rootPage = new PersistedLeaf<K, V>( this );
-        
+
         if ( isSubBtree )
         {
             // The subBTree inherit its cache from its parent BTree
-            this.cache = ((PersistedBTree<K, V>)configuration.getParentBTree()).getCache();
-            this.writeLock = ((PersistedBTree<K, V>)configuration.getParentBTree()).getWriteLock();
+            this.cache = ( ( PersistedBTree<K, V> ) configuration.getParentBTree() ).getCache();
+            this.writeLock = ( ( PersistedBTree<K, V> ) configuration.getParentBTree() ).getWriteLock();
             readTransactions = new ConcurrentLinkedQueue<Transaction<K, V>>();
         }
 
@@ -153,9 +153,9 @@ public class PersistedBTree<K, V> extend
 
             // Create the queue containing the pending read transactions
             readTransactions = new ConcurrentLinkedQueue<Transaction<K, V>>();
-    
+
             writeLock = new ReentrantLock();
-    
+
             // Initialize the caches
             CacheConfiguration cacheConfiguration = new CacheConfiguration();
             cacheConfiguration.setName( "pages" );
@@ -164,7 +164,7 @@ public class PersistedBTree<K, V> extend
             cacheConfiguration.setCacheLoaderTimeoutMillis( 0 );
             cacheConfiguration.setMaxElementsInMemory( cacheSize );
             cacheConfiguration.setMemoryStoreEvictionPolicy( "LRU" );
-    
+
             cache = new Cache( cacheConfiguration );
             cache.initialise();
         }
@@ -210,13 +210,13 @@ public class PersistedBTree<K, V> extend
         // Stop the readTransaction thread
         // readTransactionsThread.interrupt();
         // readTransactions.clear();
-        
+
         // Clean the cache
         if ( cache.getStatus() == Status.STATUS_ALIVE )
         {
             cache.removeAll();
         }
-        
+
         cache.dispose();
 
         rootPage = null;
@@ -348,12 +348,12 @@ public class PersistedBTree<K, V> extend
                     revision );
 
                 // Store the offset on disk in the page in memory
-                ( ( AbstractPage<K, V> ) modifiedPage ).setOffset( ( (PersistedPageHolder<K, V> ) holder )
+                ( ( AbstractPage<K, V> ) modifiedPage ).setOffset( ( ( PersistedPageHolder<K, V> ) holder )
                     .getOffset() );
 
                 // Store the last offset on disk in the page in memory
                 ( ( AbstractPage<K, V> ) modifiedPage )
-                    .setLastOffset( ( (PersistedPageHolder<K, V> ) holder )
+                    .setLastOffset( ( ( PersistedPageHolder<K, V> ) holder )
                         .getLastOffset() );
 
                 // This is a new root
@@ -403,7 +403,7 @@ public class PersistedBTree<K, V> extend
      * @param revision The revision to use
      * @return an instance of the InsertResult.
      */
-    /* no qualifier */ InsertResult<K, V> insert( K key, V value, long revision ) throws IOException
+    /* no qualifier */InsertResult<K, V> insert( K key, V value, long revision ) throws IOException
     {
         if ( key == null )
         {
@@ -430,7 +430,7 @@ public class PersistedBTree<K, V> extend
             // remain in memory.
             PersistedPageHolder<K, V> holder = recordManager.writePage( this, modifiedPage,
                 revision );
-            
+
             // The root has just been modified, we haven't split it
             // Get it and make it the current root page
             rootPage = modifiedPage;

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilder.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilder.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeBuilder.java Wed Dec 18 11:12:48 2013
@@ -20,6 +20,7 @@
 
 package org.apache.directory.mavibot.btree;
 
+
 import java.io.IOException;
 import java.lang.reflect.Array;
 import java.util.ArrayList;
@@ -47,6 +48,7 @@ public class PersistedBTreeBuilder<K, V>
 
     private RecordManager rm;
 
+
     public PersistedBTreeBuilder( RecordManager rm, String name, int numKeysInNode, ElementSerializer<K> keySerializer,
         ElementSerializer<V> valueSerializer )
     {
@@ -69,7 +71,7 @@ public class PersistedBTreeBuilder<K, V>
 
         int totalTupleCount = 0;
 
-        PersistedLeaf<K, V> leaf1 = (PersistedLeaf<K, V>)BTreeFactory.createLeaf( btree, 0, numKeysInNode );
+        PersistedLeaf<K, V> leaf1 = ( PersistedLeaf<K, V> ) BTreeFactory.createLeaf( btree, 0, numKeysInNode );
         lstLeaves.add( leaf1 );
 
         int leafIndex = 0;
@@ -92,7 +94,7 @@ public class PersistedBTreeBuilder<K, V>
 
                 PersistedPageHolder<K, V> pageHolder = rm.writePage( btree, leaf1, 1 );
 
-                leaf1 = (PersistedLeaf<K, V>)BTreeFactory.createLeaf( btree, 0, numKeysInNode );
+                leaf1 = ( PersistedLeaf<K, V> ) BTreeFactory.createLeaf( btree, 0, numKeysInNode );
                 lstLeaves.add( leaf1 );
             }
 
@@ -105,7 +107,7 @@ public class PersistedBTreeBuilder<K, V>
         }
 
         // remove null keys and values from the last leaf and resize
-        PersistedLeaf<K, V> lastLeaf = (PersistedLeaf<K, V> ) lstLeaves.get( lstLeaves.size() - 1 );
+        PersistedLeaf<K, V> lastLeaf = ( PersistedLeaf<K, V> ) lstLeaves.get( lstLeaves.size() - 1 );
         for ( int i = 0; i < lastLeaf.getNbElems(); i++ )
         {
             if ( lastLeaf.getKey( i ) == null )
@@ -118,7 +120,7 @@ public class PersistedBTreeBuilder<K, V>
                 System.arraycopy( keys, 0, lastLeaf.getKeys(), 0, n );
 
                 ValueHolder<V>[] values = lastLeaf.values;
-                lastLeaf.values = (PersistedValueHolder<V>[] ) Array.newInstance( PersistedValueHolder.class, n );
+                lastLeaf.values = ( PersistedValueHolder<V>[] ) Array.newInstance( PersistedValueHolder.class, n );
                 System.arraycopy( values, 0, lastLeaf.values, 0, n );
 
                 PersistedPageHolder<K, V> pageHolder = rm.writePage( btree, lastLeaf, 1 );
@@ -132,13 +134,13 @@ public class PersistedBTreeBuilder<K, V>
         Page<K, V> rootPage = attachNodes( lstLeaves, btree );
 
         //System.out.println("built rootpage : " + rootPage);
-        ((PersistedBTree<K, V>)btree).setNbElems( totalTupleCount );
+        ( ( PersistedBTree<K, V> ) btree ).setNbElems( totalTupleCount );
 
         rm.updateBtreeHeader( btree, ( ( AbstractPage<K, V> ) rootPage ).getOffset() );
 
         rm.addFreePages( btree, Arrays.asList( btree.getRootPage() ) );
 
-        ((AbstractBTree<K, V>)btree).setRootPage( rootPage );
+        ( ( AbstractBTree<K, V> ) btree ).setRootPage( rootPage );
 
         return btree;
     }
@@ -156,7 +158,7 @@ public class PersistedBTreeBuilder<K, V>
 
         int numChildren = numKeysInNode + 1;
 
-        PersistedNode<K, V> node = (PersistedNode<K, V>)BTreeFactory.createNode( btree, 0, numKeysInNode );
+        PersistedNode<K, V> node = ( PersistedNode<K, V> ) BTreeFactory.createNode( btree, 0, numKeysInNode );
         lstNodes.add( node );
         int i = 0;
         int totalNodes = 0;
@@ -179,7 +181,7 @@ public class PersistedBTreeBuilder<K, V>
 
                 PersistedPageHolder<K, V> pageHolder = rm.writePage( btree, node, 1 );
 
-                node = (PersistedNode<K, V>)BTreeFactory.createNode( btree, 0, numKeysInNode );
+                node = ( PersistedNode<K, V> ) BTreeFactory.createNode( btree, 0, numKeysInNode );
                 lstNodes.add( node );
             }
         }

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeConfiguration.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeConfiguration.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeConfiguration.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTreeConfiguration.java Wed Dec 18 11:12:48 2013
@@ -65,16 +65,17 @@ public class PersistedBTreeConfiguration
 
     /** Flag to enable duplicate key support */
     private boolean allowDuplicates;
-    
+
     /** A flag set when the BTree is a sub btree */
     private boolean isSubBtree = false;
 
     /** The cache size, if it's <= 0, we don't have cache */
     private int cacheSize;
-    
+
     /** The inherited BTree if we create a sub BTree */
     private BTree<?, V> parentBTree;
-    
+
+
     /**
      * @return the pageSize
      */

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java?rev=1551913&r1=1551912&r2=1551913&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java (original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java Wed Dec 18 11:12:48 2013
@@ -205,7 +205,8 @@ 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( parent, parentPos );
-                PersistedLeaf<K, V> sibling = (PersistedLeaf<K, V> ) ( ( (PersistedNode<K, V> ) parent ).getPage( siblingPos ) );
+                PersistedLeaf<K, V> sibling = ( PersistedLeaf<K, V> ) ( ( ( PersistedNode<K, V> ) parent )
+                    .getPage( siblingPos ) );
 
                 if ( sibling.getNbElems() == halfSize )
                 {
@@ -286,7 +287,8 @@ import org.apache.directory.mavibot.btre
      * @return The new created leaf containing the sibling and the old page.
      * @throws IOException If we have an error while trying to access the page
      */
-    private DeleteResult<K, V> mergeWithSibling( Tuple<K, V> removedElement, long revision, PersistedLeaf<K, V> sibling,
+    private DeleteResult<K, V> mergeWithSibling( Tuple<K, V> removedElement, long revision,
+        PersistedLeaf<K, V> sibling,
         boolean isLeft, int pos )
         throws EndOfFileExceededException, IOException
     {
@@ -346,7 +348,8 @@ import org.apache.directory.mavibot.btre
      * @return The resulting pages
      * @throws IOException If we have an error while trying to access the page
      */
-    private DeleteResult<K, V> borrowFromLeft( Tuple<K, V> removedElement, long revision, PersistedLeaf<K, V> sibling, int pos )
+    private DeleteResult<K, V> borrowFromLeft( Tuple<K, V> removedElement, long revision, PersistedLeaf<K, V> sibling,
+        int pos )
         throws IOException
     {
         // The sibling is on the left, borrow the rightmost element
@@ -354,7 +357,7 @@ import org.apache.directory.mavibot.btre
         ValueHolder<V> siblingValue = sibling.values[sibling.getNbElems() - 1];
 
         // Create the new sibling, with one less element at the end
-        PersistedLeaf<K, V> newSibling = (PersistedLeaf<K, V> ) sibling.copy( revision, sibling.getNbElems() - 1 );
+        PersistedLeaf<K, V> newSibling = ( PersistedLeaf<K, V> ) sibling.copy( revision, sibling.getNbElems() - 1 );
 
         // Create the new page and add the new element at the beginning
         // First copy the current page, with the same size
@@ -393,7 +396,8 @@ import org.apache.directory.mavibot.btre
      * @return The resulting pages
      * @throws IOException If we have an error while trying to access the page
      */
-    private DeleteResult<K, V> borrowFromRight( Tuple<K, V> removedElement, long revision, PersistedLeaf<K, V> sibling, int pos )
+    private DeleteResult<K, V> borrowFromRight( Tuple<K, V> removedElement, long revision, PersistedLeaf<K, V> sibling,
+        int pos )
         throws IOException
     {
         // The sibling is on the left, borrow the rightmost element
@@ -441,7 +445,8 @@ import org.apache.directory.mavibot.btre
      * @param pos The position into the page of the element to remove
      * @throws IOException If we have an error while trying to access the page
      */
-    private void copyAfterRemovingElement( boolean keyRemoved, V removedValue, PersistedLeaf<K, V> newLeaf, int pos ) throws IOException
+    private void copyAfterRemovingElement( boolean keyRemoved, V removedValue, PersistedLeaf<K, V> newLeaf, int pos )
+        throws IOException
     {
         if ( keyRemoved )
         {
@@ -795,7 +800,7 @@ import org.apache.directory.mavibot.btre
         if ( this.revision != revision )
         {
             // The page hasn't been modified yet, we need to copy it first
-            newLeaf = (PersistedLeaf<K, V> ) copy( revision, nbElems );
+            newLeaf = ( PersistedLeaf<K, V> ) copy( revision, nbElems );
         }
 
         // Get the previous value from the leaf (it's a copy)



Mime
View raw message