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

COVERAGE SUMMARY FOR SOURCE FILE [PerformanceSolver.java]

nameclass, %method, %block, %line, %
PerformanceSolver.java0%   (0/2)0%   (0/13)0%   (0/169)0%   (0/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PerformanceSolver0%   (0/1)0%   (0/5)0%   (0/44)0%   (0/10)
PerformanceSolver (): void 0%   (0/1)0%   (0/17)0%   (0/5)
PerformanceSolver (RUPerformanceOps): void 0%   (0/1)0%   (0/15)0%   (0/5)
access$0 (PerformanceSolver): RUPerformanceOps 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (PerformanceSolver): IProbabilityFunctionFactory 0%   (0/1)0%   (0/3)0%   (0/1)
getResourceUsageTimes (Expression): Hashtable 0%   (0/1)0%   (0/6)0%   (0/1)
     
class PerformanceSolver$10%   (0/1)0%   (0/8)0%   (0/125)0%   (0/26)
PerformanceSolver$1 (PerformanceSolver): void 0%   (0/1)0%   (0/6)0%   (0/2)
caseAcquire (Acquire): Object 0%   (0/1)0%   (0/7)0%   (0/2)
caseAlternative (Alternative): Object 0%   (0/1)0%   (0/31)0%   (0/5)
caseLoop (Loop): Object 0%   (0/1)0%   (0/27)0%   (0/7)
caseParallel (Parallel): Object 0%   (0/1)0%   (0/19)0%   (0/3)
caseRelease (Release): Object 0%   (0/1)0%   (0/7)0%   (0/2)
caseSequence (Sequence): Object 0%   (0/1)0%   (0/19)0%   (0/3)
caseSymbol (Symbol): Object 0%   (0/1)0%   (0/9)0%   (0/2)

1package de.uka.ipd.sdq.spa.basicsolver;
2 
3import java.util.Hashtable;
4import java.util.List;
5 
6import de.uka.ipd.sdq.probfunction.math.IProbabilityFunctionFactory;
7import de.uka.ipd.sdq.probfunction.math.IProbabilityMassFunction;
8import de.uka.ipd.sdq.probfunction.math.ManagedPDF;
9import de.uka.ipd.sdq.probfunction.math.exception.ConfigurationNotSetException;
10import de.uka.ipd.sdq.spa.basicsolver.operations.RUPerformanceOps;
11import de.uka.ipd.sdq.spa.expression.Acquire;
12import de.uka.ipd.sdq.spa.expression.Alternative;
13import de.uka.ipd.sdq.spa.expression.Expression;
14import de.uka.ipd.sdq.spa.expression.Loop;
15import de.uka.ipd.sdq.spa.expression.Parallel;
16import de.uka.ipd.sdq.spa.expression.Release;
17import de.uka.ipd.sdq.spa.expression.Sequence;
18import de.uka.ipd.sdq.spa.expression.Symbol;
19import de.uka.ipd.sdq.spa.expression.util.ExpressionSwitch;
20import de.uka.ipd.sdq.spa.resourcemodel.ActiveResource;
21import de.uka.ipd.sdq.spa.resourcemodel.ResourceUsage;
22 
23public class PerformanceSolver {
24        
25        private IProbabilityFunctionFactory pfFactory = IProbabilityFunctionFactory.eINSTANCE;
26        
27        private RUPerformanceOps performanceOps;
28        
29        private ExpressionSwitch exprSwitch = new ExpressionSwitch() {
30 
31                @Override
32                public Object caseAcquire(Acquire object) {
33                        System.err.println("Acquire ignored in performance computation!");
34                        return super.caseAcquire(object);
35                }
36 
37                @SuppressWarnings("unchecked")
38                @Override
39                public Object caseAlternative(Alternative object) {
40                         
41                        Hashtable<ActiveResource, ManagedPDF> leftRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(object.getLeftOption().getRegexp());
42                        Hashtable<ActiveResource, ManagedPDF> rightRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(object.getRightOption().getRegexp());
43                        double leftProb = object.getLeftOption().getProbability();
44                        double rightProb = object.getRightOption().getProbability();
45                        return performanceOps.computeAlternative(leftRUs, leftProb , rightRUs, rightProb);
46                }
47 
48                @SuppressWarnings("unchecked")
49                @Override
50                public Object caseLoop(Loop loop) {
51                        Hashtable<ActiveResource, ManagedPDF> innerRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(loop.getRegExp());
52                        IProbabilityMassFunction iterations = pfFactory.transformToPMF( loop.getIterationsPMF() );
53                        try {
54                                return performanceOps.computeIteration(innerRUs, iterations);
55                        } catch (ConfigurationNotSetException e) {
56                                e.printStackTrace();
57                                System.exit(-1);
58                                return null;
59                        }
60                }
61 
62                @SuppressWarnings("unchecked")
63                @Override
64                public Object caseParallel(Parallel object) {
65                        Hashtable<ActiveResource, ManagedPDF> leftRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(object.getLeftTask());
66                        Hashtable<ActiveResource, ManagedPDF> rightRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(object.getRightTask());
67                        return performanceOps.computeParallel(leftRUs, rightRUs);
68                }
69 
70                @Override
71                public Object caseRelease(Release object) {
72                        System.err.println("Release ignored in performance prediction!");
73                        return super.caseRelease(object);
74                }
75 
76                @SuppressWarnings("unchecked")
77                @Override
78                public Object caseSequence(Sequence object) {
79                        Hashtable<ActiveResource, ManagedPDF> leftRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(object.getLeftRegExp());
80                        Hashtable<ActiveResource, ManagedPDF> rightRUs = (Hashtable<ActiveResource, ManagedPDF>) doSwitch(object.getRightRegExp());
81                        return performanceOps.computeSequence(leftRUs, rightRUs);
82                }
83 
84                @SuppressWarnings("unchecked")
85                @Override
86                public Object caseSymbol(Symbol symbol) {
87                        List<ResourceUsage> resourceUsageList = (List<ResourceUsage>) symbol.getResourceUsages();
88                        return performanceOps.getResourceUsageTimes(resourceUsageList);
89                }
90        };
91        
92        public PerformanceSolver(RUPerformanceOps performanceOps){
93                this.performanceOps = performanceOps;
94        }
95        
96        public PerformanceSolver(){
97                this.performanceOps = new RUPerformanceOps();
98        }
99 
100        @SuppressWarnings("unchecked")
101        public Hashtable<ActiveResource, ManagedPDF> getResourceUsageTimes(Expression expression){
102                return (Hashtable<ActiveResource, ManagedPDF>) exprSwitch.doSwitch(expression);
103        }
104 
105}

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