Commit 2bed3908 authored by Jaime Arias's avatar Jaime Arias
Browse files

fix output format for the minimal scheduling algorithm

parent ac5791dd
......@@ -33,7 +33,7 @@ import org.cosyverif.model.Model;
authors = {
"Jaime Arias",
"Laure Petrucci",
"Wojciech Penczek",
"Wojciech Penczek",
"Teofil Sidoruk"
},
keywords = {})
......@@ -46,7 +46,7 @@ public class MinimalScheduling extends BinaryService {
formalism = "http://formalisms.cosyverif.org/adtree.fml")
private Model modelParameter;
@Parameter(name = "Scheduling Information",
@Parameter(name = "Scheduling Information",
help = "Scheduling information for each generated graph.",
direction = Direction.OUT,
multiline = true)
......@@ -101,49 +101,35 @@ public class MinimalScheduling extends BinaryService {
String line = "";
String match;
FileWriter fw = null;
try {
File fileOutput = new File(baseDirectory().getAbsolutePath() + "/" + modelFile.getName() + ".log");
fr = new FileReader(fileOutput);
br = new BufferedReader(fr);
fw = new FileWriter(modelFile.getParent() + "/debug.out");
fw.write("writing output: \n");
line = br.readLine();
if (line != null) {
match = line.substring(line.indexOf(":") + 1).trim();
this.nGraphs = Integer.parseInt(match);
fw.append("n graphs: " + match + "\n");
}
while (this.nGraphs > 0 && (line = br.readLine()) != null) {
// find a graph info
if (line.startsWith("Graph #")) {
if (s.length() != 0) { s.append("\n"); }
s.append(line + " => ");
} else if (line.startsWith("# Agents:")) {
s.append(line + " - ");
} else if (line.startsWith("# Slots:")) {
s.append(line);
}
// new graph
if (line == "" && s.length() != 0) {
s.append("\n");
}
}
fw.append("data:\n" + s + "\n");
} catch (Exception e) {
fw.append("error: " + e.getMessage() + "\n");
e.printStackTrace();
} finally {
if (br != null)
br.close();
if (fr != null)
fr.close();
if (fw != null)
fw.close();
}
return s.toString();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment