code: public static List<Sentence> getPrecedingSentences(JCas jCas, Sentence annotation)
      {
          List<Sentence> result = new ArrayList<Sentence>();
  
          for (Sentence sentence : JCasUtil.select(getInitialView(jCas), Sentence.class)) {
              if (sentence.getBegin() < annotation.getBegin()) {
                  result.add(sentence);
              }
          }
  
          Collections.sort(result, new Comparator<Sentence>()
          {
              @Override public int compare(Sentence o1, Sentence o2)
              {
                  return o2.getBegin() - o1.getBegin();
              }
          });
  
          return result;
      }
docs: Returns a list of annotations of the same type preceding the given annotation
  
  @param jCas       jcas
  @param annotation sentence
  @return list of sentences sorted incrementally by position