@Override
  public void processCas(CAS aCas) throws ResourceProcessException {

    JCas jcas;
    try {
      jcas = aCas.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }

    FSIterator it = jcas.getAnnotationIndex(Document.type).iterator();

    int i = 0;
    if (it.hasNext()) {
      Document doc = (Document) it.next();

      qIdList.add(doc.getQueryID());
      relList.add(doc.getRelevanceValue());

      rank.add(-1);
      sim.add(-1.0d);

      // Make sure that your previous annotators have populated this in CAS
      FSList fsTokenList = doc.getTokenList();
      ArrayList<Token> tokenList = Utils.fromFSListToCollection(fsTokenList, Token.class);

      HashMap<String, Integer> tokMap = new HashMap<String, Integer>();
      Iterator<Token> iter = tokenList.iterator();
      while (iter.hasNext()) {
        Token t = iter.next();
        tokMap.put(t.getText(), t.getFrequency());
      }
      docs.add(tokMap);

      for (Token token : tokenList) {
        dict.add(token.getText());
      }

      // Do something useful here
      if (doc.getRelevanceValue() == 99) {
        queryIndexes.add(docs.size() - 1);
      } else {
        if (answerIndexes.containsKey(doc.getQueryID())) {
          answerIndexes.get(doc.getQueryID()).add(docs.size() - 1);
        } else
          answerIndexes.put(doc.getQueryID(),
                  new ArrayList<Integer>(Arrays.asList(new Integer[] { docs.size() - 1 })));
      }
    }

  }