You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2010/02/20 13:12:27 UTC

svn commit: r912108 - /directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/DataPage.java

Author: akarasulu
Date: Sat Feb 20 12:12:27 2010
New Revision: 912108

URL: http://svn.apache.org/viewvc?rev=912108&view=rev
Log:
formatting

Modified:
    directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/DataPage.java

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/DataPage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/DataPage.java?rev=912108&r1=912107&r2=912108&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/DataPage.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/DataPage.java Sat Feb 20 12:12:27 2010
@@ -44,49 +44,71 @@
  *
  * $Id: DataPage.java,v 1.1 2000/05/06 00:00:31 boisvert Exp $
  */
-
 package jdbm.recman;
 
+
 import org.apache.directory.server.i18n.I18n;
 
+
 /**
- *  Class describing a page that holds data.
+ * Class describing a page that holds data.
  */
-final class DataPage extends PageHeader {
+final class DataPage extends PageHeader 
+{
     // offsets
+    
+    /** first short in the file after the page header info: 18 byte offset */
     private static final short O_FIRST = PageHeader.SIZE; // short firstrowid
-    static final short O_DATA = (short)(O_FIRST + Magic.SZ_SHORT);
-    static final short DATA_PER_PAGE = (short)(RecordFile.BLOCK_SIZE - O_DATA);
+    
+    /** start of the data in this block: 20 byte offset */
+    static final short O_DATA = ( short ) ( O_FIRST + Magic.SZ_SHORT );
+    
+    /** total amount of data in this page/block: 8172 bytes */
+    static final short DATA_PER_PAGE = ( short ) ( RecordFile.BLOCK_SIZE - O_DATA );
 
+    
     /**
-     *  Constructs a data page view from the indicated block.
+     * Constructs a data page view from the indicated block.
      */
-    DataPage(BlockIo block) {
-  super(block);
+    DataPage( BlockIo block ) 
+    {
+        super( block );
     }
 
+    
     /**
-     *  Factory method to create or return a data page for the
-     *  indicated block.
+     * Factory method to create or return a data page for the indicated block.
      */
-    static DataPage getDataPageView(BlockIo block) {
-  BlockView view = block.getView();
-  if (view != null && view instanceof DataPage)
-      return (DataPage) view;
-  else
-      return new DataPage(block);
+    static DataPage getDataPageView( BlockIo block ) 
+    {
+        BlockView view = block.getView();
+        if ( view != null && view instanceof DataPage )
+        {
+            return ( DataPage ) view;
+        }
+        else
+        { 
+            return new DataPage( block );
+        }
     }
+    
 
     /** Returns the first rowid's offset */
-    short getFirst() {
-  return block.readShort(O_FIRST);
+    short getFirst() 
+    {
+        return block.readShort( O_FIRST );
     }
     
+    
     /** Sets the first rowid's offset */
-    void setFirst(short value) {
-  paranoiaMagicOk();
-  if (value > 0 && value < O_DATA)
-      throw new Error( I18n.err( I18n.ERR_543, value ) );
-  block.writeShort(O_FIRST, value);
+    void setFirst( short value ) 
+    {
+        paranoiaMagicOk();
+        if ( value > 0 && value < O_DATA )
+        {
+            throw new Error( I18n.err( I18n.ERR_543, value ) );
+        }
+  
+        block.writeShort( O_FIRST, value );
     }
 }