1 | package de.uka.ipd.sdq.probfunction.math.util; |
2 | |
3 | import java.io.BufferedWriter; |
4 | import java.io.FileWriter; |
5 | |
6 | import de.uka.ipd.sdq.probfunction.math.ISamplePDF; |
7 | import de.uka.ipd.sdq.probfunction.math.ManagedPDF; |
8 | |
9 | public class StoreHistogramCSV { |
10 | |
11 | public static void store(ManagedPDF pdf, String fileName){ |
12 | ISamplePDF sPDF = pdf.getSamplePdfTimeDomain(); |
13 | FileWriter writer; |
14 | BufferedWriter bufferedWriter; |
15 | |
16 | try { |
17 | writer = new FileWriter(fileName); |
18 | bufferedWriter = new BufferedWriter(writer); |
19 | double pos = 0; |
20 | for( Double d : sPDF.getValuesAsDouble()){ |
21 | bufferedWriter.write( pos + "; " + d + "\n"); |
22 | pos += sPDF.getDistance(); |
23 | } |
24 | bufferedWriter.close(); |
25 | writer.close(); |
26 | } catch(Exception e) { |
27 | } |
28 | } |
29 | } |