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

COVERAGE SUMMARY FOR SOURCE FILE [MTTRSensitivity.java]

nameclass, %method, %block, %line, %
MTTRSensitivity.java0%   (0/1)0%   (0/5)0%   (0/153)0%   (0/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MTTRSensitivity0%   (0/1)0%   (0/5)0%   (0/153)0%   (0/37)
MTTRSensitivity (String, DoubleParameterVariation): void 0%   (0/1)0%   (0/11)0%   (0/4)
alterModel (): boolean 0%   (0/1)0%   (0/30)0%   (0/6)
extractSensitivityInformation (): void 0%   (0/1)0%   (0/78)0%   (0/18)
getLogHeadingsMulti (): List 0%   (0/1)0%   (0/18)0%   (0/5)
getLogSingleResultsMulti (): List 0%   (0/1)0%   (0/16)0%   (0/4)

1package de.uka.ipd.sdq.reliability.solver.sensitivity;
2 
3import java.util.ArrayList;
4import java.util.List;
5 
6import org.eclipse.emf.common.util.BasicEList;
7import org.eclipse.emf.common.util.EList;
8import org.eclipse.emf.ecore.EObject;
9 
10import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification;
11import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceContainer;
12import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentFactory;
13import de.uka.ipd.sdq.sensitivity.DoubleParameterVariation;
14 
15/**
16 * Alters all MTTR values of hardware resources in the model.
17 * 
18 * @author brosch
19 * 
20 */
21public class MTTRSensitivity extends MarkovSensitivity {
22 
23        /**
24         * The list of base values.
25         */
26        List<Double> baseValues = null;
27 
28        /**
29         * The list of affected processing resource specifications.
30         */
31        List<ProcessingResourceSpecification> specifications = null;
32 
33        /**
34         * The constructor.
35         * 
36         * @param name
37         *            the name of the sensitivity analysis
38         * @param variation
39         *            the parameter variation
40         */
41        public MTTRSensitivity(final String name,
42                        final DoubleParameterVariation variation) {
43 
44                // Initialize basic variables:
45                super(name, variation);
46        }
47 
48        /**
49         * Alters the model according to the next sensitivity analysis step.
50         * 
51         * @return indicates if the model could be successfully altered
52         */
53        protected boolean alterModel() {
54 
55                // Iterate through all specifications:
56                for (int i = 0; i < specifications.size(); i++) {
57                        // Set the failure probability:
58                        specifications.get(i).setMTTR(
59                                        calculator.calculateCurrentDoubleValue(
60                                                        getDoubleVariation(), getCurrentStepNumber(),
61                                                        baseValues.get(i)));
62                }
63 
64                // Everything ok:
65                return true;
66        }
67 
68        /**
69         * Extracts the relevant sensitivity information from the given model.
70         */
71        protected void extractSensitivityInformation() {
72 
73                // Declare result variables:
74                specifications = new BasicEList<ProcessingResourceSpecification>();
75                baseValues = new ArrayList<Double>();
76 
77                // Retrieve the PCM resource environment:
78                if (getModel().getResourceEnvironment() == null) {
79                        // No resource environment found!
80                        logger.error("No PCM ResourceEnvironment found.");
81                        return;
82                }
83 
84                // Retrieve all resource specifications in all containers:
85                ResourceContainer resourceContainer = null;
86                EList<EObject> resourceContainers = helper.getElements(getModel()
87                                .getResourceEnvironment(), ResourceenvironmentFactory.eINSTANCE
88                                .createResourceContainer().eClass());
89                for (EObject object : resourceContainers) {
90                        resourceContainer = (ResourceContainer) object;
91                        for (ProcessingResourceSpecification specification : resourceContainer
92                                        .getActiveResourceSpecifications_ResourceContainer()) {
93                                specifications.add(specification);
94                                baseValues.add(specification.getMTTR());
95                        }
96                }
97                if (specifications.size() == 0) {
98                        logger.error("Did not find any ProcessingResourceSpecifications "
99                                        + "in the PCM ResourceEnvironment");
100                }
101        }
102 
103        /**
104         * Builds the headings strings for logging.
105         * 
106         * @return the log headings strings
107         */
108        protected List<List<String>> getLogHeadingsMulti() {
109 
110                // Create a result list:
111                List<List<String>> resultList = new ArrayList<List<String>>();
112 
113                // Create the headings:
114                ArrayList<String> headings = new ArrayList<String>();
115                headings.add("Mean Time To Repair");
116                resultList.add(headings);
117 
118                // Return the result:
119                return resultList;
120        }
121 
122        /**
123         * Builds the results strings for sensitivity logging.
124         * 
125         * @return the results strings
126         */
127        protected List<String> getLogSingleResultsMulti() {
128 
129                // Create a result list:
130                List<String> resultList = new ArrayList<String>();
131 
132                // Create the result strings:
133                resultList.add(calculator.getCurrentLogEntry(getDoubleVariation(),
134                                getCurrentStepNumber()));
135 
136                // Return the result:
137                return resultList;
138        }
139}

[all classes][de.uka.ipd.sdq.reliability.solver.sensitivity]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov