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; }