[1150] | 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.rules.patterns;
|
---|
| 16 |
|
---|
[1217] | 17 | import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.MOUSE_CLICK;
|
---|
| 18 | import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.SCROLL;
|
---|
| 19 | import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter.TEXT_INPUT;
|
---|
| 20 | import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter.ITERATION;
|
---|
| 21 | import static de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter.SEQUENCE;
|
---|
[1150] | 22 |
|
---|
| 23 | import com.google.common.base.Optional;
|
---|
| 24 |
|
---|
[1152] | 25 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
|
---|
[1150] | 26 | import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller;
|
---|
[1293] | 27 | import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription;
|
---|
[1217] | 28 | import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver;
|
---|
[1150] | 29 | import de.ugoe.cs.autoquest.usability.rules.UsabilityRule;
|
---|
[1217] | 30 | import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageProblem;
|
---|
[1150] | 31 |
|
---|
| 32 | /**
|
---|
| 33 | * <p>
|
---|
| 34 | * TODO comment
|
---|
| 35 | * </p>
|
---|
| 36 | *
|
---|
| 37 | * @author Alexander Deicke
|
---|
| 38 | */
|
---|
[1217] | 39 | public class LongFormUsageProblem extends UsabilityRule implements UsabilityUsageProblem {
|
---|
[1150] | 40 |
|
---|
[1204] | 41 | private InteractionPattern longFormUsagePattern;
|
---|
[1217] | 42 |
|
---|
[1150] | 43 | /**
|
---|
| 44 | * <p>
|
---|
| 45 | * TODO: comment
|
---|
| 46 | * </p>
|
---|
[1217] | 47 | *
|
---|
[1150] | 48 | * @param taskTree
|
---|
| 49 | */
|
---|
[1217] | 50 | public LongFormUsageProblem(ITaskModel taskModel) {
|
---|
[1152] | 51 | super(taskModel);
|
---|
[1150] | 52 | this.name = "LongFormUsagePattern";
|
---|
[1217] | 53 | this.defect =
|
---|
| 54 | new UsabilityProblemDescriptionResolver().descriptionFor(this.getClass()
|
---|
| 55 | .getSimpleName());
|
---|
[1150] | 56 | initUsagePattern();
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | /**
|
---|
| 60 | * <p>
|
---|
| 61 | * TODO: comment
|
---|
| 62 | * </p>
|
---|
[1217] | 63 | *
|
---|
[1150] | 64 | */
|
---|
| 65 | private void initUsagePattern() {
|
---|
[1217] | 66 | InteractionPattern fillFormPattern =
|
---|
| 67 | InteractionPatternBuilder.newPattern().rootTask(ITERATION).startsWithEvent(TEXT_INPUT)
|
---|
| 68 | .endsWithEvent(SCROLL).patternFinished().build();
|
---|
| 69 | this.longFormUsagePattern =
|
---|
| 70 | InteractionPatternBuilder.newPattern().rootTask(SEQUENCE).startsWithEvent(MOUSE_CLICK)
|
---|
| 71 | .containsPattern(fillFormPattern).endsWithEvent(MOUSE_CLICK).patternFinished()
|
---|
| 72 | .build();
|
---|
[1150] | 73 | }
|
---|
| 74 |
|
---|
[1217] | 75 | /*
|
---|
| 76 | * (non-Javadoc)
|
---|
| 77 | *
|
---|
[1150] | 78 | * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check()
|
---|
| 79 | */
|
---|
| 80 | @Override
|
---|
[1217] | 81 | public Optional<UsabilityProblemDescription> check() {
|
---|
| 82 | Optional<UsabilityProblemDescription> present = Optional.absent();
|
---|
| 83 | if (this.longFormUsagePattern.containedIn(taskModel)) {
|
---|
[1150] | 84 | present = Optional.of(this.defect);
|
---|
| 85 | }
|
---|
| 86 | return present;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
[1217] | 89 | /*
|
---|
| 90 | * (non-Javadoc)
|
---|
| 91 | *
|
---|
| 92 | * @see
|
---|
| 93 | * de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest
|
---|
| 94 | * .usability.EvaluationMethodCaller)
|
---|
[1150] | 95 | */
|
---|
| 96 | @Override
|
---|
[1217] | 97 | public Optional<UsabilityProblemDescription> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller)
|
---|
[1150] | 98 | {
|
---|
| 99 | return evaluationMethodCaller.check(this);
|
---|
| 100 | }
|
---|
| 101 | }
|
---|