[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 | |
---|
[2162] | 17 | import java.io.Serializable; |
---|
| 18 | |
---|
[1493] | 19 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
| 20 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo; |
---|
| 21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; |
---|
| 22 | import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; |
---|
| 23 | |
---|
[442] | 24 | /** |
---|
| 25 | * TODO comment |
---|
| 26 | * |
---|
| 27 | * @version $Revision: $ $Date: 16.07.2012$ |
---|
| 28 | * @author 2012, last modified by $Author: pharms$ |
---|
| 29 | */ |
---|
[2162] | 30 | public class UsabilitySmellIntensity implements Serializable { |
---|
[561] | 31 | |
---|
[2162] | 32 | /** */ |
---|
| 33 | private static final long serialVersionUID = 1L; |
---|
| 34 | |
---|
[1918] | 35 | /** */ |
---|
| 36 | private int ratio; |
---|
[1493] | 37 | |
---|
| 38 | /** */ |
---|
[1918] | 39 | private int eventCoverage; |
---|
| 40 | |
---|
| 41 | /** */ |
---|
| 42 | private int eventCoverageQuantile; |
---|
[561] | 43 | |
---|
[1493] | 44 | /** |
---|
| 45 | * |
---|
| 46 | */ |
---|
[1918] | 47 | static UsabilitySmellIntensity getIntensity(int ratio, |
---|
| 48 | ITask taskWithSmell, |
---|
| 49 | ITaskModel wholeTaskModel) |
---|
[1493] | 50 | { |
---|
[1918] | 51 | ITaskInfo taskInfo = wholeTaskModel.getTaskInfo(taskWithSmell); |
---|
| 52 | int eventCoverage = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE); |
---|
| 53 | int eventCoverageQuantile = taskInfo.getMeasureValue(TaskMetric.EVENT_COVERAGE_QUANTILE); |
---|
| 54 | return getIntensity(ratio, eventCoverage, eventCoverageQuantile); |
---|
[1493] | 55 | } |
---|
| 56 | |
---|
| 57 | /** |
---|
| 58 | * |
---|
| 59 | */ |
---|
[1918] | 60 | static UsabilitySmellIntensity getIntensity(int ratio) { |
---|
| 61 | return getIntensity(ratio, -1, -1); |
---|
[1493] | 62 | } |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * |
---|
| 66 | */ |
---|
[1918] | 67 | static UsabilitySmellIntensity getIntensity(int ratio, |
---|
| 68 | int eventCoverage, |
---|
| 69 | int eventCoverageQuantile) |
---|
[1493] | 70 | { |
---|
[1918] | 71 | if ((ratio > 0) && ((eventCoverageQuantile == -1) || (eventCoverageQuantile > 0))) { |
---|
| 72 | return new UsabilitySmellIntensity(ratio, eventCoverage, eventCoverageQuantile); |
---|
[1493] | 73 | } |
---|
[1918] | 74 | else { |
---|
| 75 | return null; |
---|
[1493] | 76 | } |
---|
| 77 | } |
---|
[1918] | 78 | |
---|
| 79 | /** |
---|
| 80 | * <p> |
---|
| 81 | * TODO: comment |
---|
| 82 | * </p> |
---|
| 83 | * |
---|
| 84 | * @param ratio |
---|
| 85 | * @param eventCoverage |
---|
| 86 | * @param eventCoverageQuantile |
---|
| 87 | */ |
---|
| 88 | private UsabilitySmellIntensity(int ratio, int eventCoverage, int eventCoverageQuantile) { |
---|
| 89 | super(); |
---|
| 90 | this.ratio = ratio; |
---|
| 91 | this.eventCoverage = eventCoverage; |
---|
| 92 | this.eventCoverageQuantile = eventCoverageQuantile; |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | /** |
---|
| 96 | * @return the ratio |
---|
| 97 | */ |
---|
| 98 | public int getRatio() { |
---|
| 99 | return ratio; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | /** |
---|
| 103 | * @return the eventCoverage |
---|
| 104 | */ |
---|
| 105 | public int getEventCoverage() { |
---|
| 106 | return eventCoverage; |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | /** |
---|
| 110 | * @return the eventCoverageQuantile |
---|
| 111 | */ |
---|
| 112 | public int getEventCoverageQuantile() { |
---|
| 113 | return eventCoverageQuantile; |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | /* (non-Javadoc) |
---|
| 117 | * @see java.lang.Object#toString() |
---|
| 118 | */ |
---|
| 119 | @Override |
---|
| 120 | public String toString() { |
---|
| 121 | return Integer.toString(ratio); |
---|
| 122 | } |
---|
| 123 | |
---|
[442] | 124 | } |
---|