@Test public void testCreateAnnotation() { Token token = AnnotationFactory.createAnnotation(jCas, 0, 10, Token.class); assertEquals(0, token.getBegin()); assertEquals(10, token.getEnd()); Sentence sentence = AnnotationFactory.createAnnotation(jCas, 0, 10, Sentence.class); assertEquals(0, sentence.getBegin()); assertEquals(10, sentence.getEnd()); }
public static <T extends Annotation> T createAnnotation(JCas jCas, int begin, int end, Class<T> cls) { @SuppressWarnings("unchecked") T annotation = (T) jCas.getCas().createAnnotation(JCasUtil.getAnnotationType(jCas, cls), begin, end); annotation.addToIndexes(); return annotation; }
AnnotationFactory { public static <T extends Annotation> T createAnnotation(JCas jCas, int begin, int end, Class<T> cls) { @SuppressWarnings("unchecked") T annotation = (T) jCas.getCas().createAnnotation(JCasUtil.getAnnotationType(jCas, cls), begin, end); annotation.addToIndexes(); return annotation; } }
AnnotationFactory { public static <T extends Annotation> T createAnnotation(JCas jCas, int begin, int end, Class<T> cls) { @SuppressWarnings("unchecked") T annotation = (T) jCas.getCas().createAnnotation(JCasUtil.getAnnotationType(jCas, cls), begin, end); annotation.addToIndexes(); return annotation; } private  AnnotationFactory(); }
AnnotationFactory { public static <T extends Annotation> T createAnnotation(JCas jCas, int begin, int end, Class<T> cls) { @SuppressWarnings("unchecked") T annotation = (T) jCas.getCas().createAnnotation(JCasUtil.getAnnotationType(jCas, cls), begin, end); annotation.addToIndexes(); return annotation; } private  AnnotationFactory(); static T createAnnotation(JCas jCas, int begin, int end,
          Class<T> cls); }
AnnotationFactory { public static <T extends Annotation> T createAnnotation(JCas jCas, int begin, int end, Class<T> cls) { @SuppressWarnings("unchecked") T annotation = (T) jCas.getCas().createAnnotation(JCasUtil.getAnnotationType(jCas, cls), begin, end); annotation.addToIndexes(); return annotation; } private  AnnotationFactory(); static T createAnnotation(JCas jCas, int begin, int end,
          Class<T> cls);  }