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

COVERAGE SUMMARY FOR SOURCE FILE [AccuracyAnalysisHelper.java]

nameclass, %method, %block, %line, %
AccuracyAnalysisHelper.java0%   (0/1)0%   (0/3)0%   (0/341)0%   (0/65)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AccuracyAnalysisHelper0%   (0/1)0%   (0/3)0%   (0/341)0%   (0/65)
AccuracyAnalysisHelper (): void 0%   (0/1)0%   (0/3)0%   (0/1)
checkBoundsInterval (String, String, SimuComModel, SimulatedStackframe, Strin... 0%   (0/1)0%   (0/267)0%   (0/43)
checkBoundsRange (String, String, SimuComModel, SimulatedStackframe, String, ... 0%   (0/1)0%   (0/71)0%   (0/21)

1package de.uka.ipd.sdq.simucomframework.accuracy;
2 
3import de.fzi.se.accuracy.issues.AccuracyIssueFactory;
4import de.uka.ipd.sdq.pcm.seff.AbstractAction;
5import de.uka.ipd.sdq.simucomframework.model.SimuComModel;
6import de.uka.ipd.sdq.simucomframework.variables.EvaluationProxy;
7import de.uka.ipd.sdq.simucomframework.variables.StackContext;
8import de.uka.ipd.sdq.simucomframework.variables.exceptions.ValueNotInFrameException;
9import de.uka.ipd.sdq.simucomframework.variables.stackframe.SimulatedStackframe;
10 
11/**Tools which help to analyze the accuracy influence in the simucomframework.
12 *
13 * @author groenda
14 */
15public class AccuracyAnalysisHelper {
16 
17        /**Checks that the value for an ID in the stack frame is within the specified bounds.
18         * @param config Issues will be reported to this instance.
19         * @param stackframe The stack frame.
20         * @param simuComId The ID.
21         * @param rdseffId The UUID of the RD-SEFF in which the variable was accessed.
22         * @param actionId UUID of the {@link AbstractAction} for which a message was recorded.
23         * @param resourceName The location of the resource.
24         * @param from Lower bound (inclusive).
25         * @param to Upper bound (inclusive)
26         */
27        public static void checkBoundsInterval(String partitionId, String partitionResourceName, SimuComModel config,
28                        SimulatedStackframe<Object> stackframe, String simuComId,
29                        String rdseffId, String actionId, String resourceName, String from,
30                        String to) {
31                Object value;
32                try {
33                        value = stackframe.getValue(simuComId);
34                        if (value.getClass() == EvaluationProxy.class) {
35                                value = StackContext.evaluateStatic(((EvaluationProxy)value).getStoEx());
36                        }
37                } catch (ValueNotInFrameException e) {
38                        config
39                                        .addIssue(AccuracyIssueFactory
40                                                        .createCharacterisedPCMParameterPartition(
41                                                                        "The partition referenced the variable "
42                                                                                        + simuComId
43                                                                                        + " which was not accessible during runtime. Correct the quality information or PCM model.",
44                                                                        partitionResourceName, partitionId));
45                        return;
46                }
47                if (value instanceof Byte) {
48                        if ((Byte)value >= StackContext.evaluateStatic(from, Byte.class)
49                                        && (Byte)value <= StackContext.evaluateStatic(to, Byte.class)) {
50                                // within bounds. do nothing.
51                        } else {
52                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
53                        }
54                } else if (value instanceof Character) {
55                        if ((Character)value >= StackContext.evaluateStatic(from, Character.class)
56                                        && (Character)value <= StackContext.evaluateStatic(to, Character.class)) {
57                                // within bounds. do nothing.
58                        } else {
59                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
60                        }
61                } else if (value instanceof Short) {
62                        if ((Short)value >= StackContext.evaluateStatic(from, Short.class)
63                                        && (Short)value <= StackContext.evaluateStatic(to, Short.class)) {
64                                // within bounds. do nothing.
65                        } else {
66                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
67                        }
68                } else if (value instanceof Integer) {
69                        if ((Integer)value >= StackContext.evaluateStatic(from, Integer.class)
70                                        && (Integer)value <= StackContext.evaluateStatic(to, Integer.class)) {
71                                // within bounds. do nothing.
72                        } else {
73                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
74                        }
75                } else if (value instanceof Long) {
76                        if ((Long)value >= StackContext.evaluateStatic(from, Long.class)
77                                        && (Long)value <= StackContext.evaluateStatic(to, Long.class)) {
78                                // within bounds. do nothing.
79                        } else {
80                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
81                        }
82                } else if (value instanceof Float) {
83                        if ((Float)value >= StackContext.evaluateStatic(from, Float.class)
84                                        && (Float)value <= StackContext.evaluateStatic(to, Float.class)) {
85                                // within bounds. do nothing.
86                        } else {
87                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
88                        }
89                } else if (value instanceof Double) {
90                        if ((Double)value >= StackContext.evaluateStatic(from, Double.class)
91                                        && (Double)value <= StackContext.evaluateStatic(to, Double.class)) {
92                                // within bounds. do nothing.
93                                config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
94                        }
95                } else {
96                        String msg = "The dynamic type for " + simuComId + " was " + value.getClass().getCanonicalName() + " which is not supported for interval-typed checks in accuracy influence analysis. Use CharacterisedPCMParameterPartitionRange if the value is not a numeric type.";
97                        config.addIssue(AccuracyIssueFactory.createTypeInferenceIssue(msg));
98                }
99        }
100 
101        /**Checks that the value for an ID in the stack frame is within a provided list of values.
102         * @param config Issues will be reported to this instance.
103         * @param stackframe The stack frame.
104         * @param simuComId The ID.
105         * @param rdseffId The UUID of the RD-SEFF in which the variable was accessed.
106         * @param resourceName The location of the resource.
107         * @param actionId UUID of the {@link AbstractAction} in which the variable was accessed.
108         * @param specifications Valid values.
109         */
110        public static void checkBoundsRange(String partitionId, String partitionResourceName, SimuComModel config,
111                        SimulatedStackframe<Object> stackframe, String simuComId,
112                        String rdseffId, String actionId, String resourceName,
113                        String... specifications) {
114                Object value;
115                try {
116                        value = stackframe.getValue(simuComId);
117                        if (value.getClass() == EvaluationProxy.class) {
118                                value = StackContext.evaluateStatic(((EvaluationProxy)value).getStoEx());
119                        }
120                } catch (ValueNotInFrameException e) {
121                        config
122                        .addIssue(AccuracyIssueFactory
123                                        .createCharacterisedPCMParameterPartition(
124                                                        "The partition referenced the variable "
125                                                                        + simuComId
126                                                                        + " which was not accessible during runtime. Correct the quality information or PCM model.",
127                                                        partitionResourceName, partitionId));
128                        return;
129                }
130                Class<?> clazz = value.getClass();
131                boolean found = false;
132                // The value must match one of the provided specifications
133                for (String specification : specifications) {
134                        if (StackContext.evaluateStatic(specification, clazz).equals(value)) {
135                                found = true;
136                                break;
137                        }
138                }
139                if (found == false) {
140                        config.addIssue(AccuracyIssueFactory.createParameterExtrapolationIssue(simuComId, rdseffId, resourceName, value, actionId));
141                }
142        }
143}
144 

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