|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectgate.util.AbstractFeatureBearer
gate.creole.AbstractResource
gate.creole.AbstractLanguageResource
gate.corpora.SerialCorpusImpl
| Field Summary | |
protected List |
addedDocs
|
protected List |
changedDocs
|
protected Vector |
corpusListeners
|
private static boolean |
DEBUG
Debug flag |
protected List |
docDataList
|
protected List |
documents
|
protected IndexManager |
indexManager
|
protected List |
removedDocIDs
|
(package private) static long |
serialVersionUID
|
| Fields inherited from class gate.creole.AbstractLanguageResource |
dataStore, lrPersistentId |
| Fields inherited from class gate.creole.AbstractResource |
name |
| Fields inherited from class gate.util.AbstractFeatureBearer |
features |
| Fields inherited from interface gate.SimpleCorpus |
CORPUS_DOCLIST_PARAMETER_NAME, CORPUS_NAME_PARAMETER_NAME |
| Constructor Summary | |
|
SerialCorpusImpl()
|
protected |
SerialCorpusImpl(Corpus tCorpus)
Constructor to create a SerialCorpus from a transient one. |
| Method Summary | |
void |
add(int index,
Object o)
|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
boolean |
addAll(int index,
Collection c)
|
void |
addCorpusListener(CorpusListener l)
Registers a new CorpusListener with this corpus. |
void |
cleanup()
Every LR that is a CreoleListener (and other Listeners too) must override this method and make sure it removes itself from the objects which it has been listening to. |
void |
clear()
|
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
void |
datastoreClosed(CreoleEvent e)
Called when a DataStore has been closed |
void |
datastoreCreated(CreoleEvent e)
Called when a DataStore has been created |
void |
datastoreOpened(CreoleEvent e)
Called when a DataStore has been opened |
private void |
documentAdded(Document doc)
|
private void |
documentRemoved(String lrID)
|
boolean |
equals(Object o)
|
int |
findDocument(Document doc)
|
protected void |
fireDocumentAdded(CorpusEvent e)
|
protected void |
fireDocumentRemoved(CorpusEvent e)
|
Object |
get(int index)
|
String |
getDocumentName(int index)
Gets the name of a document in this corpus. |
List |
getDocumentNames()
Gets the names of the documents in this corpus. |
IndexDefinition |
getIndexDefinition()
|
IndexManager |
getIndexManager()
|
IndexStatistics |
getIndexStatistics()
|
Object |
getTransientSource()
|
int |
hashCode()
|
int |
indexOf(Object o)
|
Resource |
init()
Initialise this resource, and return it. |
boolean |
isDocumentLoaded(int index)
This method returns true when the document is already loaded in memory |
boolean |
isEmpty()
|
boolean |
isPersistentDocument(int index)
This method returns true when the document is already stored on disk i.e., is not transient |
Iterator |
iterator()
|
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
void |
populate(URL directory,
FileFilter filter,
String encoding,
boolean recurseDirectories)
Fills this corpus with documents created from files in a directory. |
private void |
readObject(ObjectInputStream s)
readObject - calls the default readObject() and then initialises the transient data |
Object |
remove(int index)
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
void |
removeCorpusListener(CorpusListener l)
Removes one of the listeners registered with this corpus. |
void |
resourceAdopted(DatastoreEvent evt)
Called by a datastore when a new resource has been adopted |
void |
resourceDeleted(DatastoreEvent evt)
Called by a datastore when a resource has been deleted |
void |
resourceLoaded(CreoleEvent e)
Called when a new Resource has been loaded into the system |
void |
resourceRenamed(Resource resource,
String oldName,
String newName)
Called when the creole register has renamed a resource.1 |
void |
resourceUnloaded(CreoleEvent e)
Called when a Resource has been removed from the system |
void |
resourceWritten(DatastoreEvent evt)
Called by a datastore when a resource has been wrote into the datastore |
boolean |
retainAll(Collection c)
|
Object |
set(int index,
Object element)
|
void |
setDataStore(DataStore dataStore)
Set the data store that this LR lives in. |
void |
setDocumentPersistentID(int index,
Object persID)
This method should only be used by the Serial Datastore to set |
void |
setIndexDefinition(IndexDefinition definition)
Sets the definition to this corpus. |
void |
setTransientSource(Object source)
|
int |
size()
|
List |
subList(int fromIndex,
int toIndex)
persistent Corpus does not support this method as all the documents might no be in memory |
private void |
thisResourceWritten()
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
String |
toString()
|
void |
unloadDocument(Document doc)
Unloads a document from memory |
void |
unloadDocument(int index)
Unloads the document from memory, but calls sync() first, to store the changes |
| Methods inherited from class gate.creole.AbstractLanguageResource |
getDataStore, getLRPersistenceId, getParent, isModified, setLRPersistenceId, setParent, sync |
| Methods inherited from class gate.creole.AbstractResource |
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners |
| Methods inherited from class gate.util.AbstractFeatureBearer |
getFeatures, setFeatures |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface gate.LanguageResource |
getDataStore, getLRPersistenceId, getParent, isModified, setLRPersistenceId, setParent, sync |
| Methods inherited from interface gate.Resource |
getParameterValue, setParameterValue, setParameterValues |
| Methods inherited from interface gate.util.FeatureBearer |
getFeatures, setFeatures |
| Methods inherited from interface gate.util.NameBearer |
getName, setName |
| Field Detail |
private static final boolean DEBUG
static final long serialVersionUID
protected transient Vector corpusListeners
protected List docDataList
protected transient List documents
protected transient IndexManager indexManager
protected transient List addedDocs
protected transient List removedDocIDs
protected transient List changedDocs
| Constructor Detail |
public SerialCorpusImpl()
protected SerialCorpusImpl(Corpus tCorpus)
| Method Detail |
public List getDocumentNames()
getDocumentNames in interface SimpleCorpusList of Strings representing the names of the documents
in this corpus.
public void setDocumentPersistentID(int index,
Object persID)
public String getDocumentName(int index)
getDocumentName in interface SimpleCorpusindex - the index of the document
public void unloadDocument(int index)
public void unloadDocument(Document doc)
unloadDocument in interface Corpusdoc - Document to be unloaded from memory.
public boolean isDocumentLoaded(int index)
isDocumentLoaded in interface Corpuspublic boolean isPersistentDocument(int index)
public void cleanup()
cleanup in interface Resourcecleanup in class AbstractLanguageResource
public void populate(URL directory,
FileFilter filter,
String encoding,
boolean recurseDirectories)
throws IOException,
ResourceInstantiationException
populate in interface SimpleCorpusfilter - the file filter used to select files from the target
directory. If the filter is null all the files will be accepted.directory - the directory from which the files will be picked. This
parameter is an URL for uniformity. It needs to be a URL of type file
otherwise an InvalidArgumentException will be thrown.
An implementation for this method is provided as a static method at
CorpusImpl.populate(Corpus, URL, FileFilter, String, boolean).encoding - the encoding to be used for reading the documentsrecurseDirectories - should the directory be parsed recursively?. If
true all the files from the provided directory and all its
children directories (on as many levels as necessary) will be picked if
accepted by the filter otherwise the children directories will be ignored.
IOException
ResourceInstantiationExceptionpublic void removeCorpusListener(CorpusListener l)
Corpus
removeCorpusListener in interface Corpusl - the listener to be removed.public void addCorpusListener(CorpusListener l)
CorpusCorpusListener with this corpus.
addCorpusListener in interface Corpusl - the listener to be added.protected void fireDocumentAdded(CorpusEvent e)
protected void fireDocumentRemoved(CorpusEvent e)
public void resourceLoaded(CreoleEvent e)
CreoleListenerResource has been loaded into the system
resourceLoaded in interface CreoleListener
public void resourceRenamed(Resource resource,
String oldName,
String newName)
CreoleListener
resourceRenamed in interface CreoleListenerpublic void resourceUnloaded(CreoleEvent e)
CreoleListenerResource has been removed from the system
resourceUnloaded in interface CreoleListenerpublic void datastoreOpened(CreoleEvent e)
CreoleListenerDataStore has been opened
datastoreOpened in interface CreoleListenerpublic void datastoreCreated(CreoleEvent e)
CreoleListenerDataStore has been created
datastoreCreated in interface CreoleListenerpublic void datastoreClosed(CreoleEvent e)
CreoleListenerDataStore has been closed
datastoreClosed in interface CreoleListenerpublic void resourceAdopted(DatastoreEvent evt)
resourceAdopted in interface DatastoreListenerpublic void resourceDeleted(DatastoreEvent evt)
resourceDeleted in interface DatastoreListenerpublic void resourceWritten(DatastoreEvent evt)
resourceWritten in interface DatastoreListenerpublic int size()
size in interface Listpublic boolean isEmpty()
isEmpty in interface Listpublic boolean contains(Object o)
contains in interface Listpublic Iterator iterator()
iterator in interface Listpublic String toString()
public Object[] toArray()
toArray in interface Listpublic Object[] toArray(Object[] a)
toArray in interface Listpublic boolean add(Object o)
add in interface Listpublic boolean remove(Object o)
remove in interface Listpublic int findDocument(Document doc)
public boolean containsAll(Collection c)
containsAll in interface Listpublic boolean addAll(Collection c)
addAll in interface List
public boolean addAll(int index,
Collection c)
addAll in interface Listpublic boolean removeAll(Collection c)
removeAll in interface Listpublic boolean retainAll(Collection c)
retainAll in interface Listpublic void clear()
clear in interface Listpublic boolean equals(Object o)
equals in interface Listpublic int hashCode()
hashCode in interface Listpublic Object get(int index)
get in interface List
public Object set(int index,
Object element)
set in interface List
public void add(int index,
Object o)
add in interface Listpublic Object remove(int index)
remove in interface Listpublic int indexOf(Object o)
indexOf in interface Listpublic int lastIndexOf(Object o)
lastIndexOf in interface Listpublic ListIterator listIterator()
listIterator in interface Listpublic ListIterator listIterator(int index)
listIterator in interface List
public List subList(int fromIndex,
int toIndex)
subList in interface List
public void setDataStore(DataStore dataStore)
throws PersistenceException
LanguageResource
setDataStore in interface LanguageResourcesetDataStore in class AbstractLanguageResourcePersistenceExceptionpublic void setTransientSource(Object source)
public Object getTransientSource()
public Resource init()
throws ResourceInstantiationException
Resource
init in interface Resourceinit in class AbstractResourceResourceInstantiationException
private void readObject(ObjectInputStream s)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundExceptionpublic void setIndexDefinition(IndexDefinition definition)
IndexedCorpus
setIndexDefinition in interface IndexedCorpusdefinition - of index for this corpuspublic IndexDefinition getIndexDefinition()
getIndexDefinition in interface IndexedCorpuspublic IndexManager getIndexManager()
getIndexManager in interface IndexedCorpuspublic IndexStatistics getIndexStatistics()
getIndexStatistics in interface IndexedCorpusprivate void documentAdded(Document doc)
private void documentRemoved(String lrID)
private void thisResourceWritten()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||