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 [SoftwareSensitivity.java]

nameclass, %method, %block, %line, %
SoftwareSensitivity.java0%   (0/1)0%   (0/5)0%   (0/161)0%   (0/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SoftwareSensitivity0%   (0/1)0%   (0/5)0%   (0/161)0%   (0/36)
SoftwareSensitivity (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/86)0%   (0/17)
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.reliability.InternalFailureOccurrenceDescription;
11import de.uka.ipd.sdq.pcm.repository.Repository;
12import de.uka.ipd.sdq.pcm.seff.InternalAction;
13import de.uka.ipd.sdq.pcm.seff.SeffFactory;
14import de.uka.ipd.sdq.sensitivity.DoubleParameterVariation;
15 
16/**
17 * Provides sensitivity support to alter the failure probabilities of all
18 * internal actions within the whole PCM Repository.
19 * 
20 * @author brosch
21 * 
22 */
23public class SoftwareSensitivity extends MarkovSensitivity {
24 
25        /**
26         * The list of base values of this sensitivity.
27         */
28        private List<Double> baseValues = null;
29 
30        /**
31         * The list of affected internal failure occurrence descriptions.
32         */
33        private List<InternalFailureOccurrenceDescription> descriptions = null;
34 
35        /**
36         * The constructor.
37         * 
38         * @param name
39         *            the name of the sensitivity analysis
40         * @param variation
41         *            the parameter variation
42         */
43        public SoftwareSensitivity(final String name,
44                        final DoubleParameterVariation variation) {
45 
46                // Initialize base variables:
47                super(name, variation);
48        }
49 
50        /**
51         * Alters the model according to the next sensitivity analysis step.
52         * 
53         * @return indicates if the model could be successfully altered
54         */
55        protected boolean alterModel() {
56 
57                // Set the failure probability:
58                for (int i = 0; i < descriptions.size(); i++) {
59                        descriptions.get(i).setFailureProbability(
60                                        calculator.calculateCurrentDoubleValue(
61                                                        getDoubleVariation(), getCurrentStepNumber(),
62                                                        baseValues.get(i)));
63                }
64 
65                // Everything ok:
66                return true;
67        }
68 
69        /**
70         * Extracts the relevant sensitivity information from the given model.
71         */
72        protected void extractSensitivityInformation() {
73 
74                // Declare result lists:
75                descriptions = new BasicEList<InternalFailureOccurrenceDescription>();
76                baseValues = new ArrayList<Double>();
77 
78                // Retrieve all InternalActions in the PCM Repository:
79                List<Repository> repositories = getModel().getRepositories();
80                if (repositories.size() == 0) {
81                        // No repository found!
82                        logger.error("No PCM Repositories found.");
83                        return;
84                }
85 
86                // Search for the relevant BasicComponent:
87                for (Repository repository : repositories) {
88                        EList<EObject> internalActions = helper.getElements(repository,
89                                        SeffFactory.eINSTANCE.createInternalAction().eClass());
90                        for (EObject object : internalActions) {
91                                for (InternalFailureOccurrenceDescription description : ((InternalAction) object)
92                                                .getInternalFailureOccurrenceDescriptions__InternalAction()) {
93                                        descriptions.add(description);
94                                        baseValues.add(description.getFailureProbability());
95                                }
96                        }
97                }
98                if (descriptions.size() == 0) {
99                        logger.error("Did not find any FailureOccurrenceDescriptions "
100                                        + "in the PCM Repository.");
101                }
102        }
103 
104        /**
105         * Builds the headings strings for logging.
106         * 
107         * @return the log headings strings
108         */
109        protected List<List<String>> getLogHeadingsMulti() {
110 
111                // Create a result list:
112                List<List<String>> resultList = new ArrayList<List<String>>();
113 
114                // Create the headings:
115                ArrayList<String> headings = new ArrayList<String>();
116                headings.add("Software Failure Probabilities");
117                resultList.add(headings);
118 
119                // Return the result:
120                return resultList;
121        }
122 
123        /**
124         * Builds the results strings for sensitivity logging.
125         * 
126         * @return the results strings
127         */
128        protected List<String> getLogSingleResultsMulti() {
129 
130                // Create a result list:
131                List<String> resultList = new ArrayList<String>();
132 
133                // Create the result strings:
134                resultList.add(calculator.getCurrentLogEntry(getDoubleVariation(),
135                                getCurrentStepNumber()));
136 
137                // Return the result:
138                return resultList;
139        }
140}

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