directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r947518 - /directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java
Date Mon, 24 May 2010 00:36:14 GMT
Author: elecharny
Date: Mon May 24 00:36:13 2010
New Revision: 947518

URL: http://svn.apache.org/viewvc?rev=947518&view=rev
Log:
Added a toString() method
Minor refactoring

Modified:
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java?rev=947518&r1=947517&r2=947518&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java Mon May 24 00:36:13
2010
@@ -189,10 +189,10 @@ public class BTree<K, V> implements Exte
     /**
      * The real BTree constructor.
      */
-    private void createInstance(RecordManager recman, Comparator<K> comparator, Serializer
keySerializer,
+    private void createInstance(RecordManager recordManager, Comparator<K> comparator,
Serializer keySerializer,
         Serializer valueSerializer, int pageSize) throws IOException
     {
-        if ( recman == null )
+        if ( recordManager == null )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_517 ) );
         }
@@ -223,7 +223,7 @@ public class BTree<K, V> implements Exte
             throw new IllegalArgumentException( I18n.err( I18n.ERR_522 ) );
         }
 
-        this.recordManager = recman;
+        this.recordManager = recordManager;
         this.comparator = comparator;
         this.keySerializer = keySerializer;
         this.valueSerializer = valueSerializer;
@@ -232,7 +232,7 @@ public class BTree<K, V> implements Exte
         this.bpageSerializer.btree = this;
         this.nbEntries = new AtomicInteger( 0 );
 
-        this.recordId = recman.insert( this );
+        this.recordId = recordManager.insert( this );
     }
     
     
@@ -625,4 +625,52 @@ public class BTree<K, V> implements Exte
     {
         return comparator;
     }
+    
+    
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        sb.append( "BTree" );
+        sb.append( "(height:" ).append(bTreeHeight );
+        sb.append( ", pageSize:" ).append( pageSize );
+        sb.append( ", nbEntries:" ).append( nbEntries );
+        sb.append( ", rootId:" ).append( rootId );
+        sb.append( ", comparator:" );
+        
+        if ( comparator == null )
+        {
+            sb.append( "null" );
+        }
+        else
+        {
+            sb.append( comparator.getClass().getSimpleName() );
+        }
+
+        sb.append( ", keySerializer:" );
+        
+        if ( keySerializer == null )
+        {
+            sb.append( "null" );
+        }
+        else
+        {
+            sb.append( keySerializer.getClass().getSimpleName() );
+        }
+
+        sb.append( ", valueSerializer:" );
+
+        if ( valueSerializer == null )
+        {
+            sb.append( "null" );
+        }
+        else
+        {
+            sb.append( valueSerializer.getClass().getSimpleName() );
+        }
+        
+        sb.append( ")\n" );
+
+        return sb.toString();
+    }
 }



Mime
View raw message