Package net.sf.joafip.btreeplus.entity

Examples of net.sf.joafip.btreeplus.entity.DataBlock


    index = 0;
    for (byte bits = PageConstant.MIN_DATA_BLOCK_BITS; bits < PageConstant.MAX_DATA_BLOCK_BITS; bits++) {
      final TestDataBlockContext context = contextByBits[index];
      final Iterator<Long> iterator = context.getPositionDeque()
          .iterator();
      final DataBlock dataBlock = createDataBlock(bits, (byte) 0);
      assertEquals("bad allocation", iterator.next().longValue(),
          dataBlock.getPositionInFile());
      assertEquals("bad new free", iterator.next().longValue(),
          getHeapHeader().getFirstFreeBlock(bits));
      index++;
    }
    btreePlusElementMgr.closeTransaction();
View Full Code Here


      final byte bits) throws HeapException {
    long position = context.getPosition();
    byte contentValue = 0;
    int index = 0;
    long nextFreeDataBlockPosition;
    DataBlock dataBlock = createDataBlock(bits, contentValue);
    context.addDataBlock(dataBlock, contentValue);
    final DataBlockPage dataBlockPage = dataBlock.getDataBlockPage();
    do {
      final long dataBlockPosition = dataBlock.getPositionInFile();
      assertEquals("data block not in expected page (bits " + bits
          + ", contentValue " + contentValue + ")", position,
          dataBlockPosition & PageConstant.START_PAGE_POSITION_MASK);
      assertEquals("bad index", index,
          dataBlock.getIndexInDataBlockPage());
      nextFreeDataBlockPosition = getHeapHeader().getFirstFreeBlock(bits);
      if (nextFreeDataBlockPosition != -1L) {
        contentValue++;
        index++;
        dataBlock = createDataBlock(bits, contentValue);
        assertSame("bad data block page", dataBlockPage,
            dataBlock.getDataBlockPage());
      }
    } while (nextFreeDataBlockPosition != -1L);
    final int numberOfBlockCreated = index + 1;
    assertEquals("number of block missmatch", numberOfBlockCreated,
        dataBlockPage.getNumberOfBlock());
View Full Code Here

  private DataBlock createDataBlock(final byte bits, final byte contentValue)
      throws HeapException {
    final int dataSize = (1 << bits) * 3 / 4;
    final byte[] data = createData(dataSize, contentValue);
    final DataBlock dataBlock = (DataBlock) btreePlusElementMgr
        .createDataBlock(data);
    assertEquals("bad data block type", bits, dataBlock.getBits());
    return dataBlock;
  }
View Full Code Here

TOP

Related Classes of net.sf.joafip.btreeplus.entity.DataBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.