Changeset 1319 for trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns
- Timestamp:
- 11/08/13 22:34:21 (11 years ago)
- Location:
- trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.