Package net.sf.joafip.heapfile.record.entity

Examples of net.sf.joafip.heapfile.record.entity.HeapFreeNode


    /**/DataRecordIdentifier.ZERO/* long nodeIdentification */,
    /**/true/* boolean freeRecord */,
    /**/0/* int dataAssociatedSize */,
    /**/100/* int areaSize */);

    final HeapFreeNode heapFreeNode = (HeapFreeNode) heapRecord
        .getFreeNode();
    heapFreeNode.setLeftPositionInFile(91);
    heapFreeNode.setRightPositionInFile(92);
    heapFreeNode.setParentPositionInFile(93);
    try {
      heapFreeNode.setBlack();
    } catch (Exception exception) {
      // ignore error
    }
    // to force write
    heapRecord.setValueIsChangedValueToSave();
View Full Code Here


        heapRecordWrote.getPreviousRecordPositionInFile(),
        heapRecordRead.getPreviousRecordPositionInFile());

    if (heapRecordWrote.isFreeRecord()) {

      final HeapFreeNode heapFreeNode1 = (HeapFreeNode) heapRecordWrote
          .getFreeNode();
      final HeapFreeNode heapFreeNode2 = (HeapFreeNode) heapRecordRead
          .getFreeNode();

      assertEquals("free1 file pos error",
          heapRecordWrote.getPositionInFile(),
          heapFreeNode1.getPositionInFile());
      assertEquals("free2 file pos error",
          heapRecordRead.getPositionInFile(),
          heapFreeNode2.getPositionInFile());
      assertEquals("free parent file pos error",
          heapFreeNode1.getParentPositionInFile(),
          heapFreeNode1.getParentPositionInFile());
      assertEquals("free right file pos error",
          heapFreeNode1.getRightPositionInFile(),
View Full Code Here

  private void checkFreeNodeInTree(final HeapRecord heapRecord)
      throws RBTException, HeapException {
    if (!heapRecord.isFreeRecord()) {
      throw new HeapException("must be a free node");
    }
    final HeapFreeNode node = (HeapFreeNode) heapRecord.getFreeNode();
    if (node.getPositionInFile() != heapRecord.getPositionInFile()) {
      throw new HeapException(
          "position in file mismatch: heap record is "
              + heapRecord.getPositionInFile()
              + " and free node is " + node.getPositionInFile());
    }
    if (node.getRecordSize() != heapRecord.getRecordSize()) {
      throw new HeapException("area size mismatch: heap record is "
          + heapRecord.getRecordSize() + " and free node is "
          + node.getRecordSize());
    }

    HeapFreeNode found;
    found = (HeapFreeNode) freeNodeTree.search(heapRecord.getRecordSize());
    if (found == null) {
      throw new HeapException("free record must exist in free tree\n"
          + heapRecord);
    }
    while (found.getPositionInFile() != heapRecord.getPositionInFile()) {
      found = (HeapFreeNode) freeNodeTree.next(found);
      if (found == null
          || found.getRecordSize() != heapRecord.getRecordSize()) {
        throw new HeapException("free record must exist in free tree");
      }
    }
  }
View Full Code Here

  }

  @Override
  protected IRBTNode<Integer> getRootNode(final HeapHeader heapHeader)
      throws HeapException {
    final HeapFreeNode heapFreeRootNode;
    final long freeRootNodeFilePosition = heapHeader
        .getFreeRootNodeFilePosition();
    if (freeRootNodeFilePosition == -1) {
      heapFreeRootNode = null;
    } else {
View Full Code Here

          + HeapRecord.MAX_RECORD_HEADER_SIZE
          + dataRecordKeyDataSize(nodeIdentifier);
    }
    final HeapRecord heapRecord;

    final HeapFreeNode freeNode = getHeapFreeNode(neededAreaSize);

    if (freeNode == null) {

      heapRecord = createRecordForDataAtEndOfHeap(neededDataSize,
          neededAreaSize, nodeIdentifier);
View Full Code Here

   * @throws HeapException
   * @throws
   */
  private HeapFreeNode getHeapFreeNode(final int areaSize)
      throws HeapException {
    HeapFreeNode freeNode;
    try {
      freeNode = (HeapFreeNode) freeNodeTree
          .closestGreaterOrEqual(areaSize);
    } catch (RBTException exception) {
      logger.fatal(FAILED_GET_RECORD_OF_CLOSEST_GREATER_SIZE);
View Full Code Here

TOP

Related Classes of net.sf.joafip.heapfile.record.entity.HeapFreeNode

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.