(String[] args)
| 90 | } |
| 91 | |
| 92 | public static void main(String[] args) { |
| 93 | BufferedWriter buffWriter = null; |
| 94 | try { |
| 95 | //the output file location |
| 96 | File csvFile = new File("data/" + table_name + "/" + table_name + "_k" + key_colnum |
| 97 | + "_j" + join_column + "_" + record_num + condition +".csv"); |
| 98 | FileWriter writer = new FileWriter(csvFile, false); |
| 99 | buffWriter = new BufferedWriter(writer, 1024); |
| 100 | //write the column names |
| 101 | String title = "id"; |
| 102 | for (int i = 0; i < key_colnum; i++) { |
| 103 | title += ",keyword" + i; |
| 104 | } |
| 105 | for (int i = 0; i < join_column; i++) { |
| 106 | title += ",join-attr" + i; |
| 107 | } |
| 108 | buffWriter.write(title + "\n"); |
| 109 | |
| 110 | int counter = 0; |
| 111 | |
| 112 | for (int i = 0; i < 10; i++) { |
| 113 | counter = write_all_matched(buffWriter, i, (i + 1) * 500, counter); |
| 114 | } |
| 115 | for (int i = 0; i < 10; i++) { |
| 116 | counter = write_partly_matched(buffWriter, i + 10, 500, (i + 1) * 100, counter); |
| 117 | } |
| 118 | |
| 119 | System.out.println(counter); |
| 120 | for (int i = counter; i < record_num; i++) { |
| 121 | String csv = table_name + "_id_" + counter; |
| 122 | for (int j = 0; j < key_colnum; j++) { |
| 123 | csv += "," + table_name +"_keyword_" + counter + "_" + j; |
| 124 | } |
| 125 | for (int j = 0; j < join_column; j++) { |
| 126 | csv += "," + "join_" + counter + "_" + j; |
| 127 | } |
| 128 | counter++; |
| 129 | buffWriter.write(csv); |
| 130 | buffWriter.newLine(); |
| 131 | buffWriter.flush(); |
| 132 | } |
| 133 | } catch (Exception e) { |
| 134 | System.out.println("Exception of writing into csv."); |
| 135 | e.printStackTrace(); |
| 136 | } finally { |
| 137 | try { |
| 138 | if (buffWriter != null) { |
| 139 | buffWriter.close(); |
| 140 | } |
| 141 | } catch (IOException e) { |
| 142 | e.printStackTrace(); |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | } |
nothing calls this directly
no test coverage detected