directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r912405 - in /directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman: FreePhysicalRowId.java FreePhysicalRowIdPage.java
Date Sun, 21 Feb 2010 21:11:16 GMT
Author: akarasulu
Date: Sun Feb 21 21:11:15 2010
New Revision: 912405

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

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

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowId.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowId.java?rev=912405&r1=912404&r2=912405&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowId.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowId.java Sun Feb
21 21:11:15 2010
@@ -73,6 +73,7 @@
     {
         return block.readInt( pos + O_SIZE );
     }
+    
 
     /** Sets the size */
     void setSize( int value ) 

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPage.java?rev=912405&r1=912404&r2=912405&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPage.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/FreePhysicalRowIdPage.java Sun
Feb 21 21:11:15 2010
@@ -44,107 +44,144 @@
  *
  * $Id: FreePhysicalRowIdPage.java,v 1.1 2000/05/06 00:00:31 boisvert Exp $
  */
-
 package jdbm.recman;
 
+
 /**
- *  Class describing a page that holds physical rowids that were freed.
+ * Class describing a page that holds physical rowids that were freed.
  */
-final class FreePhysicalRowIdPage extends PageHeader {
+final class FreePhysicalRowIdPage extends PageHeader 
+{
     // offsets
     private static final short O_COUNT = PageHeader.SIZE; // short count
     static final short O_FREE = O_COUNT + Magic.SZ_SHORT;
-    static final short ELEMS_PER_PAGE = 
-  (RecordFile.BLOCK_SIZE - O_FREE) / FreePhysicalRowId.SIZE;
+    static final short ELEMS_PER_PAGE =  ( RecordFile.BLOCK_SIZE - O_FREE ) 
+        / FreePhysicalRowId.SIZE;
     
     // slots we returned.
     FreePhysicalRowId[] slots = new FreePhysicalRowId[ELEMS_PER_PAGE];
 
+    
     /**
-     *  Constructs a data page view from the indicated block.
+     * Constructs a data page view from the indicated block.
      */
-    FreePhysicalRowIdPage(BlockIo block) {
-  super(block);
+    FreePhysicalRowIdPage( 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 FreePhysicalRowIdPage getFreePhysicalRowIdPageView(BlockIo block) {
-  BlockView view = block.getView();
-  if (view != null && view instanceof FreePhysicalRowIdPage)
-      return (FreePhysicalRowIdPage) view;
-  else
-      return new FreePhysicalRowIdPage(block);
+    static FreePhysicalRowIdPage getFreePhysicalRowIdPageView( BlockIo block ) 
+    {
+        BlockView view = block.getView();
+        if ( view != null && view instanceof FreePhysicalRowIdPage )
+        {
+            return ( FreePhysicalRowIdPage ) view;
+        }
+        else
+        {
+            return new FreePhysicalRowIdPage( block );
+        }
     }
+    
 
     /** Returns the number of free rowids */
-    short getCount() {
-  return block.readShort(O_COUNT);
+    short getCount() 
+    {
+        return block.readShort( O_COUNT );
     }
 
+    
     /** Sets the number of free rowids */
-    private void setCount(short i) {
-  block.writeShort(O_COUNT, i);
+    private void setCount( short i ) 
+    {
+        block.writeShort( O_COUNT, i );
     }
 
+    
     /** Frees a slot */
-    void free(int slot) {
-  get(slot).setSize(0);
-  setCount((short) (getCount() - 1));
+    void free( int slot ) 
+    {
+        get( slot ).setSize( 0 );
+        setCount( ( short ) ( getCount() - 1 ) );
     }
 
+    
     /** Allocates a slot */
-    FreePhysicalRowId alloc(int slot) {
-  setCount((short) (getCount() + 1));
-  return get(slot);
+    FreePhysicalRowId alloc( int slot ) 
+    {
+        setCount( ( short ) ( getCount() + 1 ) );
+        return get( slot );
     }
 
+    
     /** Returns true if a slot is allocated */
-    boolean isAllocated(int slot) {
-  return get(slot).getSize() != 0;
+    boolean isAllocated( int slot ) 
+    {
+        return get( slot ).getSize() != 0;
     }
+    
 
     /** Returns true if a slot is free */
-    boolean isFree(int slot) {
-  return !isAllocated(slot);
+    boolean isFree( int slot ) 
+    {
+        return ! isAllocated( slot );
     }
     
     
     /** Returns the value of the indicated slot */
-    FreePhysicalRowId get(int slot) {
-  if (slots[slot] == null) 
-      slots[slot] = new FreePhysicalRowId(block, slotToOffset(slot));;
-  return slots[slot];
+    FreePhysicalRowId get( int slot ) 
+    {
+        if ( slots[slot] == null )
+        {
+            slots[slot] = new FreePhysicalRowId( block, slotToOffset( slot ) ) ;
+        }
+  
+        return slots[slot];
     }
+    
 
     /** Converts slot to offset */
-    short slotToOffset(int slot) {
-  return (short) (O_FREE +
-      (slot * FreePhysicalRowId.SIZE));
+    short slotToOffset( int slot ) 
+    {
+        return ( short ) ( O_FREE + ( slot * FreePhysicalRowId.SIZE ) );
     }
     
+    
     /** 
-     *  Returns first free slot, -1 if no slots are available
+     * Returns first free slot, -1 if no slots are available
      */
-    int getFirstFree() {
-  for (int i = 0; i < ELEMS_PER_PAGE; i++) {
-      if (isFree(i))
-    return i;
-  }
-  return -1;
+    int getFirstFree() 
+    {
+        for ( int i = 0; i < ELEMS_PER_PAGE; i++ ) 
+        {
+            if ( isFree( i ) )
+            {
+                return i;
+            }
+        }
+  
+        return -1;
     }
+    
 
     /** 
-     *  Returns first slot with available size >= indicated size,  
-     *  or -1 if no slots are available.
-     **/
-    int getFirstLargerThan(int size) {
-  for (int i = 0; i < ELEMS_PER_PAGE; i++) {
-      if (isAllocated(i) && get(i).getSize() >= size)
-    return i;
-  }
-  return -1;
+     * Returns first slot with available size >= indicated size, or -1 if no 
+     * slots are available.
+     */
+    int getFirstLargerThan( int size ) 
+    {
+        for (int i = 0; i < ELEMS_PER_PAGE; i++) 
+        {
+            if ( isAllocated(i) && get(i).getSize() >= size )
+            {
+                return i;
+            }
+        }
+  
+        return -1;
     }
-}
+}
\ No newline at end of file



Mime
View raw message