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

COVERAGE SUMMARY FOR SOURCE FILE [PerformanceAlternativeHandler.java]

nameclass, %method, %block, %line, %
PerformanceAlternativeHandler.java0%   (0/1)0%   (0/5)0%   (0/73)0%   (0/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PerformanceAlternativeHandler0%   (0/1)0%   (0/5)0%   (0/73)0%   (0/27)
PerformanceAlternativeHandler (): void 0%   (0/1)0%   (0/3)0%   (0/2)
PerformanceAlternativeHandler (Hashtable): void 0%   (0/1)0%   (0/6)0%   (0/3)
getPdfTable (): Hashtable 0%   (0/1)0%   (0/3)0%   (0/1)
handle (Alternative): void 0%   (0/1)0%   (0/57)0%   (0/19)
setPdfTable (Hashtable): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.spa.basicsolver.visitor.perfhandler;
5 
6import java.util.Hashtable;
7 
8import de.uka.ipd.sdq.probfunction.math.IProbabilityDensityFunction;
9import de.uka.ipd.sdq.probfunction.math.exception.FunctionsInDifferenDomainsException;
10import de.uka.ipd.sdq.probfunction.math.exception.IncompatibleUnitsException;
11import de.uka.ipd.sdq.probfunction.math.exception.UnknownPDFTypeException;
12import de.uka.ipd.sdq.spa.basicsolver.visitor.AlternativeHandler;
13import de.uka.ipd.sdq.spa.expression.Alternative;
14import de.uka.ipd.sdq.spa.expression.Expression;
15 
16/**
17 * @author Ihssane
18 * 
19 */
20public class PerformanceAlternativeHandler implements AlternativeHandler {
21 
22        private Hashtable<Expression, IProbabilityDensityFunction> pdfTable;
23 
24        protected PerformanceAlternativeHandler(
25                        Hashtable<Expression, IProbabilityDensityFunction> pdfTable) {
26                this.pdfTable = pdfTable;
27        }
28 
29        public void handle(Alternative alt) {
30                        try {
31                                IProbabilityDensityFunction leftDF = pdfTable.get(alt.getLeftOption()
32                                                .getRegexp());
33                                IProbabilityDensityFunction rightDF = pdfTable.get(alt.getRightOption()
34                                                .getRegexp());
35                                double rightProb = alt.getRightOption().getProbability();
36                                double leftProb = alt.getLeftOption().getProbability();
37 
38                                IProbabilityDensityFunction altPDF = leftDF.scale(leftProb).add(
39                                                rightDF.scale(rightProb));
40                                pdfTable.put(alt, altPDF);
41                        } catch (FunctionsInDifferenDomainsException e) {
42                                e.printStackTrace();
43                                System.exit(1);
44                        } catch (UnknownPDFTypeException e) {
45                                e.printStackTrace();
46                                System.exit(1);
47                        } catch (IncompatibleUnitsException e) {
48                                e.printStackTrace();
49                                System.exit(1);
50                        }
51        }
52 
53        public Hashtable<Expression, IProbabilityDensityFunction> getPdfTable() {
54                return pdfTable;
55        }
56 
57        public void setPdfTable(
58                        Hashtable<Expression, IProbabilityDensityFunction> pdfTable) {
59                this.pdfTable = pdfTable;
60        }
61 
62        public PerformanceAlternativeHandler() {
63                super();
64        }
65 
66}

[all classes][de.uka.ipd.sdq.spa.basicsolver.visitor.perfhandler]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov