public class ImmutableAnnotationSetImpl extends AnnotationSetImpl
annFactory, annotationSetListeners, annotsById, longestAnnot, relations
Constructor and Description |
---|
ImmutableAnnotationSetImpl(Document doc,
Collection<Annotation> annotations)
Constructs an ImmutableAnnotationSet.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Annotation a)
Add an existing annotation.
|
void |
add(Integer id,
Long start,
Long end,
String type,
FeatureMap features)
Create and add an annotation from database read data In this case the id is
already known being previously fetched from the database
|
Integer |
add(Long start,
Long end,
String type,
FeatureMap features)
Create and add an annotation and return its id
|
Integer |
add(Node start,
Node end,
String type,
FeatureMap features)
The following methods throw an exception as they try to modify the state of
the object
|
boolean |
addAll(Collection<? extends Annotation> arg0)
Adds multiple annotations to this set in one go.
|
void |
clear() |
boolean |
remove(Object o)
Remove an element from this set.
|
boolean |
removeAll(Collection<?> arg0) |
boolean |
retainAll(Collection<?> arg0) |
addAllKeepIDs, addAnnotationSetListener, addGateListener, clone, edit, emptyAS, fireAnnotationAdded, fireAnnotationRemoved, fireGateEvent, firstNode, get, get, get, get, get, get, get, get, get, get, getAllTypes, getContained, getCovering, getDocument, getName, getRelations, getStartingAt, getStrict, indexByStartOffset, indexByType, inDocumentOrder, iterator, lastNode, nextNode, removeAnnotationSetListener, removeFromIdIndex, removeFromOffsetIndex, removeFromTypeIndex, removeGateListener, setAnnotationFactory, size
equals, hashCode
contains, containsAll, isEmpty, toArray, toArray, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, spliterator, toArray, toArray
parallelStream, removeIf, stream
public ImmutableAnnotationSetImpl(Document doc, Collection<Annotation> annotations) throws ClassCastException
annotations
- ClassCastException
public Integer add(Node start, Node end, String type, FeatureMap features)
add
in interface SimpleAnnotationSet
add
in class AnnotationSetImpl
start
- the start node for the new annotationend
- the end node for the new annotationtype
- the annotation typefeatures
- the features for the new annotationpublic Integer add(Long start, Long end, String type, FeatureMap features)
AnnotationSetImpl
add
in interface SimpleAnnotationSet
add
in class AnnotationSetImpl
start
- the start offset for the new annotationend
- the end offset for the new annotationtype
- the annotation typefeatures
- the features for the new annotationpublic boolean add(Annotation a)
AnnotationSetImpl
add
in interface SimpleAnnotationSet
add
in interface Collection<Annotation>
add
in interface Set<Annotation>
add
in class AnnotationSetImpl
a
- the annotation to addtrue
if the set was modified by this
operation, false
otherwise.public void add(Integer id, Long start, Long end, String type, FeatureMap features) throws InvalidOffsetException
AnnotationSetImpl
add
in interface AnnotationSet
add
in class AnnotationSetImpl
id
- the ID for the new annotationstart
- the start offset for the new annotationend
- the end offset for the new annotationtype
- the annotation typefeatures
- the features for the new annotationInvalidOffsetException
- if the start or end offsets are
null
, or if the start offset is less than
0 or the end offset is greater than the length of the
document.public boolean removeAll(Collection<?> arg0)
removeAll
in interface Collection<Annotation>
removeAll
in interface Set<Annotation>
removeAll
in class AbstractSet<Annotation>
public boolean addAll(Collection<? extends Annotation> arg0)
AnnotationSetImpl
Annotation
type, otherwise a
ClassCastException will be thrown. The provided annotations will be used to
create new annotations using the appropriate add() methods from this set.
The new annotations will have different IDs from the old ones (which is
required in order to preserve the uniqueness of IDs inside an annotation
set).addAll
in interface Collection<Annotation>
addAll
in interface Set<Annotation>
addAll
in class AnnotationSetImpl
arg0
- a collection of annotationspublic boolean remove(Object o)
AnnotationSetImpl
remove
in interface SimpleAnnotationSet
remove
in interface Collection<Annotation>
remove
in interface Set<Annotation>
remove
in class AnnotationSetImpl
o
- the element to removetrue
if the set was modified by this
operation, false
otherwise.public boolean retainAll(Collection<?> arg0)
retainAll
in interface Collection<Annotation>
retainAll
in interface Set<Annotation>
retainAll
in class AbstractCollection<Annotation>
public void clear()
clear
in interface Collection<Annotation>
clear
in interface Set<Annotation>
clear
in class AnnotationSetImpl
Copyright © 2024 GATE. All rights reserved.