HashBucketPage.java
/**
   * Inserts a new data entry into this page. If there is no room
   * on this page, recursively inserts in later pages of the list.  
   * If necessary, creates a new page at the end of the list.
   * Does not worry about keeping order between entries in different pages.
   * <br><br>
   * To insert a data entry into a bucket, apply insertEntry to the
   * primary page of the bucket.
   * 
   * @return true if inserting made this page dirty, false otherwise
   */
Inserts a new data entry into this page. If there is no room
on this page, recursively inserts in later pages of the list.
If necessary, creates a new page at the end of the list.
Does not worry about keeping order between entries in different pages.

To insert a data entry into a bucket, apply insertEntry to the
primary page of the bucket.

@return true if inserting made this page dirty, false otherwise
Inserts a new data entry into this page . If there is no room on this page recursively inserts in later pages of the list . If necessary creates a new page at the end of the list . Does not worry about keeping order between entries in different pages . To insert a data entry into a bucket apply insertEntry to the primary page of the bucket . @return true if inserting made this page dirty false otherwise
public boolean insertEntry(DataEntry entry) {
	  boolean dirty = false;
	  try 
	  {
		  dirty = super.insertEntry(entry);
	  }
	  catch (IllegalStateException e)
	  {
		  PageId nextPageId = new PageId();
		  nextPageId = this.getNextPage();
		  HashBucketPage nextPage = new HashBucketPage();
		  if (INVALID_PAGEID == nextPageId.pid) 	  
		  {
			  nextPageId = Minibase.DiskManager.allocate_page();
			  this.setNextPage(nextPageId);
			  dirty = true;			  
			  Minibase.BufferManager.pinPage(nextPageId, nextPage, PIN_MEMCPY);
		  }
		  else
		  {   
			  Minibase.BufferManager.pinPage(nextPageId, nextPage, PIN_DISKIO);
		  }
		  if (nextPage.insertEntry(entry) || true == dirty)
		  {
			  Minibase.BufferManager.unpinPage(nextPageId, UNPIN_DIRTY);
		  }
		  else
		  {
			  Minibase.BufferManager.unpinPage(nextPageId, UNPIN_CLEAN);
		  }	  
	  }
	  return dirty;
  }
public boolean insertEntry ( DataEntry entry ) { boolean dirty = false ; try { dirty = super . insertEntry ( entry ) ; } catch ( IllegalStateException e ) { PageId nextPageId = new PageId ( ) ; nextPageId = this . getNextPage ( ) ; HashBucketPage nextPage = new HashBucketPage ( ) ; if ( INVALID_PAGEID == nextPageId . pid ) { nextPageId = Minibase . DiskManager . allocate_page ( ) ; this . setNextPage ( nextPageId ) ; dirty = true ; Minibase . BufferManager . pinPage ( nextPageId , nextPage , PIN_MEMCPY ) ; } else { Minibase . BufferManager . pinPage ( nextPageId , nextPage , PIN_DISKIO ) ; } if ( nextPage . insertEntry ( entry ) || true == dirty ) { Minibase . BufferManager . unpinPage ( nextPageId , UNPIN_DIRTY ) ; } else { Minibase . BufferManager . unpinPage ( nextPageId , UNPIN_CLEAN ) ; } } return dirty ; }
Inserts a new data entry into this page.
Inserts a new data entry into this page .
// Try to insert the entry into this page, if it throws an IllegalStateException, then // there is not enough room on this page. // This page does not have enough space, we must insert into the next page on the list // There is no page after this one so we must create a new HashBucketPage  // Create the new HashBucketPage // Set this page's next page to the one we just created // This page is now dirty.  Will also indicate that we need to UNPIN_DIRTY the next page // Initialize the next page that we just created // Load the next page // Insert the entry into the next page // Leave page unpinned dirty (page was dirtied by call to insertEntry or new page creation) // Leave page unpinned clean (page was not dirtied by call to insertEntry, or by new page creation)