/** * Convenience method select all feature structure from the given type from an array. * * @param <T> * the JCas type. * @param array * a feature structure array. * @param type * the type. * @return A collection of the selected type. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends TOP> Collection<T> select(final FSArray array, final Class<T> type) { return cast(CasUtil.selectFS(array, CasUtil.getType(array.getCAS(), type.getName()))); }
/** * Convenience method select all feature structure from the given type from a list. * * @param <T> * the JCas type. * @param list * a feature structure list. * @param type * the type. * @return A collection of the selected type. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends TOP> Collection<T> select(final FSList list, final Class<T> type) { return cast(FSCollectionFactory.create(list, CasUtil.getType(list.getCAS(), type.getName()))); }
/** * Convenience method to iterator over all features structures of a given type. * * @param <T> * the iteration type. * @param jCas * the JCas containing the type system. * @param type * the type. * @return A collection of the selected type. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends TOP> Collection<T> select(final JCas jCas, final Class<T> type) { return cast(CasUtil.selectFS(jCas.getCas(), getType(jCas, type))); }
/** * Returns the n annotations following the given annotation * * @param <T> * the JCas type. * @param aJCas * a JCas. * @param aType * a type. * @param annotation * anchor annotation * @param count * number of annotations to collect * @return List of aType annotations following anchor annotation * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectFollowing(JCas aJCas, Class<T> aType, AnnotationFS annotation, int count) { Type t = getType(aJCas, aType); return cast(CasUtil.selectFollowing(aJCas.getCas(), t, annotation, count)); }
/** * Get all annotations of the given type at the specified offsets. * * @param <T> * the type of annotations to fetch. * @param jCas * the CAS containing the annotations. * @param type * the type of annotations to fetch. * @param aBegin * the begin offset. * @param aEnd * the end offset. * @return the annotations at the specified offsets. */ 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)); }
/** * Returns the n annotations preceding the given annotation * * @param <T> * the JCas type. * @param aJCas * a JCas. * @param aType * a type. * @param annotation * anchor annotation * @param count * number of annotations to collect * @return List of aType annotations preceding anchor annotation * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectPreceding(JCas aJCas, Class<T> aType, AnnotationFS annotation, int count) { Type t = getType(aJCas, aType); return cast(CasUtil.selectPreceding(aJCas.getCas(), t, annotation, count)); }
/** * Get a list of annotations of the given annotation type located between two annotations. Does * not use subiterators and does not respect type priorities. Zero-width annotations what lie on * the borders are included in the result, e.g. if the boundary annotations are [1..2] and [2..3] * then an annotation [2..2] is returned. If there is a non-zero overlap between the boundary * annotations, the result is empty. The method properly handles cases where the second boundary * annotations occurs before the first boundary annotation by switching their roles. * * @param <T> * the JCas type. * @param type * a UIMA type. * @param ann1 * the first boundary annotation. * @param ann2 * the second boundary annotation. * @return a return value. * @see Subiterator * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectBetween(final Class<T> type, AnnotationFS ann1, AnnotationFS ann2) { return cast(CasUtil.selectBetween(CasUtil.getType(ann1.getCAS(), type), ann1, ann2)); }
/** * Get a list of annotations of the given annotation type constraint by a certain annotation. * Iterates over all annotations to find the covering annotations. * <p> * The method only returns properly covering annotations, that is annotations where the begin/end * offsets are equal to the begin/end of the given annotation or where given 'covered' annotation * is properly contained within the span of the 'covering' annotation. Partially overlapping * annotations are not returned. * * <p> * <b>Note:</b> this is <b>REALLY SLOW!</b> You don't want to use this. Instead, consider using * {@link #indexCovering(JCas, Class, Class)} or a {@link ContainmentIndex}. * * @param <T> * the JCas type. * @param type * a UIMA type. * @param coveredAnnotation * the covered annotation. * @return a return value. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectCovering(Class<T> type, AnnotationFS coveredAnnotation) { return cast(CasUtil.selectCovering(CasUtil.getType(coveredAnnotation.getCAS(), type), coveredAnnotation)); }
/** * Get a list of annotations of the given annotation type constrained by a 'covering' annotation. * Iterates over all annotations of the given type to find the covered annotations. Does not use * subiterators. * <p> * The covering annotation is never returned itself, even if it is of the queried-for type or a * subtype of that type. * <p> * The method only returns properly covered annotations, that is annotations where the begin/end * offsets are equal to the 'covering' annotation or where both the begin/end are included in * the span of the 'covering' annotation. Partially overlapping annotations are not returned. * * @param <T> * the JCas type. * @param jCas * a JCas containing the annotation. * @param type * a UIMA type. * @param coveringAnnotation * the covering annotation. * @return a return value. * @see Subiterator * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectCovered(JCas jCas, final Class<T> type, AnnotationFS coveringAnnotation) { return cast(CasUtil.selectCovered(jCas.getCas(), getType(jCas, type), coveringAnnotation)); }
/** * Get a list of annotations of the given annotation type located between two annotations. Does * not use subiterators and does not respect type priorities. Zero-width annotations what lie on * the borders are included in the result, e.g. if the boundary annotations are [1..2] and [2..3] * then an annotation [2..2] is returned. If there is a non-zero overlap between the boundary * annotations, the result is empty. The method properly handles cases where the second boundary * annotations occurs before the first boundary annotation by switching their roles. * * @param <T> * the JCas type. * @param jCas * a JCas containing the annotation. * @param type * a UIMA type. * @param ann1 * the first boundary annotation. * @param ann2 * the second boundary annotation. * @return a return value. * @see Subiterator * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectBetween(JCas jCas, final Class<T> type, AnnotationFS ann1, AnnotationFS ann2) { return cast(CasUtil.selectBetween(jCas.getCas(), getType(jCas, type), ann1, ann2)); }
/** * Get a list of annotations of the given annotation type constraint by a certain annotation. * Iterates over all annotations to find the covering annotations. * <p> * The method only returns properly covering annotations, that is annotations where the begin/end * offsets are equal to the given begin/end to or where given span is properly contained within * the span of the 'covering' annotation. Partially overlapping annotations are not returned. * * <p> * <b>Note:</b> this is <b>REALLY SLOW!</b> You don't want to use this. Instead, consider using * {@link #indexCovering(JCas, Class, Class)} or a {@link ContainmentIndex}. * * @param <T> * the JCas type. * @param jCas * a CAS. * @param type * a UIMA type. * @param begin * begin offset. * @param end * end offset. * @return a return value. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectCovering(JCas jCas, Class<T> type, int begin, int end) { return cast(CasUtil.selectCovering(jCas.getCas(), getType(jCas, type), begin, end)); }
/** * Get a list of annotations of the given annotation type constrained by a 'covering' annotation. * Iterates over all annotations of the given type to find the covered annotations. Does not use * subiterators. * <p> * The covering annotation is never returned itself, even if it is of the queried-for type or a * subtype of that type. * <p> * The method only returns properly covered annotations, that is annotations where the begin/end * offsets are equal to the 'covering' annotation or where both the begin/end are included in * the span of the 'covering' annotation. Partially overlapping annotations are not returned. * * @param <T> * the JCas type. * @param type * a UIMA type. * @param coveringAnnotation * the covering annotation. * @return a return value. * @see Subiterator * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends AnnotationFS> List<T> selectCovered(Class<T> type, AnnotationFS coveringAnnotation) { return cast(CasUtil.selectCovered(CasUtil.getType(coveringAnnotation.getCAS(), type), coveringAnnotation)); }
/** * Get a list of annotations of the given annotation type constraint by a certain annotation. * Iterates over all annotations to find the covering annotations. * <p> * The method only returns properly covering annotations, that is annotations where the begin/end * offsets are equal to the begin/end of the given annotation or where given 'covered' annotation * is properly contained within the span of the 'covering' annotation. Partially overlapping * annotations are not returned. * * <p> * <b>Note:</b> this is <b>REALLY SLOW!</b> You don't want to use this. Instead, consider using * {@link #indexCovering(JCas, Class, Class)} or a {@link ContainmentIndex}. * * @param <T> * the JCas type. * @param jCas * a CAS. * @param type * a UIMA type. * @param coveredAnnotation * the covered annotation. * @return a return value. * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectCovering(JCas jCas, Class<T> type, AnnotationFS coveredAnnotation) { return cast(CasUtil.selectCovering(jCas.getCas(), getType(jCas, type), coveredAnnotation)); }
return cast(CasUtil.selectCovered(jCas.getCas(), getType(jCas, type), begin, end));
/** * Returns the n annotations preceding the given annotation * * @param <T> * the JCas type. * @param aType * a type. * @param annotation * anchor annotation * @param count * number of annotations to collect * @return List of aType annotations preceding anchor annotation * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectPreceding(Class<T> aType, AnnotationFS annotation, int count) { Type t = CasUtil.getType(annotation.getCAS(), aType); return cast(CasUtil.selectPreceding(annotation.getView(), t, annotation, count)); }
/** * Returns the n annotations following the given annotation * * @param <T> * the JCas type. * @param aType * a type. * @param annotation * anchor annotation * @param count * number of annotations to collect * @return List of aType annotations following anchor annotation * @see <a href="package-summary.html#SortOrder">Order of selected feature structures</a> */ public static <T extends Annotation> List<T> selectFollowing(Class<T> aType, AnnotationFS annotation, int count) { Type t = CasUtil.getType(annotation.getCAS(), aType); return cast(CasUtil.selectFollowing(annotation.getView(), t, annotation, count)); }
return cast(CasUtil.indexCovering(jCas.getCas(), getType(jCas, type), getType(jCas, coveringType)));
return cast(CasUtil .indexCovered(jCas.getCas(), getType(jCas, type), getType(jCas, coveredType)));