@@ -17,11 +17,15 @@ object Model {
1717
1818 private var anomalyIterator: Iterator <Anomaly >? = null
1919 private var curAnomaly: Anomaly ? = null
20- private var outFileName : String ? = null
20+ private var outFile : File ? = null
2121 private var outCsv: CSVPrinter ? = null
2222
23+ fun openDefaultDataset () {
24+ openDataset(File (" anomalies_grouped" ))
25+ }
26+
2327 fun openDataset (repoRoot : File ) {
24- val dirs = repoRoot.listFiles() ? : return
28+ val dirs = repoRoot.listFiles()?.sorted() ? : return
2529
2630 val anomalySequence = buildSequence {
2731 for (dir in dirs) {
@@ -30,7 +34,7 @@ object Model {
3034 }
3135
3236 val categoryName = dir.name
33- for (file in dir.listFiles()) {
37+ for (file in dir.listFiles().sorted() ) {
3438 if (file.extension != " kt" ) {
3539 continue
3640 }
@@ -52,8 +56,8 @@ object Model {
5256
5357 outCsv?.close()
5458 val timestamp = SimpleDateFormat (" MM-dd-HH-mm" ).format(Date ())
55- outFileName = " marked_$timestamp .csv"
56- outCsv = CSVFormat .EXCEL .print (File (outFileName) , Charsets .UTF_8 )
59+ outFile = File ( " marked_$timestamp .csv" )
60+ outCsv = CSVFormat .EXCEL .print (outFile , Charsets .UTF_8 )
5761 }
5862
5963 fun processUserResponse (response : UserResponse ) {
@@ -117,11 +121,12 @@ object Model {
117121 outCsv!! .close()
118122
119123 information(" Finished dataset!" ,
120- " You are done! Please send $outFileName to the code anomaly researchers." )
124+ " You are done! Please send the file \" ${outFile!! .path} \" " +
125+ " (in current working directory) to the code anomaly researchers." )
121126
122127 anomalyIterator = null
123128 curAnomaly = null
124- outFileName = null
129+ outFile = null
125130 outCsv = null
126131 }
127132
0 commit comments