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 |
|
---|
15 | package de.ugoe.cs.autoquest.usability;
|
---|
16 |
|
---|
17 | import java.util.logging.Level;
|
---|
18 |
|
---|
19 | import com.google.common.base.Optional;
|
---|
20 |
|
---|
21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
|
---|
22 | import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
|
---|
23 | import de.ugoe.cs.autoquest.usability.rules.UsabilityResult;
|
---|
24 | import de.ugoe.cs.autoquest.usability.rules.UsabilityRule;
|
---|
25 | import de.ugoe.cs.autoquest.usability.rules.UsabilityRuleset;
|
---|
26 | import de.ugoe.cs.util.console.Console;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * <p>
|
---|
30 | * TODO comment
|
---|
31 | * </p>
|
---|
32 | *
|
---|
33 | * @author Alexander Deicke
|
---|
34 | */
|
---|
35 | public class UsabilityEvaluator {
|
---|
36 |
|
---|
37 | private ITaskModel taskModel;
|
---|
38 |
|
---|
39 | private UsabilityEvaluator(ITaskModel taskTree) {
|
---|
40 | this.taskModel = taskTree;
|
---|
41 | }
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * <p>
|
---|
45 | * TODO: comment
|
---|
46 | * </p>
|
---|
47 | *
|
---|
48 | * @param taskTree
|
---|
49 | * @return
|
---|
50 | */
|
---|
51 | public static UsabilityEvaluator evaluate(ITaskModel 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.taskModel);
|
---|
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 | }
|
---|