gate.annotation
Class DatabaseAnnotationSetImpl

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended bygate.annotation.AnnotationSetImpl
              extended bygate.annotation.DatabaseAnnotationSetImpl
All Implemented Interfaces:
AnnotationListener, AnnotationSet, Cloneable, Collection, DatastoreListener, EventAwareAnnotationSet, EventListener, Serializable, Set

public class DatabaseAnnotationSetImpl
extends AnnotationSetImpl
implements DatastoreListener, EventAwareAnnotationSet, AnnotationListener

See Also:
Serialized Form

Nested Class Summary
(package private)  class DatabaseAnnotationSetImpl.DatabaseAnnotationSetIterator
           
 
Nested classes inherited from class gate.annotation.AnnotationSetImpl
AnnotationSetImpl.AnnotationSetIterator, AnnotationSetImpl.VerboseHashMap
 
Field Summary
protected  HashSet addedAnnotations
          The listener for the events coming from the document (annotations and annotation sets added or removed).
protected  HashSet removedAnnotations
           
protected  HashSet updatedAnnotations
           
private  boolean validating
           
 
Fields inherited from class gate.annotation.AnnotationSetImpl
annotationSetListeners, annotsByEndNode, annotsById, annotsByStartNode, annotsByType, doc, name, nodesByOffset, serialVersionUID
 
Constructor Summary
DatabaseAnnotationSetImpl(Collection c)
          Construction from Collection (which must be an AnnotationSet)
DatabaseAnnotationSetImpl(Document doc)
          Construction from Document.
DatabaseAnnotationSetImpl(Document doc, Collection c)
          Construction from Document and name.
DatabaseAnnotationSetImpl(Document doc, String name)
          Construction from Document and name.
DatabaseAnnotationSetImpl(Document doc, String name, Collection c)
          Construction from Document and name.
 
Method Summary
 boolean add(Object o)
          Add an existing annotation.
 void annotationUpdated(AnnotationEvent e)
          Called when an Annotation has been updated
 void assertValid()
           
private  void clearChangeLists()
           
protected  void fireAnnotationRemoved(AnnotationSetEvent e)
           
 Collection getAddedAnnotations()
           
 Collection getChangedAnnotations()
           
 Collection getRemovedAnnotations()
           
 Iterator iterator()
          Get an iterator for this set
 boolean remove(Object o)
          Remove an element from this set.
 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 resourceWritten(DatastoreEvent evt)
          Called by a datastore when a resource has been wrote into the datastore
 String toString()
           
 
Methods inherited from class gate.annotation.AnnotationSetImpl
add, add, add, addAll, addAllKeepIDs, addAnnotationSetListener, addGateListener, addToEndOffsetIndex, addToOffsetIndex, addToStartOffsetIndex, addToTypeIndex, clone, edit, fireAnnotationAdded, fireGateEvent, firstNode, get, get, get, get, get, get, get, get, get, get, getAllTypes, getContained, getDocument, getName, getStrict, indexByEndOffset, indexByStartOffset, indexByType, lastNode, nextNode, removeAnnotationSetListener, removeFromIdIndex, removeFromOffsetIndex, removeFromTypeIndex, removeGateListener, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
clear, contains, containsAll, isEmpty, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.AnnotationSet
add, add, add, addAnnotationSetListener, addGateListener, firstNode, get, get, get, get, get, get, get, get, get, get, getAllTypes, getContained, getDocument, getName, lastNode, nextNode, removeAnnotationSetListener, removeGateListener, size
 
Methods inherited from interface java.util.Set
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Field Detail

addedAnnotations

protected HashSet addedAnnotations
The listener for the events coming from the document (annotations and annotation sets added or removed).


removedAnnotations

protected HashSet removedAnnotations

updatedAnnotations

protected HashSet updatedAnnotations

validating

private boolean validating
Constructor Detail

DatabaseAnnotationSetImpl

public DatabaseAnnotationSetImpl(Document doc)
Construction from Document.


DatabaseAnnotationSetImpl

public DatabaseAnnotationSetImpl(Document doc,
                                 String name)
Construction from Document and name.


DatabaseAnnotationSetImpl

public DatabaseAnnotationSetImpl(Document doc,
                                 Collection c)
Construction from Document and name.


DatabaseAnnotationSetImpl

public DatabaseAnnotationSetImpl(Document doc,
                                 String name,
                                 Collection c)
Construction from Document and name.


DatabaseAnnotationSetImpl

public DatabaseAnnotationSetImpl(Collection c)
                          throws ClassCastException
Construction from Collection (which must be an AnnotationSet)

Method Detail

assertValid

public void assertValid()

toString

public String toString()

resourceAdopted

public void resourceAdopted(DatastoreEvent evt)
Called by a datastore when a new resource has been adopted

Specified by:
resourceAdopted in interface DatastoreListener

resourceDeleted

public void resourceDeleted(DatastoreEvent evt)
Called by a datastore when a resource has been deleted

Specified by:
resourceDeleted in interface DatastoreListener

resourceWritten

public void resourceWritten(DatastoreEvent evt)
Called by a datastore when a resource has been wrote into the datastore

Specified by:
resourceWritten in interface DatastoreListener

clearChangeLists

private void clearChangeLists()

getAddedAnnotations

public Collection getAddedAnnotations()
Specified by:
getAddedAnnotations in interface EventAwareAnnotationSet

getChangedAnnotations

public Collection getChangedAnnotations()
Specified by:
getChangedAnnotations in interface EventAwareAnnotationSet

getRemovedAnnotations

public Collection getRemovedAnnotations()
Specified by:
getRemovedAnnotations in interface EventAwareAnnotationSet

annotationUpdated

public void annotationUpdated(AnnotationEvent e)
Description copied from interface: AnnotationListener
Called when an Annotation has been updated

Specified by:
annotationUpdated in interface AnnotationListener

add

public boolean add(Object o)
            throws ClassCastException
Add an existing annotation. Returns true when the set is modified.

Specified by:
add in interface AnnotationSet
Overrides:
add in class AnnotationSetImpl
Throws:
ClassCastException

fireAnnotationRemoved

protected void fireAnnotationRemoved(AnnotationSetEvent e)
Overrides:
fireAnnotationRemoved in class AnnotationSetImpl
Parameters:
e -

remove

public boolean remove(Object o)
               throws ClassCastException
Remove an element from this set.

Specified by:
remove in interface AnnotationSet
Overrides:
remove in class AnnotationSetImpl
Throws:
ClassCastException

iterator

public Iterator iterator()
Description copied from interface: AnnotationSet
Get an iterator for this set

Specified by:
iterator in interface AnnotationSet
Overrides:
iterator in class AnnotationSetImpl