public void generateCSV ( ) { int cont = 0 ; int algorithmSize = this . streams . get ( 0 ) . algorithm . size ( ) ; int streamSize = this . streams . size ( ) ; int measureSize = this . streams . get ( 0 ) . algorithm . get ( 0 ) . measures . size ( ) ; while ( cont != measureSize ) { String output = "" ; output += "Algorithm," ; output += this . streams . get ( 0 ) . algorithm . get ( 0 ) . name ; //Inicialize summary table for ( int i = 1 ; i < algorithmSize ; i ++ ) { output += "," + this . streams . get ( 0 ) . algorithm . get ( i ) . name ; } output += "\n" ; for ( int i = 0 ; i < streamSize ; i ++ ) { List < Algorithm > alg = this . streams . get ( i ) . algorithm ; output += this . streams . get ( i ) . name ; for ( int j = 0 ; j < algorithmSize ; j ++ ) { output += "," + alg . get ( j ) . measures . get ( cont ) . getValue ( ) ; } output += "\n" ; } //PrintStream out = null; String name = this . streams . get ( 0 ) . algorithm . get ( 0 ) . measures . get ( cont ) . getName ( ) ; // try { // out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path + name + ".csv"))); // } catch (FileNotFoundException ex) { // Logger.getLogger(Summary.class.getName()).log(Level.SEVERE, null, ex); // } // System.setOut(out); // System.out.println(output); // out.close(); try { BufferedWriter out = new BufferedWriter ( new FileWriter ( path + name + ".csv" ) ) ; out . write ( output ) ; //Replace with the string //you are trying to write out . close ( ) ; } catch ( IOException e ) { System . out . println ( name + ".csv" ) ; } cont ++ ; } }
Generate a csv file for the statistical analysis .