Examples of HeapIdNode


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

    /**/1L/* long previousRecordPositionInFile */,
    /**/DataRecordIdentifier.ZERO/* long nodeIdentification */,
    /**/false/* boolean freeRecord */,
    /**/10/* int dataAssociatedSize */,
    /**/100/* int areaSize */);
    final HeapIdNode heapIdNode = (HeapIdNode) heapRecord.getIdNode();
    heapIdNode.setLeftPositionInFile(2);
    heapIdNode.setRightPositionInFile(3);
    heapIdNode.setParentPositionInFile(4);
    try {
      heapIdNode.setBlack();
    } catch (Exception exception) {
      // ignore error
    }
    // byte[] data = heapRecord.getDataAssociated();
    final byte[] data = new byte[10];
View Full Code Here

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

          heapRecordWrote.getDataAssociatedSize(),
          heapRecordRead.getDataAssociatedSize());
      assertEquals("node id error", heapRecordWrote.getNodeIdentifier(),
          heapRecordRead.getNodeIdentifier());

      final HeapIdNode heapIdNode1 = (HeapIdNode) heapRecordWrote
          .getIdNode();
      final HeapIdNode heapIdNode2 = (HeapIdNode) heapRecordRead
          .getIdNode();

      assertEquals("id1 file pos error",
          heapRecordWrote.getPositionInFile(),
          heapIdNode1.getPositionInFile());
      assertEquals("id2 file pos error",
          heapRecordRead.getPositionInFile(),
          heapIdNode2.getPositionInFile());
      assertEquals("id parent file pos error",
          heapIdNode1.getParentPositionInFile(),
          heapIdNode1.getParentPositionInFile());
      assertEquals("id right file pos error",
          heapIdNode1.getRightPositionInFile(),
View Full Code Here

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

      // ok
      previousPosition = position;
      final IRBTNode<DataRecordIdentifier> node = heapRecord.getIdNode();
      idNodeTree.append(node);

      final HeapIdNode foundNode = (HeapIdNode) idNodeTree
          .search(newDataRecordIdentifier(index));
      assertNotNull("must found nod", foundNode);
      assertEquals("must found appended node", node, foundNode);
      final HeapIdNode lastNode = (HeapIdNode) idNodeTree.last();
      assertEquals("not the last", newDataRecordIdentifier(index),
          lastNode.getElement());
    }
  }
View Full Code Here

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

      heapElementManager.appendHeapFileRecord(heapRecord);

      heapRecord.setDataAssociated(new byte[10]);// NOPMD new in loop is
      // ok
      previousPosition = position;
      final HeapIdNode node = (HeapIdNode) heapRecord.getIdNode();
      idNodeTree.append(node);
      heapElementManager.closeTransaction();
      heapElementManager.openTransaction();

      final HeapIdNode foundNode = (HeapIdNode) idNodeTree
          .search(newDataRecordIdentifier(index));
      assertNotNull("must found nod", foundNode);
      assertEquals("must found appended node", node, foundNode);
      final HeapIdNode lastNode = (HeapIdNode) idNodeTree.last();
      assertEquals("not the last", newDataRecordIdentifier(index),
          lastNode.getElement());
    }
  }
View Full Code Here

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

      throws HeapException, RBTException {
    if (heapRecord.isFreeRecord()) {
      throw new HeapException("must be a data record");
    }
    final DataRecordIdentifier identifier = heapRecord.getNodeIdentifier();
    final HeapIdNode foundIdNode = (HeapIdNode) idNodeTree
        .search(identifier);
    if (foundIdNode == null) {
      throw new HeapException("record for data, node #" + identifier
          + " must be in node identifier tree");
    }
    if (foundIdNode.getPositionInFile() != heapRecord.getPositionInFile()) {
      throw new HeapException("data record detached from id tree");
    }
  }
View Full Code Here

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

  }

  @Override
  protected IRBTNode<DataRecordIdentifier> getRootNode(
      final HeapHeader heapHeader) throws HeapException {
    final HeapIdNode heapIdRootNode;
    final long idRootNodeFilePosition = heapHeader
        .getIdRootNodeFilePosition();
    if (idRootNodeFilePosition == -1) {
      heapIdRootNode = null;
    } else {
View Full Code Here

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

      final DataRecordIdentifier dataRecordIdentifier)
      throws HeapException {
    if (logger.debugEnabled) {
      logger.debug("delete data record #" + dataRecordIdentifier);
    }
    final HeapIdNode heapIdNode = idNodeSearchMayBeNotExist(dataRecordIdentifier);
    final boolean deleted;
    if (heapIdNode == null) {
      deleted = false;
    } else {
      deleteDataRecord(heapIdNode);
View Full Code Here

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

  @Override
  protected DataRecordIdentifier removeFirstDataRecordImpl()
      throws HeapException {
    final DataRecordIdentifier dataRecordIdentifier;
    try {
      final HeapIdNode firstHeapIdNode = (HeapIdNode) idNodeTree.first();
      if (firstHeapIdNode == null) {
        dataRecordIdentifier = null;
      } else {
        dataRecordIdentifier = firstHeapIdNode.getElement();
        deleteDataRecord(firstHeapIdNode);
      }

    } catch (RBTException e) {
      final String message = "remove first data record failed";
View Full Code Here

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

   * @return heap identifier node for identifier, null if not exist
   * @throws HeapException
   */
  private HeapIdNode idNodeSearchMayBeNotExist(
      final DataRecordIdentifier identifier) throws HeapException {
    final HeapIdNode heapIdNode;
    try {
      heapIdNode = (HeapIdNode) idNodeTree.search(identifier);
    } catch (RBTException e) {
      final String message = SEARCH_FOR_IDENTIFIER_FAILED + IDENTIFIER2
          + identifier;
View Full Code Here

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

   * @return the heap record, null if not exist for identifier
   * @throws HeapException
   */
  private HeapRecord getHeapRecord(final DataRecordIdentifier identifier)
      throws HeapException {
    final HeapIdNode heapIdNode = idNodeSearchMayBeNotExist(identifier);
    final HeapRecord heapRecord;
    if (heapIdNode == null) {
      heapRecord = null;
    } else {
      final long positionInFile = heapIdNode.getPositionInFile();
      heapRecord = readHeapFileDataRecord(positionInFile);
    }
    return heapRecord;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.