GATE
Version 3.1-2270

gate.corpora
Class DatabaseCorpusImpl

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractLanguageResource
              extended by gate.corpora.CorpusImpl
                  extended by gate.corpora.DatabaseCorpusImpl
All Implemented Interfaces:
EventAwareCorpus, EventAwareLanguageResource, Corpus, CreoleListener, DatastoreListener, LanguageResource, Resource, SimpleCorpus, FeatureBearer, NameBearer, Serializable, Iterable, Collection, EventListener, List

public class DatabaseCorpusImpl
extends CorpusImpl
implements DatastoreListener, EventAwareCorpus

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class gate.corpora.CorpusImpl
CorpusImpl.VerboseList
 
Field Summary
protected  List addedDocuments
           
protected  List documentData
           
protected  gate.corpora.DatabaseCorpusImpl.EventsHandler eventHandler
          The listener for the events coming from the features.
protected  List removedDocuments
           
 
Fields inherited from class gate.corpora.CorpusImpl
documentsList, supportList
 
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.corpora.EventAwareLanguageResource
DOC_CONTENT, DOC_MAIN, RES_FEATURES, RES_NAME
 
Fields inherited from interface gate.SimpleCorpus
CORPUS_DOCLIST_PARAMETER_NAME, CORPUS_NAME_PARAMETER_NAME
 
Constructor Summary
DatabaseCorpusImpl()
           
DatabaseCorpusImpl(String _name, DatabaseDataStore _ds, Long _persistenceID, FeatureMap _features, Vector _dbDocs)
           
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 boolean addAll(int index, Collection c)
           
 void cleanup()
          Overriden to remove the features listener, when the document is closed.
 boolean contains(Object o)
           
 boolean equals(Object o)
           
 int findDocument(Document doc)
           
 Object get(int index)
          returns a document in the coprus by index
 List getAddedDocuments()
           
 String getDocumentName(int index)
          Gets the name of a document in this corpus.
 List getDocumentNames()
          Gets the names of the documents in this corpus.
 Object getInitData__$$__(Object initData)
           
 List getLoadedDocuments()
           
 List getRemovedDocuments()
           
 boolean isDocumentLoaded(int index)
          This method returns true when the document is already loaded in memory
 boolean isModified()
          Returns true of an LR has been modified since the last sync.
 boolean isPersistentDocument(int index)
          This method returns true when the document is already stored on disk i.e., is not transient
 boolean isResourceChanged(int changeType)
           
 Iterator iterator()
           
 Object remove(int index)
           
 boolean remove(Object obj)
           
 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 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
 void setFeatures(FeatureMap features)
          Set the feature set
 void setInitData__$$__(Object data)
           
 void setName(String name)
          Sets the name of this resource
 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.corpora.CorpusImpl
addCorpusListener, clear, clearDocList, containsAll, datastoreClosed, datastoreCreated, datastoreOpened, fireDocumentAdded, fireDocumentRemoved, getDocumentsList, hashCode, indexOf, init, isEmpty, lastIndexOf, listIterator, listIterator, populate, populate, removeAll, removeCorpusListener, resourceLoaded, resourceRenamed, retainAll, set, setDocumentsList, size, subList, toArray, toArray
 
Methods inherited from class gate.creole.AbstractLanguageResource
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, removeResourceListeners, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures
 
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, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures
 
Methods inherited from interface gate.util.NameBearer
getName
 

Field Detail

eventHandler

protected gate.corpora.DatabaseCorpusImpl.EventsHandler eventHandler
The listener for the events coming from the features.


documentData

protected List documentData

removedDocuments

protected List removedDocuments

addedDocuments

protected List addedDocuments
Constructor Detail

DatabaseCorpusImpl

public DatabaseCorpusImpl()

DatabaseCorpusImpl

public DatabaseCorpusImpl(String _name,
                          DatabaseDataStore _ds,
                          Long _persistenceID,
                          FeatureMap _features,
                          Vector _dbDocs)
Method Detail

add

public boolean add(Object o)
Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class CorpusImpl

add

public void add(int index,
                Object element)
Specified by:
add in interface List
Overrides:
add in class CorpusImpl

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Overrides:
addAll in class CorpusImpl

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class CorpusImpl

resourceAdopted

