// Path: src/main/wcanalysis/heuristic/model/State.java
// public abstract class State implements CSVable, Comparable<State> {
//   private final PathCondition pc;
//   
//   public State(PathCondition pc) {
//     this.pc = pc;
//   }
//   
//   public PathCondition getPathCondition() {
//     return this.pc;
//   }
//   
//   // Should this return a double, or would we like to parameterize this (e.g. to subclasses of Number)?
//   public abstract double getWC();
// }
// 
// Path: src/main/wcanalysis/heuristic/util/OmegaConverter.java
// public class OmegaConverter implements ConstraintsConverter {
// 
//   @Override
//   public String convert(PathCondition pc) {
//     if(pc == null)
//       return "";
//     PathCondition convertPc = pc.make_copy(); //probably not necessary...
// 
//     HashSet<String> vars = new HashSet<>();
//     //TODO: does the collector *only* collect integer vars? That's weird
//     SymbolicVariableCollector collector = new SymbolicVariableCollector(vars);
//     collector.collectVariables(convertPc);
// 
//     StringBuilder omegaVarDecl = new StringBuilder();
//     Iterator<String> iter = vars.iterator();
//     while(iter.hasNext()) {
//       omegaVarDecl.append(clean(iter.next()));
//       if(iter.hasNext())
//         omegaVarDecl.append(',');
//     }
// 
//     StringBuilder omegaStr = new StringBuilder();
//     omegaStr.append("{[").append(omegaVarDecl.toString()).append("] : ").append(clean(convertPc)).append("};");
// 
//     return omegaStr.toString();
//   }
// 
//   private static String clean(PathCondition pc) {
//     return (pc.header == null) ? "TRUE" : clean(pc.header.toString());
//   }
// 
//   private static String clean(String constraintsString) {
//     String clean = constraintsString.replaceAll("\\s+", "");
//     clean = clean.replaceAll("CONST_(\\d+)", "$1");
//     clean = clean.replaceAll("CONST_-(\\d+)", "-$1");
//     clean = clean.replaceAll("[a-zA-Z]", "s");
//     return clean;
//   }
// }
// 
// Path: src/main/wcanalysis/heuristic/util/SMTLibConverter.java
// public class SMTLibConverter implements ConstraintsConverter {
// 
//   @Override
//   public String convert(PathCondition pc) {
//     if(pc == null || pc.header == null)
//       return "";
//     StringBuilder smtLib = new StringBuilder();
//     HashSet<String> setOfSymVar = new HashSet<String>();
//     SymbolicVariableCollector collector = new SymbolicVariableCollector(setOfSymVar);
//     collector.collectVariables(pc);
//     //Add declarations
//     for (String var : collector.getListOfVariables())
//       smtLib.append("(declare-const " + var + " Int)\n");
//     //make assertion
//     smtLib.append('\n');
//     smtLib.append("(assert ").append(pc.header.prefix_notation()).append(")\n\n");
//     smtLib.append("(check-sat)\n");
//     smtLib.append("(get-model)");
//     return smtLib.toString();
//   }
// }


