[1138] | 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 |
|
---|
[1152] | 21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
|
---|
[1217] | 22 | import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription;
|
---|
[1138] | 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>
|
---|
[1217] | 30 | * The usability evaluator is responsible for performing a usability evaluation on a task model.
|
---|
| 31 | * Therefore he uses a {@link UsabilityRuleset}.
|
---|
[1138] | 32 | * </p>
|
---|
| 33 | *
|
---|
| 34 | * @author Alexander Deicke
|
---|
| 35 | */
|
---|
| 36 | public class UsabilityEvaluator {
|
---|
[1217] | 37 |
|
---|
| 38 | /**
|
---|
| 39 | * <p>
|
---|
| 40 | * The task model, which should be evaluated.
|
---|
| 41 | * </p>
|
---|
| 42 | */
|
---|
[1152] | 43 | private ITaskModel taskModel;
|
---|
[1138] | 44 |
|
---|
[1217] | 45 | private UsabilityEvaluator(ITaskModel taskModel) {
|
---|
| 46 | this.taskModel = taskModel;
|
---|
[1138] | 47 | }
|
---|
[1217] | 48 |
|
---|
[1138] | 49 | /**
|
---|
| 50 | * <p>
|
---|
[1217] | 51 | * Creates and initializes a new instance.
|
---|
[1138] | 52 | * </p>
|
---|
[1217] | 53 | *
|
---|
| 54 | * @param taskModel
|
---|
| 55 | * task model, which is subject of usability evaluation
|
---|
| 56 | * @return instance of {@link UsabilityEvaluator}
|
---|
[1138] | 57 | */
|
---|
[1217] | 58 | public static UsabilityEvaluator evaluate(ITaskModel taskModel) {
|
---|
| 59 | return new UsabilityEvaluator(taskModel);
|
---|
[1138] | 60 | }
|
---|
| 61 |
|
---|
| 62 | /**
|
---|
| 63 | * <p>
|
---|
[1217] | 64 | * Starts usability evaluation, using given {@link UsabilityRuleset}.
|
---|
[1138] | 65 | * </p>
|
---|
[1217] | 66 | *
|
---|
| 67 | * @param ruleset
|
---|
| 68 | * {@link UsabilityRuleset} used for usability evaluation
|
---|
| 69 | * @return result of usability evaluation as {@link UsabilityResult}
|
---|
[1138] | 70 | */
|
---|
| 71 | public UsabilityResult using(UsabilityRuleset ruleset) {
|
---|
[1152] | 72 | Console.traceln(Level.INFO, "evaluating usability of task tree " + this.taskModel);
|
---|
[1150] | 73 | EvaluationMethodCaller evaluationMethodCaller = new EvaluationMethodCaller();
|
---|
[1138] | 74 | UsabilityResult result = new UsabilityResult();
|
---|
[1217] | 75 | for (UsabilityRule rule : ruleset.evaluationRules()) {
|
---|
| 76 | Optional<UsabilityProblemDescription> defect =
|
---|
| 77 | rule.callEvaluationMethod(evaluationMethodCaller);
|
---|
| 78 | if (defect.isPresent()) {
|
---|
| 79 | result.addProblem(defect.get());
|
---|
[1138] | 80 | }
|
---|
| 81 | }
|
---|
| 82 | return result;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | }
|
---|