AnnotationUtil { public static boolean contains(Annotation bigAnnotation, Annotation smallAnnotation) { if (bigAnnotation == null || smallAnnotation == null) return false; if (bigAnnotation.getBegin() <= smallAnnotation.getBegin() && bigAnnotation.getEnd() >= smallAnnotation.getEnd()) return true; else return false; }  static T selectFirstMatching(
      JCas jCas,
      Class<T> selectedType,
      Annotation annotation); static List<T> selectMatching(
      JCas jCas,
      Class<T> selectedType,
      Annotation annotation); static boolean contains(Annotation bigAnnotation, Annotation smallAnnotation); static boolean overlaps(Annotation annotation1, Annotation annotation2); static int size(Annotation annotation); static String getSurroundingText(
      JCas jCas,
      Annotation annotation,
      Class<TOKEN_TYPE> tokenClass,
      int numberOfTokens,
      boolean before); static void sort(List<T> annotations); static int[] getAnnotationsExtent(List<? extends Annotation> annotations);  }
@Test public void testContains() throws Exception { AnnotationUtilTest.Annotator.getProcessedJCas(jCas); Token token6 = JCasUtil.selectByIndex(jCas, Token.class, 6); Token token7 = JCasUtil.selectByIndex(jCas, Token.class, 7); Token token8 = JCasUtil.selectByIndex(jCas, Token.class, 8); Token token9 = JCasUtil.selectByIndex(jCas, Token.class, 9); Token token10 = JCasUtil.selectByIndex(jCas, Token.class, 10); Chunk chunk0 = JCasUtil.selectByIndex(jCas, Chunk.class, 0); Chunk chunk1 = JCasUtil.selectByIndex(jCas, Chunk.class, 1); assertTrue(AnnotationUtil.contains(token6, token6)); assertTrue(AnnotationUtil.contains(chunk0, token6)); assertTrue(AnnotationUtil.contains(chunk0, token7)); assertFalse(AnnotationUtil.contains(chunk0, token8)); assertTrue(AnnotationUtil.contains(chunk0, chunk0)); assertFalse(AnnotationUtil.contains(chunk1, token8)); assertTrue(AnnotationUtil.contains(chunk1, token9)); assertTrue(AnnotationUtil.contains(chunk1, token10)); }