Corpus.java |
1 /* 2 * Corpus.java 3 * 4 * Copyright (c) 1998-2005, The University of Sheffield. 5 * 6 * This file is part of GATE (see http://gate.ac.uk/), and is free 7 * software, licenced under the GNU Library General Public License, 8 * Version 2, June 1991 (in the distribution as file licence.html, 9 * and also available at http://gate.ac.uk/gate/licence.html). 10 * 11 * Hamish Cunningham, 19/Jan/2000 12 * 13 * $Id: Corpus.java,v 1.24 2005/01/11 13:51:30 ian Exp $ 14 */ 15 16 package gate; 17 import java.util.List; 18 19 import gate.event.CorpusListener; 20 21 /** Corpora are lists of Document. TIPSTER equivalent: Collection. 22 */ 23 public interface Corpus extends SimpleCorpus { 24 25 /** 26 * Unloads the document from memory. Only needed if memory 27 * preservation is an issue. Only supported for Corpus which is 28 * stored in a Datastore. To get this document back in memory, 29 * use get() on Corpus or if you have its persistent ID, request it 30 * from the Factory. 31 * <P> 32 * Transient Corpus objects do nothing, 33 * because there would be no way to get the document back 34 * again afterwards. 35 * @param doc Document to be unloaded from memory. 36 * @return void. 37 */ 38 public void unloadDocument(Document doc); 39 40 /** 41 * This method returns true when the document is already loaded in memory. 42 * The transient corpora will always return true as they can only contain 43 * documents that are present in the memory. 44 */ 45 public boolean isDocumentLoaded(int index); 46 47 48 /** 49 * Removes one of the listeners registered with this corpus. 50 * @param l the listener to be removed. 51 */ 52 public void removeCorpusListener(CorpusListener l); 53 54 /** 55 * Registers a new {@link CorpusListener} with this corpus. 56 * @param l the listener to be added. 57 */ 58 public void addCorpusListener(CorpusListener l); 59 60 } // interface Corpus 61