@Test public void testSelectAt() throws Exception { this.jCas.setDocumentText("A B C D E"); Token a = new Token(this.jCas, 0, 1); Token b = new Token(this.jCas, 2, 3); Token bc = new Token(this.jCas, 2, 5); Token c = new Token(this.jCas, 4, 6); Token c1 = new Token(this.jCas, 4, 6); Token d = new Token(this.jCas, 4, 5); Token e = new Token(this.jCas, 4, 7); Token cde = new Token(this.jCas, 6, 7); Token f = new Token(this.jCas, 8, 9); for (Token token : Arrays.asList(a, b, bc, c, c1, d, e, cde, e, f)) { token.addToIndexes(); } List<Token> tokensAt = selectAt(jCas, Token.class, c.getBegin(), c.getEnd()); assertEquals(2, tokensAt.size()); assertEquals(c.getBegin(), tokensAt.get(0).getBegin()); assertEquals(c.getEnd(), tokensAt.get(0).getEnd()); assertEquals(c.getBegin(), tokensAt.get(1).getBegin()); assertEquals(c.getEnd(), tokensAt.get(1).getEnd()); }
public static <T extends Annotation> List<T> selectAt(final JCas jCas, final Class<T> type, int aBegin, int aEnd) { return cast(CasUtil.selectAt(jCas.getCas(), getType(jCas, type), aBegin, aEnd)); }
JCasUtil { public static <T extends Annotation> List<T> selectAt(final JCas jCas, final Class<T> type, int aBegin, int aEnd) { return cast(CasUtil.selectAt(jCas.getCas(), getType(jCas, type), aBegin, aEnd)); } }
JCasUtil { public static <T extends Annotation> List<T> selectAt(final JCas jCas, final Class<T> type, int aBegin, int aEnd) { return cast(CasUtil.selectAt(jCas.getCas(), getType(jCas, type), aBegin, aEnd)); } private  JCasUtil(); }
JCasUtil { public static <T extends Annotation> List<T> selectAt(final JCas jCas, final Class<T> type, int aBegin, int aEnd) { return cast(CasUtil.selectAt(jCas.getCas(), getType(jCas, type), aBegin, aEnd)); } private  JCasUtil(); static Iterable<T> subiterate(final JCas jCas, final Class<T> type,
          final AnnotationFS container, final boolean ambiguous, final boolean strict); @Deprecated static Iterator<T> iterator(JCas jCas, Class<T> type); @SuppressWarnings("unchecked") static Iterator<T> iterator(AnnotationFS container,
          Class<T> type, boolean ambiguous, boolean strict); static Type getType(JCas jCas, Class<?> type); static Type getAnnotationType(JCas jCas, Class<?> type); static List<T> select(final FSArray array, final Class<T> type); static List<T> select(final FSList list, final Class<T> type); static Collection<T> select(final JCas jCas, final Class<T> type); static List<T> selectAt(final JCas jCas, final Class<T> type,
          int aBegin, int aEnd); @SuppressWarnings("unchecked") static T selectSingleAt(final JCas jCas, final Class<T> type,
          int aBegin, int aEnd); static Collection<TOP> selectAll(final JCas jCas); static List<T> selectBetween(final Class<T> type,
          AnnotationFS ann1, AnnotationFS ann2); static List<T> selectBetween(JCas jCas, final Class<T> type,
          AnnotationFS ann1, AnnotationFS ann2); static List<T> selectCovered(Class<T> type,
          AnnotationFS coveringAnnotation); static List<T> selectCovered(JCas jCas, final Class<T> type,
          AnnotationFS coveringAnnotation); static List<T> selectCovered(JCas jCas, final Class<T> type,
          int begin, int end); static List<T> selectCovering(Class<T> type,
          AnnotationFS coveredAnnotation); static List<T> selectCovering(JCas jCas, Class<T> type,
          AnnotationFS coveredAnnotation); static List<T> selectCovering(JCas jCas, Class<T> type, int begin,
          int end); static Map<T, List<S>> indexCovering(
          JCas jCas, Class<? extends T> type, Class<? extends S> coveringType); static Map<T, List<S>> indexCovered(
          JCas jCas, Class<? extends T> type, Class<? extends S> coveredType); static boolean contains(JCas jCas, AnnotationFS coveringAnnotation,
          Class<? extends Annotation> type); @SuppressWarnings("unchecked") static T selectByIndex(JCas jCas, Class<T> cls, int index); @SuppressWarnings("unchecked") static T selectSingle(JCas jCas, Class<T> type); @SuppressWarnings("unchecked") static T selectSingleRelative(Class<T> aType,
          AnnotationFS annotation, int index); @SuppressWarnings("unchecked") static T selectSingleRelative(JCas aJCas, Class<T> aType,
          AnnotationFS aAnchor, int aPosition); static List<T> selectPreceding(Class<T> aType,
          AnnotationFS annotation, int count); static List<T> selectPreceding(JCas aJCas, Class<T> aType,
          AnnotationFS annotation, int count); static List<T> selectFollowing(Class<T> aType,
          AnnotationFS annotation, int count); static List<T> selectFollowing(JCas aJCas, Class<T> aType,
          AnnotationFS annotation, int count); static boolean exists(JCas aJCas, Class<T> aType); static JCas getView(JCas jcas, String viewName, JCas fallback); static JCas getView(JCas jcas, String viewName, boolean create); static List<String> toText(Iterable<T> iterable); }
