EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.fzi.se.accuracy.transformation]

COVERAGE SUMMARY FOR SOURCE FILE [AccuracyInfluenceSEFFTransformationStrategyMinimum.java]

nameclass, %method, %block, %line, %
AccuracyInfluenceSEFFTransformationStrategyMinimum.java0%   (0/1)0%   (0/8)0%   (0/209)0%   (0/44)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AccuracyInfluenceSEFFTransformationStrategyMinimum0%   (0/1)0%   (0/8)0%   (0/209)0%   (0/44)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/2)
AccuracyInfluenceSEFFTransformationStrategyMinimum (PCMResourceSetPartition):... 0%   (0/1)0%   (0/14)0%   (0/4)
handleInputParametersOfCallAction (CallAction, REPrecision): void 0%   (0/1)0%   (0/36)0%   (0/5)
modifyComponentExternalCall (ExternalCallAction, REPrecision): void 0%   (0/1)0%   (0/27)0%   (0/6)
modifyComponentInternalCall (InternalCallAction, REPrecision): void 0%   (0/1)0%   (0/27)0%   (0/6)
modifyInfrastructureCall (InfrastructureCall, REPrecision): void 0%   (0/1)0%   (0/20)0%   (0/5)
modifyResourceCall (ResourceCall, REPrecision): void 0%   (0/1)0%   (0/51)0%   (0/8)
modifyResourceDemand (ParametricResourceDemand, REPrecision): void 0%   (0/1)0%   (0/30)0%   (0/8)

