public synchronized void processCas(CAS aCAS) throws ResourceProcessException {
    JCas jcas;
    try {
      jcas = aCAS.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }

    // iterate and print annotations
    FSIndex gmIndex = jcas.getIndexRepository().getIndex("edu.lti.cmu.hw1.idx.gmasc");
    Iterator annotationIter = gmIndex.iterator();

    while (annotationIter.hasNext()) {
      GeneMention annot = (GeneMention) annotationIter.next();
      try {
        fileWriter.write(annot.getId() + "|" + annot.getBegin() + " " + annot.getEnd() + "|"
                + annot.getTag() + "\n");
        fileWriter.flush();
      } catch (IOException e) {
        throw new ResourceProcessException(e);
      }
    }
  }