You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by el...@apache.org on 2012/07/02 15:09:11 UTC
svn commit: r1356210 - in
/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree:
BTree.java ModifyResult.java Node.java Page.java SplitResult.java Tuple.java
Author: elecharny
Date: Mon Jul 2 13:09:10 2012
New Revision: 1356210
URL: http://svn.apache.org/viewvc?rev=1356210&view=rev
Log:
Last set of Javadoc cleanup.
Modified:
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/ModifyResult.java
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Node.java
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/SplitResult.java
labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Tuple.java
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java?rev=1356210&r1=1356209&r2=1356210&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/BTree.java Mon Jul 2 13:09:10 2012
@@ -207,7 +207,7 @@ public class BTree<K, V>
/**
- * Delete the entry whch key is given as a parameter. If the entry exists, it will
+ * Delete the entry which key is given as a parameter. If the entry exists, it will
* be removed from the tree, the old tuple will be returned. Otherwise, null is returned.
*
* @param key The key for the entry we try to remove
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/ModifyResult.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/ModifyResult.java?rev=1356210&r1=1356209&r2=1356210&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/ModifyResult.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/ModifyResult.java Mon Jul 2 13:09:10 2012
@@ -42,7 +42,7 @@ package org.apache.mavibot.btree;
* @param modifiedPage The modified page
* @param modifiedvalue The modified value (can be null if the key wasn't present in the tree)
*/
- public ModifyResult( Page<K, V> modifiedPage, V modifiedValue )
+ /* No qualifier */ ModifyResult( Page<K, V> modifiedPage, V modifiedValue )
{
this.modifiedPage = modifiedPage;
this.modifiedValue = modifiedValue;
@@ -52,7 +52,7 @@ package org.apache.mavibot.btree;
/**
* @return the modifiedPage
*/
- public Page<K, V> getModifiedPage()
+ /* No qualifier */ Page<K, V> getModifiedPage()
{
return modifiedPage;
}
@@ -61,7 +61,7 @@ package org.apache.mavibot.btree;
/**
* @return the modifiedValue
*/
- public V getModifiedValue()
+ /* No qualifier */ V getModifiedValue()
{
return modifiedValue;
}
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Node.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Node.java?rev=1356210&r1=1356209&r2=1356210&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Node.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Node.java Mon Jul 2 13:09:10 2012
@@ -19,6 +19,7 @@
*/
package org.apache.mavibot.btree;
+import java.lang.reflect.Array;
import java.util.LinkedList;
/**
@@ -30,7 +31,7 @@ import java.util.LinkedList;
*
* @author <a href="mailto:labs@laps.apache.org">Mavibot labs Project</a>
*/
-public class Node<K, V> extends AbstractPage<K, V>
+/* No qualifier */ class Node<K, V> extends AbstractPage<K, V>
{
/** Children pages associated with keys. */
protected Page<K, V>[] children;
@@ -45,6 +46,7 @@ public class Node<K, V> extends Abstract
* @param revision the Node revision
* @param nbElems The number of elements in this Node
*/
+ @SuppressWarnings("unchecked")
/* No qualifier */ Node( BTree<K, V> btree, long revision, int nbElems )
{
super( btree, revision, nbElems );
@@ -65,6 +67,7 @@ public class Node<K, V> extends Abstract
* @param leftPage The left page
* @param rightPage The right page
*/
+ @SuppressWarnings("unchecked")
/* No qualifier */ Node( BTree<K, V> btree, long revision, K key, Page<K, V> leftPage, Page<K, V> rightPage )
{
super( btree, revision, 1 );
@@ -75,7 +78,11 @@ public class Node<K, V> extends Abstract
children[1] = rightPage;
// Create the keys array and store the pivot into it
- keys = (K[])new Object[btree.getPageSize()];
+ // We get the type of array to create from the btree
+ // Yes, this is an hack...
+ Class<?> keyType = btree.getKeyType();
+ keys = (K[])Array.newInstance( keyType, btree.getPageSize() );
+
keys[0] = key;
}
@@ -174,19 +181,13 @@ public class Node<K, V> extends Abstract
if ( pos < 0 )
{
- // Here, if we have found the key in the node, then we must go down into
- // the right child, not the left one
-
- stack.push( new ParentPos<K, V>( this, -pos ) );
-
- return children[-pos].browse( key, transaction, stack );
- }
- else
- {
- stack.push( new ParentPos<K, V>( this, pos ) );
-
- return children[pos].browse( key, transaction, stack );
+ pos = -pos;
}
+
+ // We first stack the current page
+ stack.push( new ParentPos<K, V>( this, pos ) );
+
+ return children[pos].browse( key, transaction, stack );
}
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java?rev=1356210&r1=1356209&r2=1356210&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Page.java Mon Jul 2 13:09:10 2012
@@ -54,7 +54,7 @@ import java.util.LinkedList;
* @param value Inserted value
* @return Either a modified Page or an Overflow element if the Page was full
*/
- /* No qualifier */ InsertResult<K, V> insert( long revision, K key, V value );
+ InsertResult<K, V> insert( long revision, K key, V value );
/**
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/SplitResult.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/SplitResult.java?rev=1356210&r1=1356209&r2=1356210&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/SplitResult.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/SplitResult.java Mon Jul 2 13:09:10 2012
@@ -40,9 +40,11 @@ package org.apache.mavibot.btree;
/**
* The default constructor for SplitResult.
- * @param modifiedPage
+ * @param pivot The new key to insert into the parent
+ * @param leftPage The new left page
+ * @param rightPage The new right page
*/
- public SplitResult( K pivot, Page<K, V> leftPage, Page<K, V> rightPage )
+ /* No qualifier */ SplitResult( K pivot, Page<K, V> leftPage, Page<K, V> rightPage )
{
this.pivot = pivot;
this.leftPage = leftPage;
@@ -53,7 +55,7 @@ package org.apache.mavibot.btree;
/**
* @return the leftPage
*/
- public Page<K, V> getLeftPage()
+ /* No qualifier */ Page<K, V> getLeftPage()
{
return leftPage;
}
@@ -62,7 +64,7 @@ package org.apache.mavibot.btree;
/**
* @return the rightPage
*/
- public Page<K, V> getRightPage()
+ /* No qualifier */ Page<K, V> getRightPage()
{
return rightPage;
}
@@ -71,7 +73,7 @@ package org.apache.mavibot.btree;
/**
* @return the pivot
*/
- public K getPivot()
+ /* No qualifier */ K getPivot()
{
return pivot;
}
Modified: labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Tuple.java
URL: http://svn.apache.org/viewvc/labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Tuple.java?rev=1356210&r1=1356209&r2=1356210&view=diff
==============================================================================
--- labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Tuple.java (original)
+++ labs/mavibot/trunk/mavibot/src/main/java/org/apache/mavibot/btree/Tuple.java Mon Jul 2 13:09:10 2012
@@ -59,7 +59,7 @@ public class Tuple<K, V>
/**
* @return the key
*/
- public K getKey()
+ /* No qualifier */ K getKey()
{
return key;
}
@@ -77,7 +77,7 @@ public class Tuple<K, V>
/**
* @return the value
*/
- public V getValue()
+ /* No qualifier */ V getValue()
{
return value;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org