-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResultsOrganizer.java
32 lines (27 loc) · 986 Bytes
/
ResultsOrganizer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package bn;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.File;
import bn.Controller;
class ResultsOrganizer {
private static final String RESULTS_DIR = "./results";
public static void main(String args[]) throws Exception {
String pattern = args[0];
if (args.length > 1) Controller.setUrl(args[1]);
File directory = new File(RESULTS_DIR);
if (! directory.exists()) directory.mkdirs();
Controller controller = Controller.getInstance();
String[] availableResults = controller.getResultsKeys(pattern);
for (String key : availableResults) {
String header = controller.getResultsHeader(key);
String[] results = controller.getResults(key);
String fileName = RESULTS_DIR + "/" + key + ".csv";
PrintWriter output = new PrintWriter(new FileWriter(fileName, false));
output.println(header);
for (String resLine : results) {
output.println(resLine);
}
output.close();
}
}
}