import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;
import gov.nasa.jpf.Config;
import gov.nasa.jpf.JPF;
import gov.nasa.jpf.report.Publisher;
import gov.nasa.jpf.report.Reporter;
import gov.nasa.jpf.report.Statistics;
import gov.nasa.jpf.symbc.numeric.PathCondition;
import wcanalysis.heuristic.model.State;
import wcanalysis.heuristic.util.OmegaConverter;
import wcanalysis.heuristic.util.SMTLibConverter;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;

  }

  @Override
  public void publishStatistics() {

  }
  
  private static boolean isFileEmpty(File file) {
    try(BufferedReader br = new BufferedReader(new FileReader(file))) {
        if(br.readLine() == null) {
          return true;
        } else
          return false;
    } catch (IOException e1) {
      e1.printStackTrace();
      return false;
    }
  }
  
  @Override
  public void publishResult() {
    PathListener pathListener = getListener();
    if(pathListener != null) {
      
      Statistics stat = reporter.getStatistics();
      
      WorstCasePath wcPath = pathListener.getWcPath();
      if(wcPath == null)
        return;
// Path: src/main/wcanalysis/heuristic/model/State.java
// public abstract class State implements CSVable, Comparable<State> {
//   private final PathCondition pc;
//   
//   public State(PathCondition pc) {
//     this.pc = pc;
//   }
//   
//   public PathCondition getPathCondition() {
//     return this.pc;
//   }
//   
//   // Should this return a double, or would we like to parameterize this (e.g. to subclasses of Number)?
//   public abstract double getWC();
// }
// 
// Path: src/main/wcanalysis/heuristic/util/OmegaConverter.java
// public class OmegaConverter implements ConstraintsConverter {
// 
//   @Override
//   public String convert(PathCondition pc) {
//     if(pc == null)
//       return "";
//     PathCondition convertPc = pc.make_copy(); //probably not necessary...
// 
//     HashSet<String> vars = new HashSet<>();
//     //TODO: does the collector *only* collect integer vars? That's weird
//     SymbolicVariableCollector collector = new SymbolicVariableCollector(vars);
//     collector.collectVariables(convertPc);
// 
//     StringBuilder omegaVarDecl = new StringBuilder();
//     Iterator<String> iter = vars.iterator();
//     while(iter.hasNext()) {
//       omegaVarDecl.append(clean(iter.next()));
//       if(iter.hasNext())
//         omegaVarDecl.append(',');
//     }
// 
//     StringBuilder omegaStr = new StringBuilder();
//     omegaStr.append("{[").append(omegaVarDecl.toString()).append("] : ").append(clean(convertPc)).append("};");
// 
//     return omegaStr.toString();
//   }
// 
//   private static String clean(PathCondition pc) {
//     return (pc.header == null) ? "TRUE" : clean(pc.header.toString());
//   }
// 
//   private static String clean(String constraintsString) {
//     String clean = constraintsString.replaceAll("\\s+", "");
//     clean = clean.replaceAll("CONST_(\\d+)", "$1");
//     clean = clean.replaceAll("CONST_-(\\d+)", "-$1");
//     clean = clean.replaceAll("[a-zA-Z]", "s");
//     return clean;
//   }
// }
// 
// Path: src/main/wcanalysis/heuristic/util/SMTLibConverter.java
// public class SMTLibConverter implements ConstraintsConverter {
// 
//   @Override
//   public String convert(PathCondition pc) {
//     if(pc == null || pc.header == null)
//       return "";
//     StringBuilder smtLib = new StringBuilder();
//     HashSet<String> setOfSymVar = new HashSet<String>();
//     SymbolicVariableCollector collector = new SymbolicVariableCollector(setOfSymVar);
//     collector.collectVariables(pc);
//     //Add declarations
//     for (String var : collector.getListOfVariables())
//       smtLib.append("(declare-const " + var + " Int)\n");
//     //make assertion
//     smtLib.append('\n');
//     smtLib.append("(assert ").append(pc.header.prefix_notation()).append(")\n\n");
//     smtLib.append("(check-sat)\n");
//     smtLib.append("(get-model)");
//     return smtLib.toString();
//   }
// }


// Path: src/main/wcanalysis/heuristic/ResultsPublisher.java
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;
import gov.nasa.jpf.Config;
import gov.nasa.jpf.JPF;
import gov.nasa.jpf.report.Publisher;
import gov.nasa.jpf.report.Reporter;
import gov.nasa.jpf.report.Statistics;
import gov.nasa.jpf.symbc.numeric.PathCondition;
import wcanalysis.heuristic.model.State;
import wcanalysis.heuristic.util.OmegaConverter;
import wcanalysis.heuristic.util.SMTLibConverter;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;


  }

  @Override
  public void publishStatistics() {

  }
  
  private static boolean isFileEmpty(File file) {
    try(BufferedReader br = new BufferedReader(new FileReader(file))) {
        if(br.readLine() == null) {
          return true;
        } else
          return false;
    } catch (IOException e1) {
      e1.printStackTrace();
      return false;
    }
  }
  
  @Override
  public void publishResult() {
    PathListener pathListener = getListener();
    if(pathListener != null) {
      
      Statistics stat = reporter.getStatistics();
      
      WorstCasePath wcPath = pathListener.getWcPath();
      if(wcPath == null)
        return;
      State wcState = wcPath.getWCState();