Package net.sf.joafip.btreeplus.entity

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


    leafPage.updateByteSize();
    IPageRecordable pageRecordable = leafPage;
    assertNull(MUST_BE_NOT_STORED, pageRecordable.getPageRecord());
    btreePlusElementMgr.appendPageRecordable(pageRecordable);
    pageRecordable.setValueIsChangedValueToSave();
    IPageRecord pageRecord = pageRecordable.getPageRecord();
    assertNotNull(MUST_BE_STORED, pageRecord);
    assertEquals(BAD_RECORD_POSITION, PageConstant.PAGE_SIZE * 1,
        pageRecord.getPositionInFile());
    assertEquals(BAD_LAST_RECORD_POSITION, PageConstant.PAGE_SIZE * 1,
        btreePlusElementMgr.getLastRecordPositionInFile());

    NonTerminalPage nonTerminalPage = new NonTerminalPage(1, true);
    nonTerminalPage.setKey(0, new DataRecordIdentifier());
    pageRecordable = nonTerminalPage;
    pageRecordable.updateByteSize();
    assertNull(MUST_BE_NOT_STORED, pageRecordable.getPageRecord());
    btreePlusElementMgr.appendPageRecordable(pageRecordable);
    pageRecordable.setValueIsChangedValueToSave();
    pageRecord = pageRecordable.getPageRecord();
    assertNotNull(MUST_BE_STORED, pageRecord);
    assertEquals(BAD_RECORD_POSITION, PageConstant.PAGE_SIZE * 2,
        pageRecord.getPositionInFile());
    assertEquals(BAD_LAST_RECORD_POSITION, PageConstant.PAGE_SIZE * 2,
        btreePlusElementMgr.getLastRecordPositionInFile());
    btreePlusElementMgr.closeTransaction();
    assertEquals("", PageConstant.PAGE_SIZE * 3, btreePlusElementMgr
        .getFileForStorable().getFileSize());

    btreePlusElementMgr.openTransaction();
    final int numberOfKeyEntries = 1;
    final DataRecordIdentifier[] keys = new DataRecordIdentifier[] { new DataRecordIdentifier(
        0) };
    final long[] pagePosition = new long[] { 0, 1 };
    pageRecordable = new NonTerminalPage(numberOfKeyEntries, keys,
        pagePosition, true);
    assertNull(MUST_BE_NOT_STORED, pageRecordable.getPageRecord());
    btreePlusElementMgr.appendPageRecordable(pageRecordable);
    pageRecordable.setValueIsChangedValueToSave();
    pageRecord = pageRecordable.getPageRecord();
    assertNotNull(MUST_BE_STORED, pageRecord);
    assertEquals(BAD_RECORD_POSITION, PageConstant.PAGE_SIZE * 3,
        pageRecord.getPositionInFile());
    assertEquals(BAD_LAST_RECORD_POSITION, PageConstant.PAGE_SIZE * 3,
        btreePlusElementMgr.getLastRecordPositionInFile());
    btreePlusElementMgr.closeTransaction();
    assertEquals("", PageConstant.PAGE_SIZE * 4, btreePlusElementMgr
        .getFileForStorable().getFileSize());
View Full Code Here


    btreePlusElementMgr.closeTransaction();

    btreePlusElementMgr.openTransaction();
    assertEquals("must not has free page", -1, getHeapHeader()
        .getPageNumberOfFirstFreePage());
    final IPageRecord pageRecord = btreePlusElementMgr
        .getPage(pageNumber << PageConstant.PAGE_BITS,
            null/* parentPage */, -1/* index */).getPageRecord();
    btreePlusElementMgr.freePage(pageRecord);
    btreePlusElementMgr.closeTransaction();

 
View Full Code Here

      final DataBlockPage dataBlockPage = new DataBlockPage(bits);
      final long pageNumber = header.getFileSizeAsNumberOfPage();
      final long previousRecordPositionInFile = header
          .getLastRecordPositionInFile();
      // the new page record for page recordable
      final IPageRecord pageRecord = new PageRecord(heapElementManager,
          previousRecordPositionInFile, dataBlockPage, pageNumber);
      header.setFileSizeAsNumberOfPage(pageNumber
          + pageRecord.getNumberOfPage());
      header.setLastRecordPositionInFile(pageNumber << PageConstant.PAGE_BITS);
      dataBlockPage.setPageRecord(pageRecord);
      heapElementManager.appendHeapFileRecord(pageRecord);
      dataBlockPage.setAllFree();
      header.incrementNumberOfFreeRecord(dataBlockPage.getNumberOfBlock());
View Full Code Here

      header.decrementNumberOfFreeRecord();
    }

    if (freePageRecord == null) {
      // the new page record for page recordable
      final IPageRecord pageRecord = new PageRecord(heapElementManager,
          previousRecordPositionInFile, pageRecordable, pageNumber);
      header.setFileSizeAsNumberOfPage(pageNumber
          + pageRecord.getNumberOfPage());
      header.setLastRecordPositionInFile(pageNumber << PageConstant.PAGE_BITS);
      pageRecordable.setPageRecord(pageRecord);
      heapElementManager.appendHeapFileRecord(pageRecord);
    } else {
      freePageRecord.setPageRecordable(pageRecordable);
View Full Code Here

TOP

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

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.