Пример #1
0
 private static FileSelector getFileSelector() {
   if (null == fileSelector) {
     fileSelector = new FileSelector();
     fileSelector.addExt(IOManager.getParserTypes());
   }
   return fileSelector;
 }
Пример #2
0
  public static void printPerformanceStatistics(List<PerformanceStatistic> performanceStatistics) {
    if (null == performanceStatistics) return;
    System.out.flush();
    StringBuilder sb = new StringBuilder();
    if (performanceStatistics.size() == 0) {
      sb.append(getPerformanceStatistics_noResults());
    } else {
      Collections.sort(performanceStatistics);

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      PrintStream writer = new PrintStream(baos);

      for (PerformanceStatistic rp : performanceStatistics) {
        writer.append(LINE_SEPARATOR);
        writer.printf(
            "| %10d | %10d | %11.3f sec | %11.3f sec | %11.3f sec | %11.3f sec | %11.3f sec | %11.3f sec | %8.2f MB | %s", //
            rp.getNoOfRules(),
            rp.getNoOfLiterals(), //
            .001 * rp.getLoadTheoryTimeUsed(), //
            .001 * rp.getNormalFormTransformationTimeUsed(), //
            .001 * rp.getDefeaterRemovalTimeUsed(), //
            .001 * rp.getSuperiorityRemovalTimeUsed(), //
            .001 * rp.getReasoningTimeUsed(), //
            .001 * rp.getTotalTimeUsed(), //
            1.0 * rp.getMaxMemoryUsed() / 1024 / 1024, //
            rp.getUrl().toString());
      }
      writer.flush();

      Object[] args = {
        Converter.long2TimeString(IOManager.getConfigurationTimeUsed()),
        performanceStatistics.size(),
        baos.toString()
      };

      try {
        sb.append(
            TextUtilities.formatArguments(getPerformanceStatisticsTemplate(), args.length, args));
      } catch (InvalidArgumentException e) {
        e.printStackTrace();
      }
    }
    System.out.println(sb.toString());
    System.out.flush();
  }