at.ofai.gate.annotation
Class NoDupAnnotationSetImpl

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<gate.Annotation>
          extended by gate.annotation.AnnotationSetImpl
              extended by at.ofai.gate.annotation.NoDupAnnotationSetImpl
All Implemented Interfaces:
gate.AnnotationSet, gate.SimpleAnnotationSet, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<gate.Annotation>, java.util.Collection<gate.Annotation>, java.util.Set<gate.Annotation>

public class NoDupAnnotationSetImpl
extends gate.annotation.AnnotationSetImpl

A special kind of AnnotationSet that checks whether an identical annotation (same type, features, start offset and end offset) already exists before adding an annotation to the set, so that no duplicate annotation is created. This behaviour can be disabled by setting authoriseDuplicates to false. When constructing a new object from another AnnotationSet object, duplicates are copied as is. Only additions made afterwards are subject to duplicate control.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gate.annotation.AnnotationSetImpl
annFactory, annotationSetListeners, annotsById, emptyAnnotationSet, longestAnnot
 
Constructor Summary
NoDupAnnotationSetImpl(gate.AnnotationSet c)
          Construction from Collection (whose items must be Annotation).
NoDupAnnotationSetImpl(gate.Document doc)
          Construction from Document.
NoDupAnnotationSetImpl(gate.Document doc, java.lang.String name)
          Construction from Document and name.
 
Method Summary
 boolean add(java.lang.Object o)
          Add an existing annotation.
 java.lang.Boolean getAuthoriseDuplicates()
          Get the value of authoriseDuplicates.
 void setAuthoriseDuplicates(java.lang.Boolean authorization)
          Set the value of authoriseDuplicates.
 
Methods inherited from class gate.annotation.AnnotationSetImpl
add, add, add, add, addAll, addAllKeepIDs, addAnnotationSetListener, addGateListener, clone, edit, fireAnnotationAdded, fireAnnotationRemoved, fireGateEvent, firstNode, get, get, get, get, get, get, get, get, get, get, getAllTypes, getContained, getCovering, getDocument, getName, getStrict, indexByStartOffset, indexByType, iterator, lastNode, nextNode, remove, removeAnnotationSetListener, removeFromIdIndex, removeFromOffsetIndex, removeFromTypeIndex, removeGateListener, setAnnotationFactory, 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, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
clear, contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

NoDupAnnotationSetImpl

public NoDupAnnotationSetImpl(gate.Document doc)
Construction from Document.


NoDupAnnotationSetImpl

public NoDupAnnotationSetImpl(gate.Document doc,
                              java.lang.String name)
Construction from Document and name.


NoDupAnnotationSetImpl

public NoDupAnnotationSetImpl(gate.AnnotationSet c)
                       throws java.lang.ClassCastException
Construction from Collection (whose items must be Annotation). Do not check for duplicate annotations: copy them as is.

Throws:
java.lang.ClassCastException
Method Detail

add

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

Overrides:
add in class gate.annotation.AnnotationSetImpl
Throws:
java.lang.ClassCastException

getAuthoriseDuplicates

public java.lang.Boolean getAuthoriseDuplicates()
Get the value of authoriseDuplicates.

Returns:
value of authoriseDuplicates.

setAuthoriseDuplicates

public void setAuthoriseDuplicates(java.lang.Boolean authorization)
Set the value of authoriseDuplicates.

Parameters:
authoriseDuplicates - value of authoriseDuplicates.