source: trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/UsabilitySmellIntensity.java @ 2162

Last change on this file since 2162 was 2162, checked in by pharms, 7 years ago
  • changes for first VR oriented usability evaluation
File size: 3.4 KB
Line 
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
15package de.ugoe.cs.autoquest.usability;
16
17import java.io.Serializable;
18
19import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
20import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo;
21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
22import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric;
23
24/**
25 * TODO comment
26 *
27 * @version $Revision: $ $Date: 16.07.2012$
28 * @author 2012, last modified by $Author: pharms$
29 */
30public class UsabilitySmellIntensity implements Serializable {
31   
32    /**  */
33    private static final long serialVersionUID = 1L;
34
35    /** */
36    private int ratio;
37   
38    /** */
39    private int eventCoverage;
40   
41    /** */
42    private int eventCoverageQuantile;
43
44    /**
45     *
46     */
47    static UsabilitySmellIntensity getIntensity(int        ratio,
48                                                ITask      taskWithSmell,
49                                                ITaskModel wholeTaskModel)
50    {
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);
55    }
56
57    /**
58     *
59     */
60    static UsabilitySmellIntensity getIntensity(int ratio) {
61        return getIntensity(ratio, -1, -1);
62    }
63
64    /**
65     *
66     */
67    static UsabilitySmellIntensity getIntensity(int ratio,
68                                                int eventCoverage,
69                                                int eventCoverageQuantile)
70    {
71        if ((ratio > 0) && ((eventCoverageQuantile == -1) || (eventCoverageQuantile > 0))) {
72            return new UsabilitySmellIntensity(ratio, eventCoverage, eventCoverageQuantile);
73        }
74        else {
75            return null;
76        }
77    }
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   
124}
Note: See TracBrowser for help on using the repository browser.