@SuppressWarnings("unchecked") private Collection<Annotation> getAnnotations() { return annotations.annotations(); }
/** * Returns the total number of annotations in the tree. * * @return the total number of annotations in the tree. */ public int numAnnotations() { return annotations.annotations().size(); }
/** * Returns an Iterator over all annotations in this tree. Note that the iteration order is non-deterministic. * @return an Iterator over all annotations in this tree. */ @SuppressWarnings("unchecked") public Iterator<Annotation> iterator() { return annotations.annotations().iterator(); }
public void createIndex(IndexKey key) { if (key == IndexKey.SPAN_NODE && annotations instanceof ListAnnotationContainer) { AnnotationContainer tmpAnnotations = new SpanNode2AnnotationContainer(); tmpAnnotations.annotateAll(annotations.annotations()); annotations = tmpAnnotations; } else if (key == IndexKey.ANNOTATION_TYPE && annotations instanceof ListAnnotationContainer) { AnnotationContainer tmpAnnotations = new AnnotationType2AnnotationContainer(); tmpAnnotations.annotateAll(annotations.annotations()); annotations = tmpAnnotations; } else { throw new IllegalArgumentException("Multiple indexes not yet supported. Use clearIndex() or clearIndexes() first."); } }
private void clearIndex() { AnnotationContainer tmpAnnotations = new ListAnnotationContainer(); tmpAnnotations.annotateAll(annotations.annotations()); annotations = tmpAnnotations; }