EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.probfunction.print]

COVERAGE SUMMARY FOR SOURCE FILE [ProbFunctionCSVPrint.java]

nameclass, %method, %block, %line, %
ProbFunctionCSVPrint.java0%   (0/1)0%   (0/3)0%   (0/77)0%   (0/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProbFunctionCSVPrint0%   (0/1)0%   (0/3)0%   (0/77)0%   (0/13)
ProbFunctionCSVPrint (): void 0%   (0/1)0%   (0/3)0%   (0/1)
caseBoxedPDF (BoxedPDF): String 0%   (0/1)0%   (0/35)0%   (0/5)
caseProbabilityMassFunction (ProbabilityMassFunction): String 0%   (0/1)0%   (0/39)0%   (0/7)

1package de.uka.ipd.sdq.probfunction.print;
2 
3import java.util.List;
4 
5import de.uka.ipd.sdq.probfunction.BoxedPDF;
6import de.uka.ipd.sdq.probfunction.ContinuousSample;
7import de.uka.ipd.sdq.probfunction.ProbabilityFunction;
8import de.uka.ipd.sdq.probfunction.ProbabilityMassFunction;
9import de.uka.ipd.sdq.probfunction.Sample;
10import de.uka.ipd.sdq.probfunction.util.ProbfunctionSwitch;
11 
12public class ProbFunctionCSVPrint extends ProbfunctionSwitch<String> {
13 
14        /*
15         * (non-Javadoc)
16         * 
17         * @see de.uka.ipd.sdq.probfunction.util.ProbfunctionSwitch#caseBoxedPDF(de.uka.ipd.sdq.probfunction.BoxedPDF)
18         */
19        /**
20         * Prints a {@link ProbabilityFunction} as comma separated values using the generated EMF visitor.  
21         */
22        @Override
23        public String caseBoxedPDF(BoxedPDF object) {
24                String sampleString = "";
25                for (ContinuousSample s : (List<ContinuousSample>) object.getSamples()) {
26                        double value = s.getProbability();
27                        //double precision = 0.00001;
28                        //double precision = 0.00000001;
29                        
30                        /*value *= 1 / precision;
31                        long temp = Math.round(value);
32                        double prob = temp * precision;
33                        DecimalFormat df = new DecimalFormat("0.00000000", new DecimalFormatSymbols(Locale.US));*/
34                        
35                        //sampleString += " (" + s.getValue() + "; " + df.format(prob)
36                        sampleString += s.getValue() + ";" + value + "\n";
37                }
38                
39                return sampleString;
40        }
41 
42        /*
43         * (non-Javadoc)
44         * 
45         * @see de.uka.ipd.sdq.probfunction.util.ProbfunctionSwitch#caseProbabilityMassFunction(de.uka.ipd.sdq.probfunction.ProbabilityMassFunction)
46         */
47        @Override
48        public String caseProbabilityMassFunction(ProbabilityMassFunction object) {
49        
50                String sampleString = "";
51                String leftSeparator = "";
52                String rightSeparator = ";";
53 
54                
55                for (Sample s : (List<Sample>) object.getSamples()) {
56                        sampleString += leftSeparator + s.getValue() 
57                        + rightSeparator + s.getProbability() + "\n";
58                }
59                return sampleString;
60        }
61 
62 
63 
64}

[all classes][de.uka.ipd.sdq.probfunction.print]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov