/** printCoverage */
  public static void printCoverage() {

    LoggingUtils.getEvoLogger()
        .info(
            "* Time spent optimizing covered goals analysis: "
                + DefUseExecutionTraceAnalyzer.timeGetCoveredGoals
                + "ms");
    Map<DefUsePairType, Integer> totalGoals = initTotalGoals();
    for (DefUsePairType type : DefUseCoverageTestFitness.DefUsePairType.values()) {
      LoggingUtils.getEvoLogger()
          .info(
              "* Covered goals of type "
                  + type
                  + ": "
                  + mostCoveredGoals.get(type)
                  + " / "
                  + totalGoals.get(type));
      for (DefUseCoverageTestFitness pair : getPairsOfType(type)) {
        if (pair.isCovered()) {
          LoggingUtils.getEvoLogger().info("*(X) " + pair.toString());
        } else {
          LoggingUtils.getEvoLogger().info("*( ) " + pair.toString());
        }
      }
    }

    LoggingUtils.getEvoLogger()
        .info("* Covered " + countMostCoveredGoals() + "/" + countGoalsIn(totalGoals) + " goals");
  }
 private static int countGoalsIn(Map<DefUsePairType, Integer> goalMap) {
   int r = 0;
   for (DefUsePairType type : DefUseCoverageTestFitness.DefUsePairType.values()) {
     if (goalMap.get(type) != null) r += goalMap.get(type);
   }
   return r;
 }
  public static Map<DefUsePairType, Integer> initTotalGoals() {
    Map<DefUsePairType, Integer> r = new HashMap<DefUsePairType, Integer>();

    // init map
    for (DefUsePairType type : DefUseCoverageTestFitness.DefUsePairType.values()) r.put(type, 0);

    int num = 0;
    // count total goals according to type
    for (DefUseCoverageTestFitness goal : DefUseCoverageFactory.getDUGoals()) {
      logger.info("Goal " + num);
      num++;
      r.put(goal.getType(), r.get(goal.getType()) + 1);
    }

    return r;
  }
  private void setMostCovered() {

    for (DefUsePairType type : DefUseCoverageTestFitness.DefUsePairType.values()) {
      if (mostCoveredGoals.get(type) < coveredGoals.get(type)) {
        mostCoveredGoals.put(type, coveredGoals.get(type));
        if (mostCoveredGoals.get(type) > totalGoals.get(type))
          throw new IllegalStateException(
              "Can't cover more goals than there exist of type "
                  + type
                  + " "
                  + mostCoveredGoals.get(type)
                  + " / "
                  + totalGoals.get(type)
                  + " (mostCovered / total)");
      }
    }
  }
 private void initCoverageMaps() {
   for (DefUsePairType type : DefUseCoverageTestFitness.DefUsePairType.values()) {
     coveredGoals.put(type, 0);
     if (mostCoveredGoals.get(type) == null) mostCoveredGoals.put(type, 0);
   }
 }