1/**
2 *
3 */
4package de.fzi.se.accuracy.transformation;
5 
6import org.apache.log4j.Logger;
7 
8import de.fzi.se.quality.qualityannotation.NoPrecision;
9import de.fzi.se.quality.qualityannotation.REPrecision;
10import de.uka.ipd.sdq.pcm.core.PCMRandomVariable;
11import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation;
12import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
13import de.uka.ipd.sdq.pcm.seff.CallAction;
14import de.uka.ipd.sdq.pcm.seff.ExternalCallAction;
15import de.uka.ipd.sdq.pcm.seff.InternalCallAction;
16import de.uka.ipd.sdq.pcm.seff.ServiceEffectSpecification;
17import de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall;
18import de.uka.ipd.sdq.pcm.seff.seff_performance.ParametricResourceDemand;
19import de.uka.ipd.sdq.pcm.seff.seff_performance.ResourceCall;
20import de.uka.ipd.sdq.workflow.pcm.blackboard.PCMResourceSetPartition;
21import de.uka.ipd.sdq.workflow.pcm.runconfig.AccuracyInfluenceAnalysisState;
22 
23/**
24 * Implementing the transformation of given SEFFs for the state
25 * {@link AccuracyInfluenceAnalysisState#MINIMUM}. Start the transformation by
26 * invoking {@link #doSwitch(org.eclipse.emf.ecore.EObject)} with a parameter of
27 * type {@link ServiceEffectSpecification}.
28 *
29 * @author groenda
30 *
31 */
32public class AccuracyInfluenceSEFFTransformationStrategyMinimum extends
33                AbstractAccuracyInfluenceSEFFTransformationStrategy {
34        /** Logger for this class. */
35        private static final Logger logger = Logger.getLogger(AccuracyInfluenceSEFFTransformationStrategyMinimum.class);
36 
37        /** Transformation of the specification of {@link PCMRandomVariable} for the minimum of a precision. */
38        private final PCMRandomVariableSpecificationAccuracyMinimumTrafo randomVariableMinimumTrafo = new PCMRandomVariableSpecificationAccuracyMinimumTrafo();
39        /** Returns the minimum value for a validation precision and provided absolute value. */
40        private final ValidationPrecisionToMinimumLongValue precisionMinimalValue = new ValidationPrecisionToMinimumLongValue();
41 
42        /**Create a new instance using the given quality annotations.
43         * @param pcmPartition Partition containing the quality annotations.
44         */
45        public AccuracyInfluenceSEFFTransformationStrategyMinimum(final PCMResourceSetPartition pcmPartition) {
46                super(pcmPartition);
47        }
48 
49        /* (non-Javadoc)
50         * @see de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.AbstractAccuracyInfluenceSEFFTransformationStrategy#modifyComponentExternalCall(de.uka.ipd.sdq.pcm.seff.ExternalCallAction, de.fzi.se.quality.qualityannotation.REPrecision)
51         */
52        @Override
53        protected void modifyComponentExternalCall(ExternalCallAction call,
54                        REPrecision precision) {
55                // Call Parameters for an CallAction
56                handleInputParametersOfCallAction(call, precision);
57                // Number of Calls for an AbstractAction
58                precisionMinimalValue.setAbsoluteValue(1l);
59                long min = precisionMinimalValue.doSwitch(precision.getDefaultPrecisionNumberOfCalls());
60                if (min < 1) {
61                        //remove action from control flow
62                        call.getPredecessor_AbstractAction().setSuccessor_AbstractAction(call.getSuccessor_AbstractAction());
63                }
64        }
65 
66        /* (non-Javadoc)
67         * @see de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.AbstractAccuracyInfluenceSEFFTransformationStrategy#modifyComponentInternalCall(de.uka.ipd.sdq.pcm.seff.InternalCallAction, de.fzi.se.quality.qualityannotation.REPrecision)
68         */
69        @Override
70        protected void modifyComponentInternalCall(InternalCallAction call,
71                        REPrecision precision) {
72                // Call Parameters for an CallAction
73                handleInputParametersOfCallAction(call, precision);
74                // Number of Calls for an AbstractAction
75                precisionMinimalValue.setAbsoluteValue(1l);
76                long min = precisionMinimalValue.doSwitch(precision.getDefaultPrecisionNumberOfCalls());
77                if (min < 1) {
78                        //remove action from control flow
79                        call.getPredecessor_AbstractAction().setSuccessor_AbstractAction(call.getSuccessor_AbstractAction());
80                }
81        }
82 
83        /* (non-Javadoc)
84         * @see de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.AbstractAccuracyInfluenceSEFFTransformationStrategy#modifyInfrastructureCall(de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall, de.fzi.se.quality.qualityannotation.REPrecision)
85         */
86        @Override
87        protected void modifyInfrastructureCall(InfrastructureCall call,
88                        REPrecision precision) {
89                // Number of Calls
90                randomVariableMinimumTrafo.setModifiedVariable(call.getNumberOfCalls__InfrastructureCall());
91                randomVariableMinimumTrafo.setLowerLimit("0");
92                randomVariableMinimumTrafo.doSwitch(precision.getDefaultPrecisionNumberOfCalls());
93                // Call Parameters
94                handleInputParametersOfCallAction(call, precision);
95        }
96 
97        /* (non-Javadoc)
98         * @see de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.AbstractAccuracyInfluenceSEFFTransformationStrategy#modifyResourceCall(de.uka.ipd.sdq.pcm.seff.seff_performance.ResourceCall, de.fzi.se.quality.qualityannotation.REPrecision)
99         */
100        @Override
101        protected void modifyResourceCall(ResourceCall call, REPrecision precision) {
102                // Number of Calls
103                randomVariableMinimumTrafo.setModifiedVariable(call.getNumberOfCalls__ResourceCall());
104                randomVariableMinimumTrafo.setLowerLimit("0");
105                randomVariableMinimumTrafo.doSwitch(precision.getDefaultPrecisionNumberOfCalls());
106                // Call Parameters
107                for (VariableUsage variableUsage : call.getInputVariableUsages__CallAction()) {
108                        for (VariableCharacterisation varChar : variableUsage.getVariableCharacterisation_VariableUsage()) {
109                                randomVariableMinimumTrafo.setModifiedVariable(varChar.getSpecification_VariableCharacterisation());
110                                randomVariableMinimumTrafo.doSwitch(precision.getDefaultPrecisionCallParameter());
111                        }
112                }
113        }
114 
115        /* (non-Javadoc)
116         * @see de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs.AbstractAccuracyInfluenceSEFFTransformationStrategy#modifyResourceDemand(de.uka.ipd.sdq.pcm.seff.seff_performance.ParametricResourceDemand, de.fzi.se.quality.qualityannotation.REPrecision)
117         */
118        @Override
119        protected void modifyResourceDemand(ParametricResourceDemand demand,
120                        REPrecision precision) {
121                // Number of Calls
122                randomVariableMinimumTrafo.setModifiedVariable(demand.getSpecification_ParametericResourceDemand());
123                randomVariableMinimumTrafo.setLowerLimit("0");
124                randomVariableMinimumTrafo.doSwitch(precision.getDefaultPrecisionNumberOfCalls());
125                // Call Parameters
126                if (!(precision.getDefaultPrecisionCallParameter() instanceof NoPrecision)) {
127                        String msg = "A ResourceDemand has no parameters. The default precision for call parameters must be set to NoPrecision.";
128                        logger.error(msg);
129                        throw new IllegalArgumentException(msg);
130                }
131        }
132 
133        /**Handles the transformation for input parameters of call actions.
134         * @param call Call action to transform.
135         * @param precision Precision.
136         */
137        private void handleInputParametersOfCallAction(CallAction call,
138                        REPrecision precision) {
139                for (VariableUsage variableUsage : call.getInputVariableUsages__CallAction()) {
140                        for (VariableCharacterisation varChar : variableUsage.getVariableCharacterisation_VariableUsage()) {
141                                randomVariableMinimumTrafo.setModifiedVariable(varChar.getSpecification_VariableCharacterisation());
142                                randomVariableMinimumTrafo.doSwitch(precision.getDefaultPrecisionCallParameter());
143                        }
144                }
145        }
146 
147}

[all classes][de.fzi.se.accuracy.transformation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov