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 |
|
---|
17 | import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
|
---|
18 | import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.SCROLL;
|
---|
19 | import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
|
---|
20 | import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
|
---|
21 | import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
|
---|
22 |
|
---|
23 | import com.google.common.base.Optional;
|
---|
24 |
|
---|
25 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
|
---|
26 | import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller;
|
---|
27 | import de.ugoe.cs.autoquest.usability.result.DefectDescriptionResolver;
|
---|
28 | import de.ugoe.cs.autoquest.usability.result.UsabilityDefect;
|
---|
29 | import de.ugoe.cs.autoquest.usability.rules.UsabilityRule;
|
---|
30 | import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageDefect;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * <p>
|
---|
34 | * TODO comment
|
---|
35 | * </p>
|
---|
36 | *
|
---|
37 | * @author Alexander Deicke
|
---|
38 | */
|
---|
39 | public class LongFormUsageDefect extends UsabilityRule implements UsabilityUsageDefect {
|
---|
40 |
|
---|
41 | private InteractionPattern longFormUsagePattern;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * <p>
|
---|
45 | * TODO: comment
|
---|
46 | * </p>
|
---|
47 | *
|
---|
48 | * @param taskTree
|
---|
49 | */
|
---|
50 | public LongFormUsageDefect(ITaskModel taskModel) {
|
---|
51 | super(taskModel);
|
---|
52 | this.name = "LongFormUsagePattern";
|
---|
53 | this.defect = new DefectDescriptionResolver().descriptionFor(this.getClass().getSimpleName());
|
---|
54 | initUsagePattern();
|
---|
55 | }
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * <p>
|
---|
59 | * TODO: comment
|
---|
60 | * </p>
|
---|
61 | *
|
---|
62 | */
|
---|
63 | private void initUsagePattern() {
|
---|
64 | InteractionPatternBuilder builder = new InteractionPatternBuilder();
|
---|
65 | InteractionPattern fillFormPattern = builder.concernedNode(ITERATION).startsWith(TEXT_INPUT).endsWith(SCROLL).build();
|
---|
66 | this.longFormUsagePattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).contains(fillFormPattern).endsWith(MOUSE_CLICK).build();
|
---|
67 | }
|
---|
68 |
|
---|
69 | /* (non-Javadoc)
|
---|
70 | * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#check()
|
---|
71 | */
|
---|
72 | @Override
|
---|
73 | public Optional<UsabilityDefect> check() {
|
---|
74 | Optional<UsabilityDefect> present = Optional.absent();
|
---|
75 | if(this.longFormUsagePattern.containedIn(taskModel)) {
|
---|
76 | present = Optional.of(this.defect);
|
---|
77 | }
|
---|
78 | return present;
|
---|
79 | }
|
---|
80 |
|
---|
81 | /* (non-Javadoc)
|
---|
82 | * @see de.ugoe.cs.autoquest.usability.rules.UsabilityRule#callEvaluationMetho(de.ugoe.cs.autoquest.usability.EvaluationMethodCaller)
|
---|
83 | */
|
---|
84 | @Override
|
---|
85 | public Optional<UsabilityDefect> callEvaluationMethod(EvaluationMethodCaller evaluationMethodCaller)
|
---|
86 | {
|
---|
87 | return evaluationMethodCaller.check(this);
|
---|
88 | }
|
---|
89 | }
|
---|