You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/20 17:24:24 UTC
svn commit: r1233987 -
/directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java
Author: elecharny
Date: Fri Jan 20 16:24:24 2012
New Revision: 1233987
URL: http://svn.apache.org/viewvc?rev=1233987&view=rev
Log:
o Fixed another error in the addAndSplit method
o Removed commented code
Modified:
directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java
Modified: directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java
URL: http://svn.apache.org/viewvc/directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java?rev=1233987&r1=1233986&r2=1233987&view=diff
==============================================================================
--- directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java (original)
+++ directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java Fri Jan 20 16:24:24 2012
@@ -45,7 +45,7 @@ public class Page<K, V> implements Clone
/** Values associated with keys */
private V[] values;
- /** Children pages (recids) associated with keys. (Only valid if non-leaf BPage) */
+ /** Children pages associated with keys. (Only valid if non-leaf BPage) */
private Page<K, V>[] children;
/** The number of elements in each child */
@@ -500,48 +500,6 @@ public class Page<K, V> implements Clone
}
- /*
- private InsertResult<K, V> split( long revision, OverflowResult<K, V> overflow, int index )
- {
- OverflowResult<K, V> result = new OverflowResult<K, V>();
-
- int pivot = ( nbElems + 1 ) / 2;
-
- // i == P -> left = a[0..P-1], median = X, right = a[P..N-1]
- if ( index == pivot )
- {
- result.pivotKey = overflow.pivotKey;
- result.pivotValue = overflow.pivotValue;
- result.leftPage = copyHalfPage( revision, 0, pivot - 1, overflow.leftPage );
- result.rightPage = copyHalfPage( revision, pivot, nbElems - 1, overflow.rightPage );
-
- return result;
- }
-
- // i < P -> left = a[0..index, X, index+1..P - 2], median = a[P-1], right = a[P..N-1]
- if ( index < pivot )
- {
- result.pivotKey = keys[pivot - 1];
- result.pivotValue = values[pivot - 1];
- result.leftPage = copyAndInsert( revision, overflow, index, 0, pivot - 1 );
- result.rightPage = copyHalfPage( revision, pivot, nbElems - 1, children[pivot] );
-
- return result;
- }
- else
- {
- // i < P -> left = a[0..P - 1], median = a[P], right = a[P+1..N-1]
- result.pivotKey = keys[pivot];
- result.pivotValue = values[pivot];
- result.leftPage = copyHalfPage( revision, 0, pivot - 1, children[pivot] );
- result.rightPage = copyAndInsert( revision, overflow, index, pivot + 1, nbElems );
-
- return result;
- }
- }
- */
-
-
/**
* Copy half of a full page into a new page This method is called when a split of a page is done.
*
@@ -577,8 +535,8 @@ public class Page<K, V> implements Clone
else
{
// The child has to be copied on the left of the right page
- newPage.children[start] = child;
- System.arraycopy( children, start, newPage.children, 1, newPage.nbElems );
+ newPage.children[0] = child;
+ System.arraycopy( children, start + 1, newPage.children, 1, newPage.nbElems );
}
}
@@ -859,6 +817,9 @@ public class Page<K, V> implements Clone
}
+ /**
+ * @see Object#toString()
+ */
public String toString()
{
StringBuilder sb = new StringBuilder();