@Override public FSIndex<T> withSnapshotIterators() { return new AnnotationIndexImpl<T>(index.withSnapshotIterators()); }
@Override public FSIterator<T> subiterator(AnnotationFS annot) { return subiterator(annot, true, true); }
@Override public AnnotationTree<T> tree(T annot) { AnnotationTreeImpl<T> tree = new AnnotationTreeImpl<T>(); AnnotationTreeNodeImpl<T> root = new AnnotationTreeNodeImpl<T>(); tree.setRoot(root); root.set(annot); addChildren(root, subiterator(annot, false, true)); return tree; }
private void addChildren(AnnotationTreeNodeImpl<T> node, FSIterator<T> it) { AnnotationTreeNodeImpl<T> dtr; T annot; while (it.isValid()) { annot = it.get(); it.moveToNext(); dtr = new AnnotationTreeNodeImpl<T>(); dtr.set(annot); node.addChild(dtr); addChildren(dtr, subiterator(annot, false, true)); } }
/** * The generic spec T extends AnnotationFS (rather than AnnotationFS) allows the method * JCasImpl getAnnotationIndex to return Annotation instead of AnnotationFS * @param <T> the Java class associated with the annotation index * @return the annotation index */ @Override public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex() { return new AnnotationIndexImpl<T>( getIndexRepository().<T>getIndex( CAS.STD_ANNOTATION_INDEX)); }
/** * @see org.apache.uima.cas.CAS#getAnnotationIndex(Type) */ @Override public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex(Type type) { return new AnnotationIndexImpl<T>( getIndexRepository().<T>getIndex( CAS.STD_ANNOTATION_INDEX, type)); }