use of gate.Node in project gate-core by GateNLP.
the class AnnotationSetImpl method inDocumentOrder.
/**
* Return a list of annotations sorted by increasing start offset, i.e. in the order
* they appear in the document. If more than one annotation starts at a specific offset
* the order of these annotations is unspecified.
*
* @return a list of annotations ordered by increasing start offset. If a positional
* index does not exist, it is created.
*/
@Override
public List<Annotation> inDocumentOrder() {
if (annotsByStartNode == null)
indexByStartOffset();
Collection<Node> values = nodesByOffset.values();
List<Annotation> result = new ArrayList<Annotation>();
for (Node nodeObj : values) {
Collection<Annotation> anns = getAnnotsByStartNode(nodeObj.getId());
if (anns != null) {
result.addAll(anns);
}
}
return result;
}
Aggregations