directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1551071 - in /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory: BTreeFactory.java InMemoryBTreeBuilder.java Leaf.java TupleCursorImpl.java
Date Sun, 15 Dec 2013 22:48:09 GMT
Author: elecharny
Date: Sun Dec 15 22:48:09 2013
New Revision: 1551071

URL: http://svn.apache.org/r1551071
Log:
Replaced the reference to InMemoryValueHolde rby a reference to the ValueHolder interface

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/BTreeFactory.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeBuilder.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/Leaf.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/TupleCursorImpl.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/BTreeFactory.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/BTreeFactory.java?rev=1551071&r1=1551070&r2=1551071&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/BTreeFactory.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/BTreeFactory.java
Sun Dec 15 22:48:09 2013
@@ -26,6 +26,7 @@ import java.util.LinkedList;
 import org.apache.directory.mavibot.btree.BTree;
 import org.apache.directory.mavibot.btree.Page;
 import org.apache.directory.mavibot.btree.ParentPos;
+import org.apache.directory.mavibot.btree.ValueHolder;
 import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
 
 
@@ -234,7 +235,7 @@ public class BTreeFactory
         if ( btree.getRootPage() instanceof Leaf )
         {
             Leaf<K, V> leaf = ( Leaf<K, V> ) ( btree.getRootPage() );
-            InMemoryValueHolder<V> valueHolder = leaf.values[last.pos];
+            ValueHolder<V> valueHolder = leaf.values[last.pos];
             last.valueCursor = valueHolder.getCursor();
         }
         else
@@ -251,7 +252,7 @@ public class BTreeFactory
                 if ( p instanceof Leaf )
                 {
                     Leaf<K, V> leaf = ( Leaf<K, V> ) ( last.page );
-                    InMemoryValueHolder<V> valueHolder = leaf.values[last.pos];
+                    ValueHolder<V> valueHolder = leaf.values[last.pos];
                     last.valueCursor = valueHolder.getCursor();
                     break;
                 }

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeBuilder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeBuilder.java?rev=1551071&r1=1551070&r2=1551071&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeBuilder.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/InMemoryBTreeBuilder.java
Sun Dec 15 22:48:09 2013
@@ -37,6 +37,7 @@ import org.apache.directory.mavibot.btre
 import org.apache.directory.mavibot.btree.KeyHolder;
 import org.apache.directory.mavibot.btree.Page;
 import org.apache.directory.mavibot.btree.Tuple;
+import org.apache.directory.mavibot.btree.ValueHolder;
 import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
 
 
@@ -118,7 +119,7 @@ public class InMemoryBTreeBuilder<K, V>
                 lastLeaf.setKeys( ( KeyHolder[] ) Array.newInstance( KeyHolder.class, n )
);
                 System.arraycopy( keys, 0, lastLeaf.getKeys(), 0, n );
 
-                InMemoryValueHolder<V>[] values = lastLeaf.values;
+                ValueHolder<V>[] values = lastLeaf.values;
                 lastLeaf.values = ( InMemoryValueHolder<V>[] ) Array.newInstance( InMemoryValueHolder.class,
n );
                 System.arraycopy( values, 0, lastLeaf.values, 0, n );
 

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/Leaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/Leaf.java?rev=1551071&r1=1551070&r2=1551071&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/Leaf.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/Leaf.java
Sun Dec 15 22:48:09 2013
@@ -38,6 +38,7 @@ import org.apache.directory.mavibot.btre
 import org.apache.directory.mavibot.btree.Tuple;
 import org.apache.directory.mavibot.btree.TupleCursor;
 import org.apache.directory.mavibot.btree.ValueCursor;
+import org.apache.directory.mavibot.btree.ValueHolder;
 import org.apache.directory.mavibot.btree.exception.EndOfFileExceededException;
 import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 
@@ -53,7 +54,7 @@ import org.apache.directory.mavibot.btre
 /* No qualifier */class Leaf<K, V> extends AbstractInMemoryPage<K, V>
 {
     /** Values associated with keys */
-    protected InMemoryValueHolder<V>[] values;
+    protected ValueHolder<V>[] values;
 
 
     /**
@@ -159,7 +160,7 @@ import org.apache.directory.mavibot.btre
 
         int index = -( pos + 1 );
 
-        InMemoryValueHolder<V> valueHolder = values[index];
+        ValueHolder<V> valueHolder = values[index];
 
         if ( value == null )
         {
@@ -363,7 +364,7 @@ import org.apache.directory.mavibot.btre
     {
         // The sibling is on the left, borrow the rightmost element
         K siblingKey = sibling.getKey( sibling.getNbElems() - 1 );
-        InMemoryValueHolder<V> siblingValue = sibling.values[sibling.getNbElems() -
1];
+        ValueHolder<V> siblingValue = sibling.values[sibling.getNbElems() - 1];
 
         // Create the new sibling, with one less element at the end
         Leaf<K, V> newSibling = ( Leaf<K, V> ) sibling.copy( revision, sibling.getNbElems()
- 1 );
@@ -410,7 +411,7 @@ import org.apache.directory.mavibot.btre
     {
         // The sibling is on the left, borrow the rightmost element
         K siblingKey = sibling.getKey( 0 );
-        InMemoryValueHolder<V> siblingHolder = sibling.values[0];
+        ValueHolder<V> siblingHolder = sibling.values[0];
 
         // Create the new sibling
         Leaf<K, V> newSibling = new Leaf<K, V>( btree, revision, sibling.getNbElems()
- 1 );
@@ -552,7 +553,7 @@ import org.apache.directory.mavibot.btre
 
         if ( pos < 0 )
         {
-            InMemoryValueHolder<V> valueHolder = values[-( pos + 1 )];
+            ValueHolder<V> valueHolder = values[-( pos + 1 )];
             
             return valueHolder.contains( value );
         }
@@ -566,7 +567,7 @@ import org.apache.directory.mavibot.btre
     /**
      * {@inheritDoc}
      */
-    public InMemoryValueHolder<V> getValue( int pos )
+    public ValueHolder<V> getValue( int pos )
     {
         if ( pos < nbElems )
         {
@@ -734,7 +735,7 @@ import org.apache.directory.mavibot.btre
         }
 
         // Get the previous value from the leaf (it's a copy)
-        InMemoryValueHolder<V> valueHolder = newLeaf.values[pos];
+        ValueHolder<V> valueHolder = newLeaf.values[pos];
         V replacedValue = null;
 
         if ( !valueHolder.contains( value ) )

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/TupleCursorImpl.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/TupleCursorImpl.java?rev=1551071&r1=1551070&r2=1551071&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/TupleCursorImpl.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/TupleCursorImpl.java
Sun Dec 15 22:48:09 2013
@@ -29,6 +29,7 @@ import org.apache.directory.mavibot.btre
 import org.apache.directory.mavibot.btree.ParentPos;
 import org.apache.directory.mavibot.btree.Transaction;
 import org.apache.directory.mavibot.btree.Tuple;
+import org.apache.directory.mavibot.btree.ValueHolder;
 import org.apache.directory.mavibot.btree.exception.EndOfFileExceededException;
 
 
@@ -260,7 +261,7 @@ public class TupleCursorImpl<K, V> exten
                 parentPos = stack[depth];
                 parentPos.pos = child.getNbElems() - 1;
                 parentPos.page = child;
-                InMemoryValueHolder<V> valueHolder = ((Leaf<K, V>)parentPos.page).values[parentPos.pos];
+                ValueHolder<V> valueHolder = ((Leaf<K, V>)parentPos.page).values[parentPos.pos];
                 parentPos.valueCursor = valueHolder.getCursor();
                 parentPos.valueCursor.afterLast();
 
@@ -629,7 +630,7 @@ public class TupleCursorImpl<K, V> exten
 
             try
             {
-                InMemoryValueHolder<V> valueHolder = ( ( Leaf<K, V> ) parentPos.page
).getValue( parentPos.pos );
+                ValueHolder<V> valueHolder = ( ( Leaf<K, V> ) parentPos.page
).getValue( parentPos.pos );
                 
                 parentPos.valueCursor = valueHolder.getCursor();
                 
@@ -681,7 +682,7 @@ public class TupleCursorImpl<K, V> exten
             {
                 // This is the end : no more value
                 Leaf<K, V> leaf = ( Leaf<K, V> ) ( parentPos.page );
-                InMemoryValueHolder<V> valueHolder = leaf.values[parentPos.pos];
+                ValueHolder<V> valueHolder = leaf.values[parentPos.pos];
                 parentPos.pos = AFTER_LAST;
                 parentPos.valueCursor = valueHolder.getCursor();
                 parentPos.valueCursor.afterLast();
@@ -704,7 +705,7 @@ public class TupleCursorImpl<K, V> exten
         tuple.setKey( leaf.getKey( parentPos.pos ) );
         
         // The value
-        InMemoryValueHolder<V> valueHolder = leaf.values[parentPos.pos];
+        ValueHolder<V> valueHolder = leaf.values[parentPos.pos];
         parentPos.valueCursor = valueHolder.getCursor();
         V value = parentPos.valueCursor.next();
         tuple.setValue( value );
@@ -777,7 +778,7 @@ public class TupleCursorImpl<K, V> exten
                 
                 try
                 {
-                    InMemoryValueHolder<V> valueHolder = ( ( Leaf<K, V> ) parentPos.page
).getValue( parentPos.pos );
+                    ValueHolder<V> valueHolder = ( ( Leaf<K, V> ) parentPos.page
).getValue( parentPos.pos );
                     
                     parentPos.valueCursor = valueHolder.getCursor();
                     parentPos.valueCursor.afterLast();
@@ -851,7 +852,7 @@ public class TupleCursorImpl<K, V> exten
         tuple.setKey( leaf.getKey( parentPos.pos ) );
 
         // The value
-        InMemoryValueHolder<V> valueHolder = leaf.values[parentPos.pos];
+        ValueHolder<V> valueHolder = leaf.values[parentPos.pos];
         parentPos.valueCursor = valueHolder.getCursor();
         V value = parentPos.valueCursor.next();
         tuple.setValue( value );



Mime
View raw message