Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC13EB607 for ; Fri, 20 Jan 2012 16:24:46 +0000 (UTC) Received: (qmail 38490 invoked by uid 500); 20 Jan 2012 16:24:46 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 38435 invoked by uid 500); 20 Jan 2012 16:24:46 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 38428 invoked by uid 99); 20 Jan 2012 16:24:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2012 16:24:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jan 2012 16:24:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E09D223888D2 for ; Fri, 20 Jan 2012 16:24:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1233987 - /directory/sandbox/elecharny/shared-mvbt/src/main/java/org/apache/directory/btree/Page.java Date: Fri, 20 Jan 2012 16:24:24 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120120162424.E09D223888D2@eris.apache.org> 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 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[] children; /** The number of elements in each child */ @@ -500,48 +500,6 @@ public class Page implements Clone } - /* - private InsertResult split( long revision, OverflowResult overflow, int index ) - { - OverflowResult result = new OverflowResult(); - - 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 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 implements Clone } + /** + * @see Object#toString() + */ public String toString() { StringBuilder sb = new StringBuilder();