1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.usability; |
---|
16 | |
---|
17 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
18 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo; |
---|
19 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; |
---|
20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; |
---|
21 | |
---|
22 | /** |
---|
23 | * TODO comment |
---|
24 | * |
---|
25 | * @version $Revision: $ $Date: 16.07.2012$ |
---|
26 | * @author 2012, last modified by $Author: pharms$ |
---|
27 | */ |
---|
28 | public enum UsabilityDefectSeverity { |
---|
29 | |
---|
30 | INFO, LOW, MEDIUM, HIGH; |
---|
31 | |
---|
32 | /** */ |
---|
33 | static int defaultCoverageQuantile = 950; |
---|
34 | |
---|
35 | /** |
---|
36 | * |
---|
37 | */ |
---|
38 | static UsabilityDefectSeverity getSeverity(int ratio, |
---|
39 | int highRatioLevel, |
---|
40 | int mediumRatioLevel, |
---|
41 | int lowRatioLevel, |
---|
42 | int infoRatioLevel) |
---|
43 | { |
---|
44 | return getSeverity(ratio, highRatioLevel, mediumRatioLevel, lowRatioLevel, infoRatioLevel, |
---|
45 | defaultCoverageQuantile); |
---|
46 | } |
---|
47 | |
---|
48 | /** |
---|
49 | * |
---|
50 | */ |
---|
51 | static UsabilityDefectSeverity getSeverity(int ratio, |
---|
52 | int highRatioLevel, |
---|
53 | int mediumRatioLevel, |
---|
54 | int lowRatioLevel, |
---|
55 | int infoRatioLevel, |
---|
56 | ITask taskWithDefect, |
---|
57 | ITaskModel wholeTaskModel) |
---|
58 | { |
---|
59 | ITaskInfo taskInfo = wholeTaskModel.getTaskInfo(taskWithDefect); |
---|
60 | int eventCoverageQuantile = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE_QUANTILE); |
---|
61 | return getSeverity(ratio, highRatioLevel, mediumRatioLevel, lowRatioLevel, infoRatioLevel, |
---|
62 | eventCoverageQuantile); |
---|
63 | } |
---|
64 | |
---|
65 | /** |
---|
66 | * |
---|
67 | */ |
---|
68 | static UsabilityDefectSeverity getSeverity(int ratio, |
---|
69 | int highRatioLevel, |
---|
70 | int mediumRatioLevel, |
---|
71 | int lowRatioLevel, |
---|
72 | int infoRatioLevel, |
---|
73 | int coverageQuantile) |
---|
74 | { |
---|
75 | int effectiveRatio = ratio; |
---|
76 | |
---|
77 | // event coverage ratio is in per mille. The more executed events a task covers, the more |
---|
78 | // important a related usability defect. |
---|
79 | /*if (eventCoverageRatio < 1) { |
---|
80 | // one per mille, so one of thousand events is covered |
---|
81 | effectiveRatio *= 0.2; |
---|
82 | } |
---|
83 | else if (eventCoverageRatio < 5) { |
---|
84 | // 5 per mille, so one of 250 events is covered |
---|
85 | effectiveRatio *= 0.4; |
---|
86 | } |
---|
87 | else if (eventCoverageRatio < 10) { |
---|
88 | // 1 percent, so one of 100 events is covered |
---|
89 | effectiveRatio *= 0.5; |
---|
90 | } |
---|
91 | else if (eventCoverageRatio < 20) { |
---|
92 | // 2 percent, so one of 50 events is covered |
---|
93 | effectiveRatio *= 0.6; |
---|
94 | } |
---|
95 | else if (eventCoverageRatio < 30) { |
---|
96 | // 3 percent, so one of 33 events is covered |
---|
97 | effectiveRatio *= 0.7; |
---|
98 | } |
---|
99 | else if (eventCoverageRatio < 40) { |
---|
100 | // 4 percent, so one of 28 events is covered |
---|
101 | effectiveRatio *= 0.8; |
---|
102 | } |
---|
103 | else if (eventCoverageRatio < 50) { |
---|
104 | // 5 percent, so one of 25 events is covered |
---|
105 | effectiveRatio *= 0.9; |
---|
106 | }*/ |
---|
107 | //else { |
---|
108 | // more than 5 percent, so 1 of 20 events, do not change ratio |
---|
109 | //} |
---|
110 | if (coverageQuantile >= defaultCoverageQuantile) { |
---|
111 | if (effectiveRatio >= highRatioLevel) { |
---|
112 | return UsabilityDefectSeverity.HIGH; |
---|
113 | } |
---|
114 | else if (effectiveRatio >= mediumRatioLevel) { |
---|
115 | return UsabilityDefectSeverity.MEDIUM; |
---|
116 | } |
---|
117 | else if (effectiveRatio >= lowRatioLevel) { |
---|
118 | return UsabilityDefectSeverity.LOW; |
---|
119 | } |
---|
120 | else if (effectiveRatio >= infoRatioLevel) { |
---|
121 | return UsabilityDefectSeverity.INFO; |
---|
122 | } |
---|
123 | } |
---|
124 | |
---|
125 | return null; |
---|
126 | } |
---|
127 | } |
---|