]> git.somenet.org - pub/jan/lsdc.git/blob - src/at/ac/tuwien/lsdc/util/CSVScenariosLogger.java
added some Files and comments and methods
[pub/jan/lsdc.git] / src / at / ac / tuwien / lsdc / util / CSVScenariosLogger.java
1 package at.ac.tuwien.lsdc.util;
2
3 import java.io.FileWriter;
4 import java.io.IOException;
5 import java.util.List;
6
7 import at.ac.tuwien.lsdc.types.ScenarioData;
8 import au.com.bytecode.opencsv.CSVWriter;
9
10 public class CSVScenariosLogger {
11         
12         private final String filename;
13
14         public CSVScenariosLogger(String filename) {
15                 this.filename = filename;
16         }
17         
18         public void appendScenarioData( ScenarioData data ) {
19                 //check if filename exists
20                 //if not create file with header
21                 //append line data.toString()
22         }
23
24         public void writeFile(List data) throws IOException {
25                 CSVWriter writer = new CSVWriter(new FileWriter(filename), '\t');
26                 writer.writeAll(data);
27                 writer.close();
28         }
29
30         public void writeLine(String[] data) throws IOException {
31                 CSVWriter writer = new CSVWriter(new FileWriter(filename), '\t');
32                 writer.writeNext(data);
33                 writer.close();
34         }
35 }