1 11 package org.eclipse.core.internal.indexing; 12 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 public class ReservationTable { 17 18 protected Map table = new HashMap (); 19 20 public ReservationTable() { 21 super(); 22 } 23 24 public Reservation get(int pageNumber) { 25 return (Reservation) table.get(new Integer (pageNumber)); 26 } 27 28 public void put(int pageNumber, Reservation r) { 29 table.put(new Integer (pageNumber), r); 30 } 31 32 public boolean contains(int pageNumber) { 33 return table.containsKey(new Integer (pageNumber)); 34 } 35 36 public boolean contains(ObjectAddress address) { 37 int pageNumber = address.getPageNumber(); 38 int objectNumber = address.getObjectNumber(); 39 if (contains(pageNumber)) { 40 if (get(pageNumber).contains(objectNumber)) 41 return true; 42 } 43 return false; 44 } 45 46 public void remove(ObjectAddress address) { 47 int pageNumber = address.getPageNumber(); 48 int objectNumber = address.getObjectNumber(); 49 Reservation r = (Reservation) table.get(new Integer (pageNumber)); 50 if (r == null) 51 return; 52 r.remove(objectNumber); 53 } 54 55 public void clear() { 56 table.clear(); 57 } 58 59 } 60 | Popular Tags |