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