1 package org.paneris.bibliomania.metasearch.util; 2 3 import java.util.Enumeration; 4 import java.util.NoSuchElementException; 5 6 import org.paneris.bibliomania.metasearch.BookStockingFactory; 7 8 public abstract class SearchResultsBase 9 extends HackParser implements Enumeration { 10 11 protected BookStockingFactory stockings; 12 13 public SearchResultsBase(byte[] text, 14 BookStockingFactory stockings) { 15 super(text); 16 this.stockings = stockings; 17 } 18 19 protected abstract Object more(); 20 21 private Object next = null; 22 23 public synchronized boolean hasMoreElements() { 24 return next != null || (next = more()) != null; 25 } 26 27 public synchronized Object nextElement() { 28 if (!hasMoreElements()) 29 throw new NoSuchElementException(); 30 Object it = next; 31 next = null; 32 return it; 33 } 34 }