source: trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluator.java @ 1150

Last change on this file since 1150 was 1150, checked in by adeicke, 11 years ago

Added usage patterns and mechanism for detecting them.

  • Property svn:mime-type set to text/plain
File size: 2.3 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.logging.Level;
18
19import com.google.common.base.Optional;
20
21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
22import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
23import de.ugoe.cs.autoquest.usability.rules.UsabilityResult;
24import de.ugoe.cs.autoquest.usability.rules.UsabilityRule;
25import de.ugoe.cs.autoquest.usability.rules.UsabilityRuleset;
26import de.ugoe.cs.util.console.Console;
27
28/**
29 * <p>
30 * TODO comment
31 * </p>
32 *
33 * @author Alexander Deicke
34 */
35public class UsabilityEvaluator {
36   
37    private ITaskTree taskTree;
38
39    private UsabilityEvaluator(ITaskTree taskTree) {
40        this.taskTree = taskTree;
41    }
42   
43    /**
44     * <p>
45     * TODO: comment
46     * </p>
47     *
48     * @param taskTree
49     * @return
50     */
51    public static UsabilityEvaluator evaluate(ITaskTree taskTree) {
52        return new UsabilityEvaluator(taskTree);
53    }
54
55    /**
56     * <p>
57     * TODO: comment
58     * </p>
59     *
60     * @param object
61     * @return
62     */
63    public UsabilityResult using(UsabilityRuleset ruleset) {
64        Console.traceln(Level.INFO, "evaluating usability of task tree " + this.taskTree);
65        EvaluationMethodCaller evaluationMethodCaller = new EvaluationMethodCaller();
66        UsabilityResult result = new UsabilityResult();
67        for(UsabilityRule rule : ruleset.evaluationRules()) {
68            Optional<UsabilityDefect> defect = rule.callEvaluationMethod(evaluationMethodCaller);
69            if(defect.isPresent()) {
70                result.addDefect(defect.get());
71            }
72        }
73        return result;
74    }
75
76}
Note: See TracBrowser for help on using the repository browser.