Changeset 1319
- Timestamp:
- 11/08/13 22:34:21 (11 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsPatternTest.java
r1218 r1319 75 75 " }" + 76 76 " Selection sel1 {" + 77 " Se lection sel2 {" +77 " Sequence seq2 {" + 78 78 " TextInput t2 {}" + 79 79 " }" + 80 80 " }" + 81 81 " Selection sel1 {" + 82 " Se lection sel2{" +82 " Sequence seq3 {" + 83 83 " MouseClick t3 {}" + 84 84 " }" + 85 85 " }" + 86 " Sequence seq 2{" +86 " Sequence seq4 {" + 87 87 " EventTask target3 {}" + 88 88 " EventTask target4 {}" + -
trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithPatternTest.java
r1218 r1319 42 42 // Given 43 43 String spec = "UserSession {" + 44 44 " Sequence seq1 {" + 45 45 " TextInput t1 {}" + 46 46 " Selection sel1 {" + … … 50 50 " }" + 51 51 " }" + 52 " Selection sel1 {" +52 " Iteration iter1 {" + 53 53 " MouseClick t2 {}" + 54 54 " }" + … … 57 57 " MouseClick t2 {}" + 58 58 " Iteration iter1 {" + 59 " MouseClick t 4{}" +59 " MouseClick t2 {}" + 60 60 " }" + 61 61 "}"; -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluator.java
r1217 r1319 77 77 rule.callEvaluationMethod(evaluationMethodCaller); 78 78 if (defect.isPresent()) { 79 result.addProblem(defect.get()); 79 UsabilityProblemDescription description = defect.get(); 80 logUsabilityProblem(description); 81 result.addProblem(description); 80 82 } 81 83 } … … 83 85 } 84 86 87 private void logUsabilityProblem(UsabilityProblemDescription description) { 88 Level level = null; 89 switch (description.getSeverityLevel()) { 90 case NONE: 91 break; 92 case INFO: 93 case LOW: 94 level = Level.INFO; 95 break; 96 case MEDIUM: 97 case HIGH: 98 level = Level.WARNING; 99 } 100 if (level != null) { 101 Console.print(description.getSeverityLevel().toString()); 102 Console.print(" : "); 103 Console.println(description.toString()); 104 //Console.traceln(level, description.toString()); 105 } 106 } 107 85 108 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescription.java
r1217 r1319 85 85 } 86 86 87 @Override 88 public String toString() { 89 return this.description; 90 } 91 87 92 /** 88 93 * <p> -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityMetricsRuleset.java
r1217 r1319 42 42 * 43 43 */ 44 p rivateUsabilityMetricsRuleset(ITaskModel taskModel) {44 public UsabilityMetricsRuleset(ITaskModel taskModel) { 45 45 this.metrics = Lists.newArrayList(); 46 46 metrics.add(new NoLetterOrDigitRatioMetric(taskModel)); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java
r1292 r1319 15 15 package de.ugoe.cs.autoquest.usability.rules.patterns; 16 16 17 import java.util.Collection; 18 import java.util.Iterator; 17 19 import java.util.List; 18 20 … … 107 109 * 108 110 * <p> 111 * Returns all tasks of the given task model matching the provided interaction pattern. 112 * </p> 113 * 114 * @param taskModel 115 * {@link ITaskModel}, which might contain the interaction pattern 116 * @return all tasks matched 117 */ 118 public Collection<ITask> matchingTasks(ITaskModel taskModel) { 119 List<ITask> allConcernedTasks = filterAllConcernedTasksFrom(taskModel); 120 for (Iterator<ITask> iterator = allConcernedTasks.iterator(); iterator.hasNext();) { 121 ITask concernedTask = iterator.next(); 122 checkTask(concernedTask); 123 if (this.present) 124 this.present = false; 125 else 126 iterator.remove(); 127 } 128 return allConcernedTasks; 129 } 130 131 /** 132 * 133 * <p> 109 134 * Checks a single {@link ITask} for the interaction pattern. 110 135 * </p> … … 114 139 */ 115 140 private void checkTask(ITask task) { 141 System.out.println("+++++++++++++++"); 142 System.out.println(task); 143 System.out.println(this); 144 System.out.println(this.patternVisitors); 116 145 applyAllVisitors(task); 146 System.out.println("------------"); 117 147 if (allVisitorsArePresent()) { 118 148 this.present = true; … … 121 151 resetAllVisitors(); 122 152 } 153 System.out.println("^^^^^^^^^^^^"); 123 154 } 124 155 … … 134 165 */ 135 166 public boolean containedIn(ITask task) { 167 System.out.println('>'); 136 168 checkTask(task); 169 System.out.println("< "+this.present); 137 170 return this.present; 138 171 } … … 151 184 Optional<InteractionPatternVisitor> previousVisitor = Optional.absent(); 152 185 for (InteractionPatternVisitor visitor : patternVisitors) { 186 System.out.print(visitor+" "); 153 187 if (appliedOnSelectionNode(previousVisitor)) { 188 System.out.println("Selection"); 154 189 for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) { 155 190 selection.accept(visitor); … … 157 192 } 158 193 else { 194 System.out.println("Normal"); 159 195 previousVisitor = Optional.of(visitor); 160 196 task.accept(visitor); 161 197 } 198 System.out.println(visitor.isPresent() ? '1' : '0'); 162 199 } 163 200 } … … 208 245 209 246 }); 210 return Iterables.size(allPresent) == this.patternVisitors.size(); 247 int cnt = Iterables.size(allPresent); 248 System.out.printf("%d/%d\n", cnt, this.patternVisitors.size()); 249 return cnt == this.patternVisitors.size(); 211 250 } 212 251 … … 218 257 */ 219 258 private void resetAllVisitors() { 259 System.out.println("+RESET+"); 220 260 for (InteractionPatternVisitor visitor : this.patternVisitors) { 221 261 visitor.reset(); -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternVisitor.java
r1293 r1319 20 20 21 21 import com.google.common.base.Splitter; 22 import com.google.common.collect.Iterables; 22 23 import com.google.common.collect.Lists; 23 24 25 import de.ugoe.cs.autoquest.eventcore.Event; 24 26 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 25 27 import de.ugoe.cs.autoquest.eventcore.IEventType; 26 28 import de.ugoe.cs.autoquest.eventcore.StringEventType; 27 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 28 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 29 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; … … 31 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 32 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 33 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 34 38 import de.ugoe.cs.autoquest.test.DummyGUIElement; … … 67 71 public void visit(IEventTask event) { 68 72 if (!this.present && isEventVisitor()) { 69 boolean matchesEventType = matchesEventType(event.getEventType()); 70 boolean matchesEventTarget = matchesEventTarget(event.getEventTarget()); 73 Event eventRepresentative = ((IEventTaskInstance) event.getInstances().iterator().next()).getEvent(); 74 boolean matchesEventType = matchesEventType(eventRepresentative.getType()); 75 boolean matchesEventTarget = matchesEventTarget(eventRepresentative.getTarget()); 71 76 this.present = eventTarget != null ? matchesEventType && matchesEventTarget : matchesEventType; 72 77 } 78 System.out.printf("%s [%s, %s, %s]: %s\n", event, this.eventType, this.eventTarget, this.taskType, this.present); 79 System.out.println(this.getClass().getSimpleName() + " "+ this.hashCode()); 73 80 } 74 81 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTargetFilter.java
r1291 r1319 24 24 import de.ugoe.cs.autoquest.plugin.html.guimodel.HTMLText; 25 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 26 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 27 29 28 30 /** … … 85 87 @Override 86 88 public IEventTarget apply(ITask task) { 87 return ((IEventTask) task).getEventTarget(); 89 // XXX: Use the type of the first instance provided 90 ITaskInstance firstInstance = task.getInstances().iterator().next(); 91 return ((IEventTaskInstance) firstInstance).getEvent().getTarget(); 88 92 } 89 93 }; -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTypeFilter.java
r1291 r1319 28 28 import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 29 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 30 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 31 33 32 34 /** … … 97 99 @Override 98 100 public IEventType apply(ITask task) { 99 return ((IEventTask) task).getEventType(); 101 // XXX: Use the type of the first instance provided 102 ITaskInstance firstInstance = task.getInstances().iterator().next(); 103 return ((IEventTaskInstance) firstInstance).getEvent().getType(); 100 104 } 101 105 }; -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/NullTask.java
r1217 r1319 15 15 package de.ugoe.cs.autoquest.usability.util; 16 16 17 import java.util.Collection; 18 import java.util.Collections; 19 17 20 import org.apache.commons.lang.StringUtils; 18 21 19 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 23 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 20 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 21 25 … … 91 95 } 92 96 97 @Override 98 public Collection<ITaskInstance> getInstances() { 99 // return nothing 100 return Collections.emptyList(); 101 } 102 93 103 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/TextInputUtil.java
r1217 r1319 26 26 27 27 import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask ;28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 29 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 30 31 31 32 /** … … 45 46 * 46 47 * <p> 47 * Returns all entered words and signs of text input events.48 * Returns all entered words and signs of all instances of text input events. 48 49 * </p> 49 50 * … … 56 57 List<Iterable<String>> allTextInputs = Lists.newArrayList(); 57 58 for (ITask taskWithTextInput : tasksWithTextInputEvents) { 58 TextInput textInput = (TextInput) ((IEventTask) taskWithTextInput).getEventType(); 59 allTextInputs.add(splitTextIntoWordsAndSigns(textInput.getEnteredText())); 59 System.out.print("+"); 60 for (ITaskInstance instance : taskWithTextInput.getInstances()) { 61 System.out.print("."); 62 TextInput textInput = 63 (TextInput) ((IEventTaskInstance) instance).getEvent().getType(); 64 allTextInputs.add(splitTextIntoWordsAndSigns(textInput.getEnteredText())); 65 } 66 System.out.println(""); 60 67 } 68 System.out.println(allTextInputs); 61 69 return HashMultiset.create(Iterables.concat(allTextInputs)); 62 70 }
Note: See TracChangeset
for help on using the changeset viewer.