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

Last change on this file since 1493 was 1493, checked in by pharms, 10 years ago
  • state of the HCSE 2014 Paper. An appropriate tag will follow.
File size: 3.1 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.util.HashMap;
18import java.util.Map;
19
20import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence;
21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
23import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric;
24
25/**
26 * TODO comment
27 *
28 * @version $Revision: $ $Date: 16.07.2012$
29 * @author 2012, last modified by $Author: pharms$
30 */
31public class EventCoverageQuantileRule implements UsabilityEvaluationRule {
32
33    /*
34     * (non-Javadoc)
35     *
36     * @see de.ugoe.cs.usability.UsabilityEvaluationRule#evaluate(TaskTree)
37     */
38    @Override
39    public UsabilityEvaluationResult evaluate(ITaskModel taskModel) {
40        UsabilityEvaluationResult results = new UsabilityEvaluationResult(taskModel);
41
42        checkForCooccurrences(results, taskModel);
43
44        return results;
45    }
46
47    /**
48     *
49     */
50    private void checkForCooccurrences(UsabilityEvaluationResult results, ITaskModel taskModel) {
51        for (ITask task : taskModel.getTasks()) {
52            // only sequences are important for task cooccurrences
53            if (task instanceof ISequence) {
54                ISequence sequence = (ISequence) task;
55                int ratio = taskModel.getTaskInfo(sequence).getMeasureValue
56                    (TaskMetric.EVENT_COVERAGE_QUANTILE);
57
58                //TODO document magic numbers
59                UsabilityDefectSeverity severity = UsabilityDefectSeverity.getSeverity
60                    (ratio, 990, 975, 950, 900, sequence, taskModel);
61
62                if (severity != null) {
63                   
64                    double effRatio = 0;
65                   
66                    if (ratio >= 990) {
67                        effRatio = 1;
68                    }
69                    else if (ratio >= 975) {
70                        effRatio = 2.5;
71                    }
72                    else if (ratio >= 950) {
73                        effRatio = 5;
74                    }
75                    else if (ratio >= 900) {
76                        effRatio = 10;
77                    }
78                   
79                    Map<String, Object> parameters = new HashMap<String, Object>();
80                    parameters.put("task", sequence);
81                    parameters.put("ratio", effRatio);
82
83                    results.addDefect(severity, UsabilityDefectDescription.HIGH_EVENT_COVERAGE,
84                                      parameters);
85                }
86            }
87        }
88    }
89}
Note: See TracBrowser for help on using the repository browser.