HashIndex.java
/**
   * Prints a high-level view of the directory, namely which buckets are
   * allocated and how many entries are stored in each one. Sample output:
   * 
   * <pre>
   * IX_Customers
   * ------------
   * 0000000 : 35
   * 0000001 : null
   * 0000010 : 27
   * ...
   * 1111111 : 42
   * ------------
   * Total : 1500
   * </pre>
   */
Prints a high-level view of the directory, namely which buckets are
allocated and how many entries are stored in each one. Sample output.






Prints a high - level view of the directory namely which buckets are allocated and how many entries are stored in each one . Sample output .
public void printSummary() {
	  System.out.println("IX_Customers\n");
	  System.out.println("------------\n");
	  Page directoryPage = new Page();
	  Minibase.BufferManager.pinPage(headId, directoryPage, PIN_DISKIO);
	  for (int i = 0; i < BUCKETS_AMOUNT; i++)
	  {
		  PageId primaryBucketId = new PageId(directoryPage.getIntValue(i * INT_SIZE));
		  HashBucketPage primaryBucketPage = new HashBucketPage();
		  String numberOfEntries = new String();
		  if (INVALID_PAGEID == primaryBucketId.pid)
		  { 
			  numberOfEntries = "null";
		  }
		  else
		  {
			  Minibase.BufferManager.pinPage(primaryBucketId, primaryBucketPage, PIN_DISKIO); 
			  numberOfEntries = Integer.toString(primaryBucketPage.countEntries());
			  Minibase.BufferManager.unpinPage(primaryBucketId, UNPIN_CLEAN);	
		  }
		  System.out.println(Integer.toString(i,2) + " : " + numberOfEntries + "\n");
	  }
	  Minibase.BufferManager.unpinPage(headId, UNPIN_CLEAN);
  }
public void printSummary ( ) { System . out . println ( "IX_Customers\n" ) ; System . out . println ( "------------\n" ) ; Page directoryPage = new Page ( ) ; Minibase . BufferManager . pinPage ( headId , directoryPage , PIN_DISKIO ) ; for ( int i = 0 ; i < BUCKETS_AMOUNT ; i ++ ) { PageId primaryBucketId = new PageId ( directoryPage . getIntValue ( i * INT_SIZE ) ) ; HashBucketPage primaryBucketPage = new HashBucketPage ( ) ; String numberOfEntries = new String ( ) ; if ( INVALID_PAGEID == primaryBucketId . pid ) { numberOfEntries = "null" ; } else { Minibase . BufferManager . pinPage ( primaryBucketId , primaryBucketPage , PIN_DISKIO ) ; numberOfEntries = Integer . toString ( primaryBucketPage . countEntries ( ) ) ; Minibase . BufferManager . unpinPage ( primaryBucketId , UNPIN_CLEAN ) ; } System . out . println ( Integer . toString ( i , 2 ) + " : " + numberOfEntries + "\n" ) ; } Minibase . BufferManager . unpinPage ( headId , UNPIN_CLEAN ) ; }
Prints a high-level view of the directory, namely which buckets are
 allocated and how many entries are stored in each one.
Prints a high - level view of the directory namely which buckets are allocated and how many entries are stored in each one .
// Print header // Load the directory page // Get the page Id of the primary bucket page at that index // No primary bucket page for that index  // Load the primary bucket page for this index // Get our entry count for this page and any linked bucket pages // Unpin our bucket page to leave it as we found it // Unpin our directory page to leave it as we found it