|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractSet | +--gate.annotation.AnnotationSetImpl
Implementation of AnnotationSet. Has a number of indices, all bar one of which are null by default and are only constructed when asked for. Has lots of get methods with various selection criteria; these return views into the set, which are nonetheless valid sets in their own right (but will not necesarily be fully indexed). Has a name, which is null by default; clients of Document can request named AnnotationSets if they so desire. Has a reference to the Document it is attached to. Contrary to Collections convention, there is no no-arg constructor, as this would leave the set in an inconsistent state.
There are five indices: annotation by id, annotations by type, annotations by start/end node and nodes by offset. The last three jointly provide positional indexing; construction of these is triggered by indexByStart/EndOffset(), or by calling a get method that selects on offset. The type index is triggered by indexByType(), or calling a get method that selects on type. The id index is always present.
Constructor Summary | |
AnnotationSetImpl(Collection c)
Construction from Collection (which must be an AnnotationSet) |
|
AnnotationSetImpl(Document doc)
Construction from Document. |
|
AnnotationSetImpl(Document doc,
String name)
Construction from Document and name. |
Method Summary | |
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)
Create and add an annotation with pre-existing nodes, and return its id |
boolean |
add(Object o)
Add an existing annotation. |
void |
addAnnotationSetListener(AnnotationSetListener l)
|
void |
addGateListener(GateListener l)
|
Object |
clone()
|
void |
edit(Long start,
Long end,
DocumentContent replacement)
Propagate changes to the document content. |
boolean |
equals(Object other)
Two AnnotationSet are equal if their name, the documents of which belong to the AnnotationSets and annotations from the sets are the same |
Node |
firstNode()
Get the node with the smallest offset |
AnnotationSet |
get()
Get all annotations |
Annotation |
get(Integer id)
Find annotations by id |
AnnotationSet |
get(Long offset)
Select annotations by offset. |
AnnotationSet |
get(Long startOffset,
Long endOffset)
Select annotations by offset. |
AnnotationSet |
get(Set types)
Select annotations by a set of types. |
AnnotationSet |
get(String type)
Select annotations by type |
AnnotationSet |
get(String type,
FeatureMap constraints)
Select annotations by type and features |
AnnotationSet |
get(String type,
FeatureMap constraints,
Long offset)
Select annotations by type, features and offset |
Set |
getAllTypes()
Get a set of java.lang.String objects representing all the annotation types present in this annotation set. |
Document |
getDocument()
Get the document this set is attached to. |
String |
getName()
Get the name of this set. |
int |
hashCode()
|
Iterator |
iterator()
Get an iterator for this set |
Node |
lastNode()
Get the node with the largest offset |
Node |
nextNode(Node node)
Get the first node that is relevant for this annotation set and which has the offset larger than the one of the node provided. |
boolean |
remove(Object o)
Remove an element from this set. |
void |
removeAnnotationSetListener(AnnotationSetListener l)
|
void |
removeGateListener(GateListener l)
|
int |
size()
The size of this set |
Methods inherited from class java.util.AbstractSet |
removeAll |
Methods inherited from class java.util.AbstractCollection |
addAll, clear, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
addAll, clear, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray |
Constructor Detail |
public AnnotationSetImpl(Document doc)
public AnnotationSetImpl(Document doc, String name)
public AnnotationSetImpl(Collection c) throws ClassCastException
Method Detail |
public Iterator iterator()
iterator
in interface AnnotationSet
iterator
in class AbstractCollection
public boolean remove(Object o) throws ClassCastException
remove
in interface AnnotationSet
remove
in class AbstractCollection
public int size()
size
in interface AnnotationSet
size
in class AbstractCollection
public Annotation get(Integer id)
get
in interface AnnotationSet
public AnnotationSet get()
get
in interface AnnotationSet
public AnnotationSet get(String type)
get
in interface AnnotationSet
public AnnotationSet get(Set types) throws ClassCastException
get
in interface AnnotationSet
public AnnotationSet get(String type, FeatureMap constraints)
get
in interface AnnotationSet
public AnnotationSet get(Long offset)
get
in interface AnnotationSet
public AnnotationSet get(Long startOffset, Long endOffset)
get
in interface AnnotationSet
public AnnotationSet get(String type, FeatureMap constraints, Long offset)
get
in interface AnnotationSet
public Node firstNode()
firstNode
in interface AnnotationSet
public Node lastNode()
lastNode
in interface AnnotationSet
public Node nextNode(Node node)
nextNode
in interface AnnotationSet
public Integer add(Node start, Node end, String type, FeatureMap features)
add
in interface AnnotationSet
public boolean add(Object o) throws ClassCastException
add
in interface AnnotationSet
add
in class AbstractCollection
public Integer add(Long start, Long end, String type, FeatureMap features) throws InvalidOffsetException
add
in interface AnnotationSet
public void add(Integer id, Long start, Long end, String type, FeatureMap features) throws InvalidOffsetException
add
in interface AnnotationSet
public void edit(Long start, Long end, DocumentContent replacement)
public String getName()
getName
in interface AnnotationSet
public Document getDocument()
getDocument
in interface AnnotationSet
public Set getAllTypes()
getAllTypes
in interface AnnotationSet
public Object clone() throws CloneNotSupportedException
public void removeAnnotationSetListener(AnnotationSetListener l)
removeAnnotationSetListener
in interface AnnotationSet
public void addAnnotationSetListener(AnnotationSetListener l)
addAnnotationSetListener
in interface AnnotationSet
public boolean equals(Object other)
equals
in interface Set
equals
in class AbstractSet
public int hashCode()
hashCode
in interface Set
hashCode
in class AbstractSet
public void removeGateListener(GateListener l)
removeGateListener
in interface AnnotationSet
public void addGateListener(GateListener l)
addGateListener
in interface AnnotationSet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |