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 class UsabilitySmellIntensity { |
---|
29 | |
---|
30 | /** */ |
---|
31 | private int ratio; |
---|
32 | |
---|
33 | /** */ |
---|
34 | private int eventCoverage; |
---|
35 | |
---|
36 | /** */ |
---|
37 | private int eventCoverageQuantile; |
---|
38 | |
---|
39 | /** |
---|
40 | * |
---|
41 | */ |
---|
42 | static UsabilitySmellIntensity getIntensity(int ratio, |
---|
43 | ITask taskWithSmell, |
---|
44 | ITaskModel wholeTaskModel) |
---|
45 | { |
---|
46 | ITaskInfo taskInfo = wholeTaskModel.getTaskInfo(taskWithSmell); |
---|
47 | int eventCoverage = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE); |
---|
48 | int eventCoverageQuantile = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE_QUANTILE); |
---|
49 | return getIntensity(ratio, eventCoverage, eventCoverageQuantile); |
---|
50 | } |
---|
51 | |
---|
52 | /** |
---|
53 | * |
---|
54 | */ |
---|
55 | static UsabilitySmellIntensity getIntensity(int ratio) { |
---|
56 | return getIntensity(ratio, -1, -1); |
---|
57 | } |
---|
58 | |
---|
59 | /** |
---|
60 | * |
---|
61 | */ |
---|
62 | static UsabilitySmellIntensity getIntensity(int ratio, |
---|
63 | int eventCoverage, |
---|
64 | int eventCoverageQuantile) |
---|
65 | { |
---|
66 | if ((ratio > 0) && ((eventCoverageQuantile == -1) || (eventCoverageQuantile > 0))) { |
---|
67 | return new UsabilitySmellIntensity(ratio, eventCoverage, eventCoverageQuantile); |
---|
68 | } |
---|
69 | else { |
---|
70 | return null; |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | /** |
---|
75 | * <p> |
---|
76 | * TODO: comment |
---|
77 | * </p> |
---|
78 | * |
---|
79 | * @param ratio |
---|
80 | * @param eventCoverage |
---|
81 | * @param eventCoverageQuantile |
---|
82 | */ |
---|
83 | private UsabilitySmellIntensity(int ratio, int eventCoverage, int eventCoverageQuantile) { |
---|
84 | super(); |
---|
85 | this.ratio = ratio; |
---|
86 | this.eventCoverage = eventCoverage; |
---|
87 | this.eventCoverageQuantile = eventCoverageQuantile; |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | * @return the ratio |
---|
92 | */ |
---|
93 | public int getRatio() { |
---|
94 | return ratio; |
---|
95 | } |
---|
96 | |
---|
97 | /** |
---|
98 | * @return the eventCoverage |
---|
99 | */ |
---|
100 | public int getEventCoverage() { |
---|
101 | return eventCoverage; |
---|
102 | } |
---|
103 | |
---|
104 | /** |
---|
105 | * @return the eventCoverageQuantile |
---|
106 | */ |
---|
107 | public int getEventCoverageQuantile() { |
---|
108 | return eventCoverageQuantile; |
---|
109 | } |
---|
110 | |
---|
111 | /* (non-Javadoc) |
---|
112 | * @see java.lang.Object#toString() |
---|
113 | */ |
---|
114 | @Override |
---|
115 | public String toString() { |
---|
116 | return Integer.toString(ratio); |
---|
117 | } |
---|
118 | |
---|
119 | } |
---|