Changeset 1319 for trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java
- Timestamp:
- 11/08/13 22:34:21 (11 years ago)
- File:
-
- 1 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();
Note: See TracChangeset
for help on using the changeset viewer.