|
GATE Version 3.1-2270 |
|||||||||
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.CorpusImpl
public class CorpusImpl
Corpora are sets of Document. They are ordered by lexicographic collation on Url.
Nested Class Summary | |
---|---|
protected class |
CorpusImpl.VerboseList
A proxy list that stores the actual data in an internal list and forwards all operations to that one but it also fires the appropiate corpus events when necessary. |
Field Summary | |
---|---|
protected List |
documentsList
|
protected List |
supportList
The underlying list that holds the documents in this corpus. |
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 | |
---|---|
CorpusImpl()
|
Method Summary | |
---|---|
void |
add(int index,
Object element)
|
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()
Construction |
void |
clear()
|
protected void |
clearDocList()
|
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 |
boolean |
equals(Object o)
|
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. |
List |
getDocumentsList()
|
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()
|
Iterator |
iterator()
|
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
static void |
populate(Corpus corpus,
URL directory,
FileFilter filter,
String encoding,
boolean recurseDirectories)
Fills the provided corpus with documents created on the fly from selected files in a directory. |
void |
populate(URL directory,
FileFilter filter,
String encoding,
boolean recurseDirectories)
Fills this corpus with documents created from files in a directory. |
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 |
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 |
boolean |
retainAll(Collection c)
|
Object |
set(int index,
Object element)
|
void |
setDocumentsList(List documentsList)
|
int |
size()
|
List |
subList(int fromIndex,
int toIndex)
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
void |
unloadDocument(Document doc)
This method does not make sense for transient corpora, so it does nothing. |
Methods inherited from class gate.creole.AbstractLanguageResource |
---|
getDataStore, getLRPersistenceId, getParent, isModified, setDataStore, 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, toString, wait, wait, wait |
Methods inherited from interface gate.LanguageResource |
---|
getDataStore, getLRPersistenceId, getParent, isModified, setDataStore, 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 |
---|
protected List supportList
protected transient List documentsList
Constructor Detail |
---|
public CorpusImpl()
Method Detail |
---|
public List getDocumentNames()
getDocumentNames
in interface SimpleCorpus
CorpusImpl.VerboseList
of Strings representing the names of the documents
in this corpus.public String getDocumentName(int index)
getDocumentName
in interface SimpleCorpus
index
- the index of the document
public void unloadDocument(Document doc)
unloadDocument
in interface Corpus
doc
- Document to be unloaded from memory.public boolean isDocumentLoaded(int index)
isDocumentLoaded
in interface Corpus
protected void clearDocList()
public int size()
size
in interface Collection
size
in interface List
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
public boolean add(Object o)
add
in interface Collection
add
in interface List
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
public boolean addAll(int index, Collection c)
addAll
in interface List
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
public void clear()
clear
in interface Collection
clear
in interface List
public boolean equals(Object o)
equals
in interface Collection
equals
in interface List
equals
in class Object
public int hashCode()
hashCode
in interface Collection
hashCode
in interface List
hashCode
in class Object
public 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 element)
add
in interface List
public Object remove(int index)
remove
in interface List
public int indexOf(Object o)
indexOf
in interface List
public int lastIndexOf(Object o)
lastIndexOf
in interface List
public ListIterator listIterator()
listIterator
in interface List
public ListIterator listIterator(int index)
listIterator
in interface List
public List subList(int fromIndex, int toIndex)
subList
in interface List
public void cleanup()
cleanup
in interface Resource
cleanup
in class AbstractLanguageResource
public Resource init()
init
in interface Resource
init
in class AbstractResource
public static void populate(Corpus corpus, URL directory, FileFilter filter, String encoding, boolean recurseDirectories) throws IOException
FileFilter
to select which files will
be used and which will be ignored.
A simple file filter based on extensions is provided in the Gate
distribution (ExtensionFileFilter
).
corpus
- the corpus to be populateddirectory
- 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.filter
- the file filter used to select files from the target
directory. If the filter is null all the files will be accepted.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
public void populate(URL directory, FileFilter filter, String encoding, boolean recurseDirectories) throws IOException, ResourceInstantiationException
populate
in interface SimpleCorpus
filter
- 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
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
ResourceInstantiationException
public void removeCorpusListener(CorpusListener l)
Corpus
removeCorpusListener
in interface Corpus
l
- the listener to be removed.public void addCorpusListener(CorpusListener l)
Corpus
CorpusListener
with this corpus.
addCorpusListener
in interface Corpus
l
- the listener to be added.protected void fireDocumentAdded(CorpusEvent e)
protected void fireDocumentRemoved(CorpusEvent e)
public void setDocumentsList(List documentsList)
public List getDocumentsList()
public void resourceLoaded(CreoleEvent e)
CreoleListener
Resource
has been loaded into the system
resourceLoaded
in interface CreoleListener
public void resourceUnloaded(CreoleEvent e)
CreoleListener
Resource
has been removed from the system
resourceUnloaded
in interface CreoleListener
public void resourceRenamed(Resource resource, String oldName, String newName)
CreoleListener
resourceRenamed
in interface CreoleListener
public void datastoreOpened(CreoleEvent e)
CreoleListener
DataStore
has been opened
datastoreOpened
in interface CreoleListener
public void datastoreCreated(CreoleEvent e)
CreoleListener
DataStore
has been created
datastoreCreated
in interface CreoleListener
public void datastoreClosed(CreoleEvent e)
CreoleListener
DataStore
has been closed
datastoreClosed
in interface CreoleListener
|
GATE Version 3.1-2270 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |