code: private static List<Annotation> selectMatching(CAS cas, final int begin,
              final int end, AnnotationFS annotationCloseToTheRegion) {
  
          final List<Annotation> list = new ArrayList<Annotation>();
          final FSIterator<AnnotationFS> it = cas.getAnnotationIndex().iterator();
  
          // Try to seek the insertion point.
          it.moveTo(annotationCloseToTheRegion);
  
          // If the insertion point is beyond the index, move back to the last.
          if (!it.isValid()) {
              it.moveToLast();
              if (!it.isValid()) {
                  return list;
              }
          }
  
          // Ignore type priorities by seeking to the first that has the same
          // begin
          boolean moved = false;
          while (it.isValid() && (it.get()).getBegin() >= begin) {
              it.moveToPrevious();
              moved = true;
          }
  
          // If we moved, then we are now on one starting before the requested
          // begin, so we have to
          // move one ahead.
          if (moved) {
              it.moveToNext();
          }
  
          // If we managed to move outside the index, start at first.
          if (!it.isValid()) {
              it.moveToFirst();
          }
  
          // Skip annotations whose start is before the start parameter.
          while (it.isValid() && (it.get()).getBegin() < begin) {
              it.moveToNext();
          }
  
          while (it.isValid()) {
              AnnotationFS a = it.get();
              if (!(a instanceof Annotation))
                  continue;
  
              // If the start of the current annotation is past the end parameter,
              // we're done.
              if (a.getBegin() > end) {
                  break;
              }
              it.moveToNext();
  
              if (a.getBegin() == begin && a.getEnd() == end) {
                  list.add((Annotation) a);
              }
          }
          return unmodifiableList(list);
      }
docs: REM: modified from CasUtils..
  
  Get a list of annotations of the given annotation type constraint by a
  start and end. It's good to provide an annotation that is close to the
  region, to quickly move the iterator
  
  @param cas
  a CAS.
  @param type
  a UIMA type.
  @param annotationCloseToTheRegion
  the covering annotation.
  @return a return value.
  @see Subiterator