protected SymbolEvents constructEvent(
      String eventListName,
      ScreeningSupplementedStock screenedStock,
      EventDefinition eventDefinition,
      Integer rank,
      Integer previousRank,
      EventType eventType,
      String message,
      Date eventDate) {

    ConcurrentSkipListMap<EventKey, EventValue> eventMap =
        new ConcurrentSkipListMap<EventKey, EventValue>();

    EventKey key = new StandardEventKey(eventDate, eventDefinition, eventType);
    message = message + ". Rank is : --" + rank + "--";
    if (previousRank != null) message = message + " and was " + previousRank;
    EventValue value =
        new AlertEventValue(eventDate, eventType, eventDefinition, message, eventListName);
    eventMap.put(key, value);
    SymbolEvents symbolEvents =
        new SymbolEvents(
            screenedStock.getStock(),
            eventMap,
            EventDefinition.loadMaxPassPrefsEventInfo(),
            EventState.STATE_TERMINATED);
    return symbolEvents;
  }
  @Override
  public void exportToFile(NavigableSet<ScreeningSupplementedStock> element) throws IOException {

    Boolean generateScreenerReports =
        MainPMScmd.getMyPrefs().getBoolean("screener.generatecsv", false);
    if (!generateScreenerReports) return;

    writeFileHeader(fileName, header);
    bufferedWriter.write(
        SEPARATOR
            + "Dividende : being overridden in this order :  from yahoo then reuters then bourso\n");
    bufferedWriter.write(SEPARATOR + "BNA == EPS (annual Earning Per Share)\n");
    bufferedWriter.write(
        SEPARATOR + "Est BNA/EPS : Estimated end of next this year BNA or estimated EPS\n");
    bufferedWriter.write(
        SEPARATOR
            + "Pay out ratio (reuters) == dividend per share / earning per share. The best is a high div and a low ratio as the earnings support the dividend.\n");
    bufferedWriter.write(
        SEPARATOR + "Ideal Payout ratio is 50%. It shouldn't be outside the 40%, 60% limits.\n");
    bufferedWriter.write(SEPARATOR + "EPS growth == Estimated EPS - Current EPS\n");
    bufferedWriter.write(
        SEPARATOR
            + "PEG ratio == P/E ratio / EPS growth rate. It is considered a form of normalisation because higher growth rates should cause higher P/E ratios.\n");
    bufferedWriter.write(
        SEPARATOR
            + "Ideal figures : P/E is below 15 (ie not over priced) and EPS growth is above 20% and PEG : below 0.75 (ie 15/20)\n");
    bufferedWriter.write(SEPARATOR + "The lower the result, the better.\n\n");
    bufferedWriter.write(header);
    bufferedWriter.newLine();

    Integer rank = 0;
    for (ScreeningSupplementedStock stockPerf : element) {
      rank++;
      String newLine =
          rank.toString()
              .concat(SEPARATOR)
              .concat(stockPerf.getName().replace(SEPARATOR, "_").concat(BLANK))
              .concat(stockPerf.getStock().getSymbol())
              .concat(BLANK)
              .concat(stockPerf.getStock().getIsin())
              .concat(SEPARATOR)
              .concat(stockPerf.getSectorHint())
              .concat(SEPARATOR)
              .concat(stockPerf.closeToString())
              .concat(SEPARATOR)
              .concat(stockPerf.ttmCloseToString())
              .concat(SEPARATOR)
              // Past reating
              .concat(stockPerf.dividendToString())
              .concat(SEPARATOR)
              .concat(stockPerf.yield().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.payoutRatio().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getReutersYield().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getReutersPayoutRatio().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.payoutRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.priceChangeTTM().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.priceChangeRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.pastRating().toString())
              .concat(SEPARATOR)
              // Reco
              .concat(stockPerf.getYahooMeanRecommendations().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getBoursoMeanRecommendations().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.yahooPotentielPrice().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.boursoPricePotentiel().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.recRating().toString())
              .concat(SEPARATOR)

              // Actual PE EPSG PEG
              .concat(stockPerf.getYahooEPS().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getYahooEstEPS().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.yahooPE().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.yahooEPSG().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.yahooPEG().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.yahooPEGRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getBoursoBNA().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getBoursoEstBNA().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.boursoPE().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.boursoEPSG().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.boursoPEG().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.boursoPEGRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getReutersEPS().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.getReutersEstEPS().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.reutersPE().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.reutersEPSG().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.reutersPEG().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.reutersPEGRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.pegRatings().toString())
              .concat(SEPARATOR)
              // Totals
              .concat(stockPerf.estimationRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.noPayoutFullRating().toString())
              .concat(SEPARATOR)
              .concat(stockPerf.fullRating().toString());

      bufferedWriter.write(newLine);
      bufferedWriter.newLine();
    }

    bufferedWriter.flush();
  }