JCasUtil { public static <T extends Annotation> List<T> selectAt(final JCas jCas, final Class<T> type, int aBegin, int aEnd) { return cast(CasUtil.selectAt(jCas.getCas(), getType(jCas, type), aBegin, aEnd)); } private  JCasUtil(); static Iterable<T> subiterate(final JCas jCas, final Class<T> type,
          final AnnotationFS container, final boolean ambiguous, final boolean strict); @Deprecated static Iterator<T> iterator(JCas jCas, Class<T> type); @SuppressWarnings("unchecked") static Iterator<T> iterator(AnnotationFS container,
          Class<T> type, boolean ambiguous, boolean strict); static Type getType(JCas jCas, Class<?> type); static Type getAnnotationType(JCas jCas, Class<?> type); static List<T> select(final FSArray array, final Class<T> type); static List<T> select(final FSList list, final Class<T> type); static Collection<T> select(final JCas jCas, final Class<T> type); static List<T> selectAt(final JCas jCas, final Class<T> type,
          int aBegin, int aEnd); @SuppressWarnings("unchecked") static T selectSingleAt(final JCas jCas, final Class<T> type,
          int aBegin, int aEnd); static Collection<TOP> selectAll(final JCas jCas); static List<T> selectBetween(final Class<T> type,
          AnnotationFS ann1, AnnotationFS ann2); static List<T> selectBetween(JCas jCas, final Class<T> type,
          AnnotationFS ann1, AnnotationFS ann2); static List<T> selectCovered(Class<T> type,
          AnnotationFS coveringAnnotation); static List<T> selectCovered(JCas jCas, final Class<T> type,
          AnnotationFS coveringAnnotation); static List<T> selectCovered(JCas jCas, final Class<T> type,
          int begin, int end); static List<T> selectCovering(Class<T> type,
          AnnotationFS coveredAnnotation); static List<T> selectCovering(JCas jCas, Class<T> type,
          AnnotationFS coveredAnnotation); static List<T> selectCovering(JCas jCas, Class<T> type, int begin,
          int end); static Map<T, List<S>> indexCovering(
          JCas jCas, Class<? extends T> type, Class<? extends S> coveringType); static Map<T, List<S>> indexCovered(
          JCas jCas, Class<? extends T> type, Class<? extends S> coveredType); static boolean contains(JCas jCas, AnnotationFS coveringAnnotation,
          Class<? extends Annotation> type); @SuppressWarnings("unchecked") static T selectByIndex(JCas jCas, Class<T> cls, int index); @SuppressWarnings("unchecked") static T selectSingle(JCas jCas, Class<T> type); @SuppressWarnings("unchecked") static T selectSingleRelative(Class<T> aType,
          AnnotationFS annotation, int index); @SuppressWarnings("unchecked") static T selectSingleRelative(JCas aJCas, Class<T> aType,
          AnnotationFS aAnchor, int aPosition); static List<T> selectPreceding(Class<T> aType,
          AnnotationFS annotation, int count); static List<T> selectPreceding(JCas aJCas, Class<T> aType,
          AnnotationFS annotation, int count); static List<T> selectFollowing(Class<T> aType,
          AnnotationFS annotation, int count); static List<T> selectFollowing(JCas aJCas, Class<T> aType,
          AnnotationFS annotation, int count); static boolean exists(JCas aJCas, Class<T> aType); static JCas getView(JCas jcas, String viewName, JCas fallback); static JCas getView(JCas jcas, String viewName, boolean create); static List<String> toText(Iterable<T> iterable);  }