[1040] | 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.
|
---|
[1030] | 14 |
|
---|
| 15 | package de.ugoe.cs.autoquest.usability.evaluation.rule.set;
|
---|
| 16 |
|
---|
| 17 | import java.util.EnumSet;
|
---|
| 18 |
|
---|
| 19 | import com.google.common.base.Optional;
|
---|
| 20 |
|
---|
| 21 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
|
---|
| 22 | import de.ugoe.cs.autoquest.usability.evaluation.result.UsabilityDefect;
|
---|
| 23 | import de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator.NoLetterOrDigitTextInputsEvaluator;
|
---|
| 24 | import de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator.TextInputEntryRepetitionsEvaluator;
|
---|
| 25 | import de.ugoe.cs.autoquest.usability.evaluation.rule.evaluator.TextInputRatioEvaluator;
|
---|
| 26 |
|
---|
[1040] | 27 | /**
|
---|
| 28 | * <p>
|
---|
| 29 | * TODO comment
|
---|
| 30 | * </p>
|
---|
| 31 | *
|
---|
| 32 | * @author Alexander Deicke
|
---|
| 33 | */
|
---|
[1030] | 34 | public class TextInputUsabiliyRuleset implements UsabilityRuleset {
|
---|
| 35 |
|
---|
| 36 | private enum TextInputUsabilityRule implements UsabilityRule {
|
---|
| 37 |
|
---|
| 38 | TEXT_FIELD_INPUT_RATIO {
|
---|
[1040] | 39 |
|
---|
[1030] | 40 | @Override
|
---|
| 41 | public Optional<UsabilityDefect> evaluate(ITaskTree taskTree) {
|
---|
| 42 | return new TextInputRatioEvaluator(this, taskTree).evaluationResult();
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | @Override
|
---|
| 46 | public String ruleIdentifier() {
|
---|
| 47 | return this.name();
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | },
|
---|
| 51 |
|
---|
| 52 | TEXT_FIELD_INPUT_REPETITIONS {
|
---|
| 53 |
|
---|
| 54 | @Override
|
---|
| 55 | public Optional<UsabilityDefect> evaluate(ITaskTree taskTree) {
|
---|
| 56 | return new TextInputEntryRepetitionsEvaluator(this, taskTree).evaluationResult();
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | @Override
|
---|
| 60 | public String ruleIdentifier() {
|
---|
| 61 | return this.name();
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | },
|
---|
| 65 |
|
---|
| 66 | TEXT_FIELD_NO_LETTER_OR_DIGIT_RATIO {
|
---|
| 67 |
|
---|
| 68 | @Override
|
---|
| 69 | public Optional<UsabilityDefect> evaluate(ITaskTree taskTree) {
|
---|
| 70 | return new NoLetterOrDigitTextInputsEvaluator(this, taskTree).evaluationResult();
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | @Override
|
---|
| 74 | public String ruleIdentifier() {
|
---|
| 75 | return this.name();
|
---|
| 76 | }
|
---|
| 77 |
|
---|
[1040] | 78 | };
|
---|
[1030] | 79 |
|
---|
| 80 | public abstract Optional<UsabilityDefect> evaluate(ITaskTree taskTree);
|
---|
| 81 |
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | private final EnumSet<TextInputUsabilityRule> TEXT_INPUT_USABILITY_RULESET = EnumSet
|
---|
| 85 | .allOf(TextInputUsabilityRule.class);
|
---|
| 86 |
|
---|
| 87 | @Override
|
---|
[1034] | 88 | public EnumSet<? extends UsabilityRule> evaluationRules() {
|
---|
[1030] | 89 | return TEXT_INPUT_USABILITY_RULESET;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | }
|
---|