package edu.uci.eecs.specCompiler.specExtraction;
+import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
import java.util.ArrayList;
+import edu.uci.eecs.specCompiler.codeGenerator.Environment;
+
public class SourceFileInfo {
public final File file;
public final ArrayList<String> content;
SourceFileInfo another = (SourceFileInfo) o;
return another.file.equals(file);
}
+
+ public void write2File() {
+ String newFileName = Environment.GENERATED_FILE_DIR + "/" + file.getName();
+ File newFile = new File(newFileName);
+ newFile.getParentFile().mkdirs();
+ if (!newFile.exists()) {
+ try {
+ newFile.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ BufferedWriter bw = new BufferedWriter(new FileWriter(newFile));
+ for (int i = 0; i < content.size(); i++) {
+ bw.write(content.get(i) + "\n");
+ }
+ bw.flush();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}