public void resourceAdopted(DatastoreEvent evt)
Description copied from interface: DatastoreListener
Called by a datastore when a new resource has been adopted

Specified by:
resourceAdopted in interface DatastoreListener

resourceDeleted

public void resourceDeleted(DatastoreEvent evt)
Description copied from interface: DatastoreListener
Called by a datastore when a resource has been deleted

Specified by:
resourceDeleted in interface DatastoreListener

resourceWritten

public void resourceWritten(DatastoreEvent evt)
Description copied from interface: DatastoreListener
Called by a datastore when a resource has been wrote into the datastore

Specified by:
resourceWritten in interface DatastoreListener

resourceUnloaded

public void resourceUnloaded(CreoleEvent e)
Description copied from interface: CreoleListener
Called when a Resource has been removed from the system

Specified by:
resourceUnloaded in interface CreoleListener
Overrides:
resourceUnloaded in class CorpusImpl

isResourceChanged

public boolean isResourceChanged(int changeType)
Specified by:
isResourceChanged in interface EventAwareLanguageResource

isModified

public boolean isModified()
Returns true of an LR has been modified since the last sync. Always returns false for transient LRs.

Specified by:
isModified in interface LanguageResource
Overrides:
isModified in class AbstractLanguageResource

setName

public void setName(String name)
Sets the name of this resource

Specified by:
setName in interface NameBearer
Overrides:
setName in class AbstractResource

setFeatures

public void setFeatures(FeatureMap features)
Set the feature set

Specified by:
setFeatures in interface FeatureBearer
Overrides:
setFeatures in class AbstractFeatureBearer

cleanup

public void cleanup()
Overriden to remove the features listener, when the document is closed.

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class CorpusImpl

setInitData__$$__

public void setInitData__$$__(Object data)

getInitData__$$__

public Object getInitData__$$__(Object initData)

getDocumentNames

public List getDocumentNames()
Gets the names of the documents in this corpus.

Specified by:
getDocumentNames in interface SimpleCorpus
Overrides:
getDocumentNames in class CorpusImpl
Returns:
a List of Strings representing the names of the documents in this corpus.

getDocumentName

public String getDocumentName(int index)
Gets the name of a document in this corpus.

Specified by:
getDocumentName in interface SimpleCorpus
Overrides:
getDocumentName in class CorpusImpl
Parameters:
index - the index of the document
Returns:
a String value representing the name of the document at index in this corpus.


get

public Object get(int index)
returns a document in the coprus by index

Specified by:
get in interface List
Overrides:
get in class CorpusImpl
Parameters:
index - the index of the document
Returns:
an Object value representing DatabaseDocumentImpl

remove

public Object remove(int index)
Specified by:
remove in interface List
Overrides:
remove in class CorpusImpl

remove

public boolean remove(Object obj)
Specified by:
remove in interface Collection
Specified by:
remove in interface List
Overrides:
remove in class CorpusImpl

findDocument

public int findDocument(Document doc)

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List
Overrides:
contains in class CorpusImpl

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Overrides:
iterator in class CorpusImpl

getLoadedDocuments

public List getLoadedDocuments()
Specified by:
getLoadedDocuments in interface EventAwareCorpus

getRemovedDocuments

public List getRemovedDocuments()
Specified by:
getRemovedDocuments in interface EventAwareCorpus

getAddedDocuments

public List getAddedDocuments()
Specified by:
getAddedDocuments in interface EventAwareCorpus

unloadDocument

public void unloadDocument(int index)
Unloads the document from memory, but calls sync() first, to store the changes


unloadDocument

public void unloadDocument(Document doc)
Unloads a document from memory

Specified by:
unloadDocument in interface Corpus
Overrides:
unloadDocument in class CorpusImpl
Parameters:
doc - Document to be unloaded from memory.

isDocumentLoaded

public boolean isDocumentLoaded(int index)
This method returns true when the document is already loaded in memory

Specified by:
isDocumentLoaded in interface Corpus
Overrides:
isDocumentLoaded in class CorpusImpl

isPersistentDocument

public boolean isPersistentDocument(int index)
This method returns true when the document is already stored on disk i.e., is not transient


equals

public boolean equals(Object o)
Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class CorpusImpl

GATE
Version 3.1-2270