Beispiel #1
0
  /**
   * For debug. Print all leaf pages of the B+ tree out
   *
   * @param header the head page of the B+ tree file
   * @exception IOException error from the lower layer
   * @exception ConstructPageException error for BT page constructor
   * @exception IteratorException error from iterator
   * @exception HashEntryNotFoundException error from lower layer
   * @exception InvalidFrameNumberException error from lower layer
   * @exception PageUnpinnedException error from lower layer
   * @exception ReplacerException error from lower layer
   */
  public static void printAllLeafPages(BTreeHeaderPage header)
      throws IOException, ConstructPageException, IteratorException, HashEntryNotFoundException,
          InvalidFrameNumberException, PageUnpinnedException, ReplacerException {
    if (header.get_rootId().pid == INVALID_PAGE) {
      System.out.println("The Tree is Empty!!!");
      return;
    }

    System.out.println("");
    System.out.println("");
    System.out.println("");
    System.out.println("---------------The B+ Tree Leaf Pages---------------");

    _printAllLeafPages(header.get_rootId(), header.get_keyType());

    System.out.println("");
    System.out.println("");
    System.out.println("------------- All Leaf Pages Have Been Printed --------");
    System.out.println("");
    System.out.println("");
  }
Beispiel #2
0
  /**
   * For debug. Print the B+ tree structure out
   *
   * @param header the head page of the B+ tree file
   * @exception IOException error from the lower layer
   * @exception ConstructPageException error from BT page constructor
   * @exception IteratorException error from iterator
   * @exception HashEntryNotFoundException error from lower layer
   * @exception InvalidFrameNumberException error from lower layer
   * @exception PageUnpinnedException error from lower layer
   * @exception ReplacerException error from lower layer
   */
  public static void printBTree(BTreeHeaderPage header)
      throws IOException, ConstructPageException, IteratorException, HashEntryNotFoundException,
          InvalidFrameNumberException, PageUnpinnedException, ReplacerException {
    if (header.get_rootId().pid == INVALID_PAGE) {
      System.out.println("The Tree is Empty!!!");
      return;
    }

    System.out.println("");
    System.out.println("");
    System.out.println("");
    System.out.println("---------------The B+ Tree Structure---------------");

    System.out.println(1 + "     " + header.get_rootId());

    _printTree(header.get_rootId(), "     ", 1, header.get_keyType());

    System.out.println("--------------- End ---------------");
    System.out.println("");
    System.out.println("");
  }