source: trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/EventCoverageRatioRule.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: 2.6 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 EventCoverageRatioRule 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        checkForImportantTasks(results, taskModel);
43
44        return results;
45    }
46
47    /**
48     *
49     */
50    private void checkForImportantTasks(UsabilityEvaluationResult results, ITaskModel taskModel) {
51        for (ITask task : taskModel.getTasks()) {
52            // only sequences are important
53            if (task instanceof ISequence) {
54                ISequence sequence = (ISequence) task;
55                int ratio = taskModel.getTaskInfo(sequence).getMeasureValue
56                    (TaskMetric.EVENT_COVERAGE_RATIO);
57
58                //TODO document magic numbers
59                UsabilityDefectSeverity severity = UsabilityDefectSeverity.getSeverity
60                    (ratio, 300, 150, 50, 10, sequence, taskModel);
61
62                if (severity != null) {
63                    Map<String, Object> parameters = new HashMap<String, Object>();
64                    parameters.put("task", sequence);
65                    parameters.put("ratio", (ratio / 10));
66
67                    results.addDefect(severity, UsabilityDefectDescription.HIGH_EVENT_COVERAGE,
68                                      parameters);
69                }
70            }
71        }
72    }
73}
Note: See TracBrowser for help on using the repository browser.