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

Last change on this file since 1217 was 1217, checked in by adeicke, 11 years ago
  • Added proper formating and JavaDoc?.
  • Several renaming refactorings.
  • Property svn:mime-type set to text/plain
File size: 2.9 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.ITaskModel;
22import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription;
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 * The usability evaluator is responsible for performing a usability evaluation on a task model.
31 * Therefore he uses a {@link UsabilityRuleset}.
32 * </p>
33 *
34 * @author Alexander Deicke
35 */
36public class UsabilityEvaluator {
37
38    /**
39     * <p>
40     * The task model, which should be evaluated.
41     * </p>
42     */
43    private ITaskModel taskModel;
44
45    private UsabilityEvaluator(ITaskModel taskModel) {
46        this.taskModel = taskModel;
47    }
48
49    /**
50     * <p>
51     * Creates and initializes a new instance.
52     * </p>
53     *
54     * @param taskModel
55     *            task model, which is subject of usability evaluation
56     * @return instance of {@link UsabilityEvaluator}
57     */
58    public static UsabilityEvaluator evaluate(ITaskModel taskModel) {
59        return new UsabilityEvaluator(taskModel);
60    }
61
62    /**
63     * <p>
64     * Starts usability evaluation, using given {@link UsabilityRuleset}.
65     * </p>
66     *
67     * @param ruleset
68     *            {@link UsabilityRuleset} used for usability evaluation
69     * @return result of usability evaluation as {@link UsabilityResult}
70     */
71    public UsabilityResult using(UsabilityRuleset ruleset) {
72        Console.traceln(Level.INFO, "evaluating usability of task tree " + this.taskModel);
73        EvaluationMethodCaller evaluationMethodCaller = new EvaluationMethodCaller();
74        UsabilityResult result = new UsabilityResult();
75        for (UsabilityRule rule : ruleset.evaluationRules()) {
76            Optional<UsabilityProblemDescription> defect =
77                rule.callEvaluationMethod(evaluationMethodCaller);
78            if (defect.isPresent()) {
79                result.addProblem(defect.get());
80            }
81        }
82        return result;
83    }
84
85}
Note: See TracBrowser for help on using the repository browser.