org.h2.test.store
Class FreeSpaceList

java.lang.Object
  extended by org.h2.test.store.FreeSpaceList

public class FreeSpaceList
extends java.lang.Object

A list that maintains ranges of free space (in blocks).


Constructor Summary
FreeSpaceList(int firstFreeBlock, int blockSize)
           
 
Method Summary
 long allocate(int length)
          Allocate a number of blocks and mark them as used.
 void clear()
          Reset the list.
 void free(long pos, int length)
          Mark the space as free.
 void markUsed(long pos, int length)
          Mark the space as in use.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FreeSpaceList

public FreeSpaceList(int firstFreeBlock,
                     int blockSize)
Method Detail

clear

public void clear()
Reset the list.


allocate

public long allocate(int length)
Allocate a number of blocks and mark them as used.

Parameters:
length - the number of bytes to allocate
Returns:
the start position in bytes

markUsed

public void markUsed(long pos,
                     int length)
Mark the space as in use.

Parameters:
pos - the position in bytes
length - the number of bytes

free

public void free(long pos,
                 int length)
Mark the space as free.

Parameters:
pos - the position in bytes
length - the number of bytes

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object