1 19 package org.netbeans.mdr.persistence.btreeimpl.btreeindex; 20 import org.netbeans.mdr.persistence.*; 21 import java.io.*; 22 import java.util.*; 23 24 31 public class BtreeCollection extends AbstractCollection { 32 33 protected Btree btree; 34 35 40 public BtreeCollection(Btree btree) { 41 this.btree = btree; 42 } 43 44 47 public int size() { 48 try { 49 btree.beginRead(); 50 return btree.countRecords(); 51 } catch (StorageException e) { 52 } finally { 53 btree.endRead(); 54 } 55 return 0; 56 } 57 58 public boolean isEmpty() { 59 return !iterator().hasNext(); 60 } 61 62 65 public Iterator iterator() { 66 return new BtreeIterator(btree); 67 } 68 } 69 | Popular Tags |