[927] | 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 | |
---|
[922] | 15 | package de.ugoe.cs.autoquest.usability; |
---|
[442] | 16 | |
---|
[1493] | 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 | |
---|
[442] | 22 | /** |
---|
| 23 | * TODO comment |
---|
| 24 | * |
---|
| 25 | * @version $Revision: $ $Date: 16.07.2012$ |
---|
| 26 | * @author 2012, last modified by $Author: pharms$ |
---|
| 27 | */ |
---|
[1918] | 28 | public class UsabilitySmellIntensity { |
---|
[561] | 29 | |
---|
[1918] | 30 | /** */ |
---|
| 31 | private int ratio; |
---|
[1493] | 32 | |
---|
| 33 | /** */ |
---|
[1918] | 34 | private int eventCoverage; |
---|
| 35 | |
---|
| 36 | /** */ |
---|
| 37 | private int eventCoverageQuantile; |
---|
[561] | 38 | |
---|
[1493] | 39 | /** |
---|
| 40 | * |
---|
| 41 | */ |
---|
[1918] | 42 | static UsabilitySmellIntensity getIntensity(int ratio, |
---|
| 43 | ITask taskWithSmell, |
---|
| 44 | ITaskModel wholeTaskModel) |
---|
[1493] | 45 | { |
---|
[1918] | 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); |
---|
[1493] | 50 | } |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * |
---|
| 54 | */ |
---|
[1918] | 55 | static UsabilitySmellIntensity getIntensity(int ratio) { |
---|
| 56 | return getIntensity(ratio, -1, -1); |
---|
[1493] | 57 | } |
---|
| 58 | |
---|
| 59 | /** |
---|
| 60 | * |
---|
| 61 | */ |
---|
[1918] | 62 | static UsabilitySmellIntensity getIntensity(int ratio, |
---|
| 63 | int eventCoverage, |
---|
| 64 | int eventCoverageQuantile) |
---|
[1493] | 65 | { |
---|
[1918] | 66 | if ((ratio > 0) && ((eventCoverageQuantile == -1) || (eventCoverageQuantile > 0))) { |
---|
| 67 | return new UsabilitySmellIntensity(ratio, eventCoverage, eventCoverageQuantile); |
---|
[1493] | 68 | } |
---|
[1918] | 69 | else { |
---|
| 70 | return null; |
---|
[1493] | 71 | } |
---|
| 72 | } |
---|
[1918] | 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 | |
---|
[442] | 119 | } |
---|