1 11 package org.eclipse.core.internal.indexing; 12 13 import java.util.Observable ; 14 15 public abstract class Page extends Observable implements Referable { 16 17 public static final int SIZE = 8192; 18 19 protected int pageNumber; 20 protected int referenceCount; 21 protected Buffer pageBuffer; 22 protected PageStore pageStore; 23 24 27 public Page(int pageNumber, PageStore pageStore) { 28 this.pageNumber = pageNumber; 29 this.pageStore = pageStore; 30 this.referenceCount = 0; 31 } 32 33 36 public int addReference() { 37 referenceCount++; 38 return referenceCount; 39 } 40 41 44 public int getPageNumber() { 45 return pageNumber; 46 } 47 48 51 public boolean hasReferences() { 52 return referenceCount > 0; 53 } 54 55 58 public void release() { 59 pageStore.release(this); 60 } 61 62 65 public int removeReference() { 66 if (referenceCount > 0) 67 referenceCount--; 68 return referenceCount; 69 } 70 71 74 public abstract void toBuffer(byte[] buffer); 75 76 } 77 | Popular Tags |