private void annotateInternal(SpanNode node, Annotation annotation) { annotations.annotate(annotation); }
@SuppressWarnings("unchecked") private Collection<Annotation> getAnnotations() { return annotations.annotations(); }
/** * Returns an Iterator over all annotations that annotate the given node. * * @param node the node to return annotations for. * @return an Iterator over all annotations that annotate the given node. */ @SuppressWarnings("unchecked") public Iterator<Annotation> iterator(SpanNode node) { return annotations.iterator(node); }
private void clearIndex() { AnnotationContainer tmpAnnotations = new ListAnnotationContainer(); tmpAnnotations.annotateAll(annotations.annotations()); annotations = tmpAnnotations; }
/** * Returns a recursive Iterator over all annotations that annotate the given node and its subnodes. * * @param node the node to recursively return annotations for. * @return a recursive Iterator over all annotations that annotate the given node and its subnodes. */ @SuppressWarnings("unchecked") public Iterator<Annotation> iteratorRecursive(SpanNode node) { return annotations.iteratorRecursive(node); }
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."); } }
/** * 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(); }