/**
* Retrieves the annotations in the given span.
*/
static Collection<AnnotationFS> getAnnotation(CAS cas, Type type, Span span) {
ConstraintFactory cf = cas.getConstraintFactory();
Type annotationType = cas.getAnnotationType();
FeaturePath beginPath = cas.createFeaturePath();
beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
FSIntConstraint beginConstraint = cf.createIntConstraint();
beginConstraint.geq(span.getStart());
FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath, beginConstraint);
FeaturePath endPath = cas.createFeaturePath();
endPath.addFeature(annotationType.getFeatureByBaseName("end"));
FSIntConstraint endConstraint = cf.createIntConstraint();
endConstraint.leq(span.getEnd());
FSMatchConstraint embeddedEnd = cf.embedConstraint(endPath, endConstraint);
FSMatchConstraint strictType = new StrictTypeConstraint(type);
FSMatchConstraint annotatioInSpanConstraint = cf.and(embeddedBegin, embeddedEnd);
FSMatchConstraint annotationInSpanAndStrictTypeConstraint =
cf.and(annotatioInSpanConstraint, strictType);
FSIndex<AnnotationFS> allAnnotations = cas.getAnnotationIndex(type);
FSIterator<AnnotationFS> annotationInsideSpanIndex =
cas.createFilteredIterator(allAnnotations.iterator(),