Changeset 1204 for trunk/autoquest-core-usability-evaluation/src/main
- Timestamp:
- 05/01/13 14:31:59 (12 years ago)
- Location:
- trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns
- Files:
-
- 4 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java
r1179 r1204 35 35 * @author Alexander Deicke 36 36 */ 37 public class UsagePattern {37 public class InteractionPattern { 38 38 39 39 private TaskModelFilter taskTreeFilter = new TaskModelFilter(new IterativeDFSFilterStrategy()); … … 41 41 private TaskTypeFilter concernedTask; 42 42 43 private List< UsagePatternVisitor> patternVisitors;43 private List<InteractionPatternVisitor> patternVisitors; 44 44 45 45 private boolean present = false; … … 53 53 * @param eventType 54 54 */ 55 public UsagePattern(TaskTypeFilter concernedNode,56 UsagePatternVisitor... patternVisitor)55 public InteractionPattern(TaskTypeFilter concernedNode, 56 InteractionPatternVisitor... patternVisitor) 57 57 { 58 58 this.patternVisitors = Arrays.asList(patternVisitor); … … 84 84 85 85 private void applyAllVisitors(ITask concernedTask) { 86 Optional< UsagePatternVisitor> previousVisitor = Optional.absent();87 for( UsagePatternVisitor visitor : patternVisitors) {88 if(appliedOnSelectionNode(previousVisitor)) {89 for(ITask selection : previousVisitor.get().getRetainedSelectionNodes()) {90 91 92 93 94 95 86 Optional<InteractionPatternVisitor> previousVisitor = Optional.absent(); 87 for(InteractionPatternVisitor visitor : patternVisitors) { 88 if (appliedOnSelectionNode(previousVisitor)) { 89 for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) { 90 selection.accept(visitor); 91 } 92 } else { 93 previousVisitor = Optional.of(visitor); 94 concernedTask.accept(visitor); 95 } 96 96 } 97 97 } 98 98 99 private boolean appliedOnSelectionNode(Optional< UsagePatternVisitor> previousVisitor) {99 private boolean appliedOnSelectionNode(Optional<InteractionPatternVisitor> previousVisitor) { 100 100 return previousVisitor.isPresent() && previousVisitor.get().hasExcludedSelectionNodes(); 101 101 } … … 121 121 */ 122 122 private boolean allVisitorsArePresent() { 123 Iterable< UsagePatternVisitor> allPresent = Iterables.filter(this.patternVisitors, new Predicate<UsagePatternVisitor>() {123 Iterable<InteractionPatternVisitor> allPresent = Iterables.filter(this.patternVisitors, new Predicate<InteractionPatternVisitor>() { 124 124 125 public boolean apply( UsagePatternVisitor visitor) {125 public boolean apply(InteractionPatternVisitor visitor) { 126 126 return visitor.isPresent(); 127 127 } … … 138 138 */ 139 139 private void resetAllVisitors() { 140 for( UsagePatternVisitor visitor : this.patternVisitors) {140 for(InteractionPatternVisitor visitor : this.patternVisitors) { 141 141 visitor.reset(); 142 142 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternBuilder.java
r1179 r1204 16 16 17 17 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.ContainsEventVisitor; 18 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.Contains PatternVisitor;18 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.ContainsInteractionPatternVisitor; 19 19 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.EndsWithEventVisitor; 20 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.EndsWith PatternVisitor;20 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.EndsWithInteractionPatternVisitor; 21 21 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.StartsWithEventVisitor; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.StartsWith PatternVisitor;22 import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.StartsWithInteractionPatternVisitor; 23 23 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 24 24 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; … … 31 31 * @author Alexander Deicke 32 32 */ 33 public class UsagePatternBuilder {33 public class InteractionPatternBuilder { 34 34 35 35 protected TaskTypeFilter concernedNode; … … 37 37 protected EventTypeFilter startsWithEvent; 38 38 39 protected UsagePattern startsWithPattern;39 protected InteractionPattern startsWithPattern; 40 40 41 41 protected EventTypeFilter endsWithEvent; 42 42 43 protected UsagePattern endsWithPattern;43 protected InteractionPattern endsWithPattern; 44 44 45 45 protected EventTypeFilter containsEvent; 46 46 47 protected UsagePattern containsPattern;47 protected InteractionPattern containsPattern; 48 48 49 49 /** … … 71 71 */ 72 72 public BuildStartsWithEventStep startsWith(EventTypeFilter startsWithType) { 73 UsagePatternBuilder.this.startsWithEvent = startsWithType;73 InteractionPatternBuilder.this.startsWithEvent = startsWithType; 74 74 return new BuildStartsWithEventStep(); 75 75 } … … 83 83 * @return 84 84 */ 85 public BuildStartsWithPatternStep startsWith( UsagePattern startsWithPattern) {86 UsagePatternBuilder.this.startsWithPattern = startsWithPattern;85 public BuildStartsWithPatternStep startsWith(InteractionPattern startsWithPattern) { 86 InteractionPatternBuilder.this.startsWithPattern = startsWithPattern; 87 87 return new BuildStartsWithPatternStep(); 88 88 } … … 97 97 */ 98 98 public BuildEndsWithEventStep endsWith(EventTypeFilter endsWithType) { 99 UsagePatternBuilder.this.endsWithEvent = endsWithType;99 InteractionPatternBuilder.this.endsWithEvent = endsWithType; 100 100 return new BuildEndsWithEventStep(); 101 101 } … … 109 109 * @return 110 110 */ 111 public BuildEndsWithPatternStep endsWith( UsagePattern endsWithPattern) {112 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;111 public BuildEndsWithPatternStep endsWith(InteractionPattern endsWithPattern) { 112 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 113 113 return new BuildEndsWithPatternStep(); 114 114 } … … 123 123 */ 124 124 public BuildContainsEventStep contains(EventTypeFilter containsType) { 125 UsagePatternBuilder.this.containsEvent = containsType;125 InteractionPatternBuilder.this.containsEvent = containsType; 126 126 return new BuildContainsEventStep(); 127 127 } … … 135 135 * @return 136 136 */ 137 public BuildContainsPatternStep contains( UsagePattern containsPattern) {138 UsagePatternBuilder.this.containsPattern = containsPattern;137 public BuildContainsPatternStep contains(InteractionPattern containsPattern) { 138 InteractionPatternBuilder.this.containsPattern = containsPattern; 139 139 return new BuildContainsPatternStep(); 140 140 } … … 153 153 */ 154 154 public BuildStartsAndEndsWithEventStep endsWith(EventTypeFilter endsWithType) { 155 UsagePatternBuilder.this.endsWithEvent = endsWithType;155 InteractionPatternBuilder.this.endsWithEvent = endsWithType; 156 156 return new BuildStartsAndEndsWithEventStep(); 157 157 } … … 165 165 * @return 166 166 */ 167 public BuildStartsWithEventAndEndsWithPattern endsWith( UsagePattern endsWithPattern) {168 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;167 public BuildStartsWithEventAndEndsWithPattern endsWith(InteractionPattern endsWithPattern) { 168 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 169 169 return new BuildStartsWithEventAndEndsWithPattern(); 170 170 } … … 179 179 */ 180 180 public BuildStartsWithEventAndContainsEventStep contains(EventTypeFilter containsType) { 181 UsagePatternBuilder.this.containsEvent = containsType;181 InteractionPatternBuilder.this.containsEvent = containsType; 182 182 return new BuildStartsWithEventAndContainsEventStep(); 183 183 } … … 191 191 * @return 192 192 */ 193 public BuildStartsWithEventAndContainsPatternStep contains( UsagePattern containsPattern) {194 UsagePatternBuilder.this.containsPattern = containsPattern;193 public BuildStartsWithEventAndContainsPatternStep contains(InteractionPattern containsPattern) { 194 InteractionPatternBuilder.this.containsPattern = containsPattern; 195 195 return new BuildStartsWithEventAndContainsPatternStep(); 196 196 } … … 203 203 * @return 204 204 */ 205 public UsagePattern build() {206 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent));205 public InteractionPattern build() { 206 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode)); 207 207 } 208 208 … … 220 220 */ 221 221 public BuildStartsWithPatternAndContainsEventStep contains(EventTypeFilter containsEvent) { 222 UsagePatternBuilder.this.containsEvent = containsEvent;222 InteractionPatternBuilder.this.containsEvent = containsEvent; 223 223 return new BuildStartsWithPatternAndContainsEventStep(); 224 224 } … … 232 232 * @return 233 233 */ 234 public BuildStartsWithPatternAndContainsPatternStep contains( UsagePattern containsPattern) {235 UsagePatternBuilder.this.containsPattern = containsPattern;234 public BuildStartsWithPatternAndContainsPatternStep contains(InteractionPattern containsPattern) { 235 InteractionPatternBuilder.this.containsPattern = containsPattern; 236 236 return new BuildStartsWithPatternAndContainsPatternStep(); 237 237 } … … 246 246 */ 247 247 public BuildStartsWithPatternAndEndsWithEventStep endsWith(EventTypeFilter endsWithEvent) { 248 UsagePatternBuilder.this.endsWithEvent = endsWithEvent;248 InteractionPatternBuilder.this.endsWithEvent = endsWithEvent; 249 249 return new BuildStartsWithPatternAndEndsWithEventStep(); 250 250 } … … 258 258 * @return 259 259 */ 260 public BuildStartsAndEndsWithPatternStep endsWith( UsagePattern endsWithPattern) {261 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;260 public BuildStartsAndEndsWithPatternStep endsWith(InteractionPattern endsWithPattern) { 261 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 262 262 return new BuildStartsAndEndsWithPatternStep(); 263 263 } … … 270 270 * @return 271 271 */ 272 public UsagePattern build() {273 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern));272 public InteractionPattern build() { 273 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode)); 274 274 } 275 275 … … 285 285 * @return 286 286 */ 287 public UsagePattern build() {288 return new UsagePattern(concernedNode, new EndsWithEventVisitor(endsWithEvent));287 public InteractionPattern build() { 288 return new InteractionPattern(concernedNode, new EndsWithEventVisitor(endsWithEvent, concernedNode)); 289 289 } 290 290 … … 300 300 * @return 301 301 */ 302 public UsagePattern build() {303 return new UsagePattern(concernedNode, new EndsWithPatternVisitor(endsWithPattern));302 public InteractionPattern build() { 303 return new InteractionPattern(concernedNode, new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode)); 304 304 } 305 305 … … 317 317 */ 318 318 public BuildContainsAndEndsWithEventStep endsWith(EventTypeFilter endsWithType) { 319 UsagePatternBuilder.this.endsWithEvent = endsWithType;319 InteractionPatternBuilder.this.endsWithEvent = endsWithType; 320 320 return new BuildContainsAndEndsWithEventStep(); 321 321 } … … 328 328 * @return 329 329 */ 330 public UsagePattern build() {331 return new UsagePattern(concernedNode, new ContainsEventVisitor(containsEvent));330 public InteractionPattern build() { 331 return new InteractionPattern(concernedNode, new ContainsEventVisitor(containsEvent, concernedNode)); 332 332 } 333 333 … … 343 343 * @return 344 344 */ 345 public UsagePattern build() {346 return new UsagePattern(concernedNode, new ContainsPatternVisitor(containsPattern));345 public InteractionPattern build() { 346 return new InteractionPattern(concernedNode, new ContainsInteractionPatternVisitor(containsPattern, concernedNode)); 347 347 } 348 348 … … 358 358 * @return 359 359 */ 360 public UsagePattern build() {361 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new EndsWithEventVisitor(endsWithEvent));360 public InteractionPattern build() { 361 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode)); 362 362 } 363 363 … … 373 373 * @return 374 374 */ 375 public UsagePattern build() {376 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new EndsWithPatternVisitor(endsWithPattern));375 public InteractionPattern build() { 376 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode)); 377 377 } 378 378 … … 388 388 * @return 389 389 */ 390 public UsagePattern build() {391 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new EndsWithEventVisitor(endsWithEvent));390 public InteractionPattern build() { 391 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode)); 392 392 } 393 393 … … 403 403 * @return 404 404 */ 405 public UsagePattern build() {406 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new EndsWithPatternVisitor(endsWithPattern));405 public InteractionPattern build() { 406 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode)); 407 407 } 408 408 … … 420 420 */ 421 421 public BuildStartsAndEndsWithEventAndContainsEventStep endsWith(EventTypeFilter endsWithEvent) { 422 UsagePatternBuilder.this.endsWithEvent = endsWithEvent;422 InteractionPatternBuilder.this.endsWithEvent = endsWithEvent; 423 423 return new BuildStartsAndEndsWithEventAndContainsEventStep(); 424 424 } … … 432 432 * @return 433 433 */ 434 public BuildStartsWithEventContainsEventAndEndsWithPatternStep endsWith( UsagePattern endsWithPattern) {435 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;434 public BuildStartsWithEventContainsEventAndEndsWithPatternStep endsWith(InteractionPattern endsWithPattern) { 435 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 436 436 return new BuildStartsWithEventContainsEventAndEndsWithPatternStep(); 437 437 } … … 444 444 * @return 445 445 */ 446 public UsagePattern build() {447 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new ContainsEventVisitor(containsEvent));446 public InteractionPattern build() { 447 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new ContainsEventVisitor(containsEvent, concernedNode)); 448 448 } 449 449 … … 461 461 */ 462 462 public BuildStartsContainsPatternAndEndsWithEventStep endsWith(EventTypeFilter endsWithEvent) { 463 UsagePatternBuilder.this.endsWithEvent = endsWithEvent;463 InteractionPatternBuilder.this.endsWithEvent = endsWithEvent; 464 464 return new BuildStartsContainsPatternAndEndsWithEventStep(); 465 465 } … … 473 473 * @return 474 474 */ 475 public BuildStartsAndEndsWithPatternAndContainsPatternStep endsWith( UsagePattern endsWithPattern) {476 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;475 public BuildStartsAndEndsWithPatternAndContainsPatternStep endsWith(InteractionPattern endsWithPattern) { 476 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 477 477 return new BuildStartsAndEndsWithPatternAndContainsPatternStep(); 478 478 } … … 485 485 * @return 486 486 */ 487 public UsagePattern build() {488 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new ContainsPatternVisitor(containsPattern));487 public InteractionPattern build() { 488 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new ContainsInteractionPatternVisitor(containsPattern, concernedNode)); 489 489 } 490 490 … … 502 502 */ 503 503 public BuildStartsWithEventContainsPatternAndEndsWithEventStep endsWith(EventTypeFilter endsWithEvent) { 504 UsagePatternBuilder.this.endsWithEvent = endsWithEvent;504 InteractionPatternBuilder.this.endsWithEvent = endsWithEvent; 505 505 return new BuildStartsWithEventContainsPatternAndEndsWithEventStep(); 506 506 } … … 514 514 * @return 515 515 */ 516 public BuildStartsWithEventContainsPatternAndEndsWithPatternStep endsWith( UsagePattern endsWithPattern) {517 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;516 public BuildStartsWithEventContainsPatternAndEndsWithPatternStep endsWith(InteractionPattern endsWithPattern) { 517 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 518 518 return new BuildStartsWithEventContainsPatternAndEndsWithPatternStep(); 519 519 } … … 526 526 * @return 527 527 */ 528 public UsagePattern build() {529 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new ContainsPatternVisitor(containsPattern));528 public InteractionPattern build() { 529 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new ContainsInteractionPatternVisitor(containsPattern, concernedNode)); 530 530 } 531 531 … … 543 543 */ 544 544 public BuildStartsWithPatternContainsEventAndEndsWithEventStep endsWith(EventTypeFilter endsWithEvent) { 545 UsagePatternBuilder.this.endsWithEvent = endsWithEvent;545 InteractionPatternBuilder.this.endsWithEvent = endsWithEvent; 546 546 return new BuildStartsWithPatternContainsEventAndEndsWithEventStep(); 547 547 } … … 555 555 * @return 556 556 */ 557 public BuildStartsWithPatternContainsEventAndEndsWithPatternStep endsWith( UsagePattern endsWithPattern) {558 UsagePatternBuilder.this.endsWithPattern = endsWithPattern;557 public BuildStartsWithPatternContainsEventAndEndsWithPatternStep endsWith(InteractionPattern endsWithPattern) { 558 InteractionPatternBuilder.this.endsWithPattern = endsWithPattern; 559 559 return new BuildStartsWithPatternContainsEventAndEndsWithPatternStep(); 560 560 } … … 567 567 * @return 568 568 */ 569 public UsagePattern build() {570 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new ContainsEventVisitor(containsEvent));569 public InteractionPattern build() { 570 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new ContainsEventVisitor(containsEvent, concernedNode)); 571 571 } 572 572 … … 582 582 * @return 583 583 */ 584 public UsagePattern build() {585 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new EndsWithEventVisitor(endsWithEvent), new ContainsEventVisitor(containsEvent));584 public InteractionPattern build() { 585 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode), new ContainsEventVisitor(containsEvent, concernedNode)); 586 586 } 587 587 … … 597 597 * @return 598 598 */ 599 public UsagePattern build() {600 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new ContainsPatternVisitor(containsPattern), new EndsWithEventVisitor(endsWithEvent));599 public InteractionPattern build() { 600 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new ContainsInteractionPatternVisitor(containsPattern, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode)); 601 601 } 602 602 … … 612 612 * @return 613 613 */ 614 public UsagePattern build() {615 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new EndsWithPatternVisitor(endsWithPattern), new ContainsPatternVisitor(containsPattern));614 public InteractionPattern build() { 615 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode), new ContainsInteractionPatternVisitor(containsPattern, concernedNode)); 616 616 } 617 617 … … 627 627 * @return 628 628 */ 629 public UsagePattern build() {630 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new ContainsEventVisitor(containsEvent), new EndsWithPatternVisitor(endsWithPattern));629 public InteractionPattern build() { 630 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new ContainsEventVisitor(containsEvent, concernedNode), new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode)); 631 631 } 632 632 … … 642 642 * @return 643 643 */ 644 public UsagePattern build() {645 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new ContainsPatternVisitor(containsPattern), new EndsWithEventVisitor(endsWithEvent));644 public InteractionPattern build() { 645 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new ContainsInteractionPatternVisitor(containsPattern, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode)); 646 646 } 647 647 … … 657 657 * @return 658 658 */ 659 public UsagePattern build() {660 return new UsagePattern(concernedNode, new StartsWithEventVisitor(startsWithEvent), new ContainsPatternVisitor(containsPattern), new EndsWithPatternVisitor(endsWithPattern));659 public InteractionPattern build() { 660 return new InteractionPattern(concernedNode, new StartsWithEventVisitor(startsWithEvent, concernedNode), new ContainsInteractionPatternVisitor(containsPattern, concernedNode), new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode)); 661 661 } 662 662 … … 672 672 * @return 673 673 */ 674 public UsagePattern build() {675 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new ContainsEventVisitor(containsEvent), new EndsWithEventVisitor(endsWithEvent));674 public InteractionPattern build() { 675 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new ContainsEventVisitor(containsEvent, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode)); 676 676 } 677 677 … … 687 687 * @return 688 688 */ 689 public UsagePattern build() {690 return new UsagePattern(concernedNode, new StartsWithPatternVisitor(startsWithPattern), new ContainsEventVisitor(containsEvent), new EndsWithPatternVisitor(endsWithPattern));689 public InteractionPattern build() { 690 return new InteractionPattern(concernedNode, new StartsWithInteractionPatternVisitor(startsWithPattern, concernedNode), new ContainsEventVisitor(containsEvent, concernedNode), new EndsWithInteractionPatternVisitor(endsWithPattern, concernedNode)); 691 691 } 692 692 … … 702 702 * @return 703 703 */ 704 public UsagePattern build() {705 return new UsagePattern(concernedNode, new ContainsEventVisitor(containsEvent), new EndsWithEventVisitor(endsWithEvent));704 public InteractionPattern build() { 705 return new InteractionPattern(concernedNode, new ContainsEventVisitor(containsEvent, concernedNode), new EndsWithEventVisitor(endsWithEvent, concernedNode)); 706 706 } 707 707 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternVisitor.java
r1179 r1204 29 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 30 30 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 31 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 31 32 32 33 /** … … 37 38 * @author Alexander Deicke 38 39 */ 39 public abstract class UsagePatternVisitor implements ITaskVisitor {40 public abstract class InteractionPatternVisitor implements ITaskVisitor { 40 41 42 protected TaskTypeFilter taskType; 43 41 44 protected EventTypeFilter eventType; 42 45 43 protected UsagePattern containedPattern;46 protected InteractionPattern containedPattern; 44 47 45 48 protected boolean present = false; 46 49 47 protected List<ITask> retained ChildrenTasksFromSelections = Lists.newArrayList();50 protected List<ITask> retainedSelectionTasks = Lists.newArrayList(); 48 51 49 52 /* (non-Javadoc) … … 89 92 public void visit(ISelection selection) { 90 93 if(isEventVisitor()) { 91 retainNodesWherePatternIsPresent(selection .getChildren());94 retainNodesWherePatternIsPresent(selection); 92 95 this.present = patternIsPresent(); 93 96 } else { … … 96 99 } 97 100 98 protected void retainNodesWherePatternIsPresent(List<ITask> children) { 99 for(ITask task : children) { 101 @SuppressWarnings("unchecked") 102 protected void retainNodesWherePatternIsPresent(ISelection selection) { 103 for(ITask task : selection.getChildren()) { 100 104 this.present = false; 101 105 task.accept(this); 106 if(this.present && this.taskType.filterPredicate().apply(selection)) { 107 this.retainedSelectionTasks.add(selection); 108 } 102 109 if(this.present) { 103 this.retainedChildrenTasksFromSelections.add(task);110 break; 104 111 } 105 112 } … … 107 114 108 115 private boolean patternIsPresent() { 109 return !this.retained ChildrenTasksFromSelections.isEmpty();116 return !this.retainedSelectionTasks.isEmpty(); 110 117 } 111 118 … … 128 135 */ 129 136 public void reset() { 130 this.retained ChildrenTasksFromSelections.clear();137 this.retainedSelectionTasks.clear(); 131 138 this.present = false; 132 139 } … … 151 158 */ 152 159 public List<ITask> getRetainedSelectionNodes() { 153 return this.retained ChildrenTasksFromSelections;160 return this.retainedSelectionTasks; 154 161 } 155 162 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/LongFormUsageDefect.java
r1152 r1204 39 39 public class LongFormUsageDefect extends UsabilityRule implements UsabilityUsageDefect { 40 40 41 private UsagePattern longFormUsagePattern;41 private InteractionPattern longFormUsagePattern; 42 42 43 43 /** … … 62 62 */ 63 63 private void initUsagePattern() { 64 UsagePatternBuilder builder = new UsagePatternBuilder();65 UsagePattern fillFormPattern = builder.concernedNode(ITERATION).startsWith(TEXT_INPUT).endsWith(SCROLL).build();64 InteractionPatternBuilder builder = new InteractionPatternBuilder(); 65 InteractionPattern fillFormPattern = builder.concernedNode(ITERATION).startsWith(TEXT_INPUT).endsWith(SCROLL).build(); 66 66 this.longFormUsagePattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).contains(fillFormPattern).endsWith(MOUSE_CLICK).build(); 67 67 } -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsEventVisitor.java
r1152 r1204 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 21 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 22 import de.ugoe.cs.autoquest.usability.rules.patterns. UsagePatternVisitor;22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 23 23 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 24 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 24 25 25 26 /** … … 30 31 * @author Alexander Deicke 31 32 */ 32 public class ContainsEventVisitor extends UsagePatternVisitor {33 public class ContainsEventVisitor extends InteractionPatternVisitor { 33 34 34 35 /** … … 39 40 * @param containsType 40 41 */ 41 public ContainsEventVisitor(EventTypeFilter containsType ) {42 public ContainsEventVisitor(EventTypeFilter containsType, TaskTypeFilter taskType) { 42 43 this.eventType = containsType; 44 this.taskType = taskType; 43 45 } 44 46 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsInteractionPatternVisitor.java
r1179 r1204 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 21 import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternVisitor; 21 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 23 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 23 24 24 25 /** … … 29 30 * @author Alexander Deicke 30 31 */ 31 public class Contains PatternVisitor extends UsagePatternVisitor {32 public class ContainsInteractionPatternVisitor extends InteractionPatternVisitor { 32 33 33 34 /** … … 38 39 * @param containsPattern 39 40 */ 40 public Contains PatternVisitor(UsagePattern containsPattern) {41 public ContainsInteractionPatternVisitor(InteractionPattern containsPattern, TaskTypeFilter taskType) { 41 42 this.containedPattern = containsPattern; 43 this.taskType = taskType; 42 44 } 43 45 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithEventVisitor.java
r1152 r1204 17 17 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 19 import de.ugoe.cs.autoquest.usability.rules.patterns. UsagePatternVisitor;19 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 20 20 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 21 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 21 22 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 22 23 … … 28 29 * @author Alexander Deicke 29 30 */ 30 public class EndsWithEventVisitor extends UsagePatternVisitor {31 public class EndsWithEventVisitor extends InteractionPatternVisitor { 31 32 32 33 /** … … 37 38 * @param eventType 38 39 */ 39 public EndsWithEventVisitor(EventTypeFilter eventType ) {40 public EndsWithEventVisitor(EventTypeFilter eventType, TaskTypeFilter taskType) { 40 41 this.eventType = eventType; 42 this.taskType = taskType; 41 43 } 42 44 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithInteractionPatternVisitor.java
r1179 r1204 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 21 import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternVisitor; 21 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 23 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 23 24 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 24 25 … … 30 31 * @author Alexander Deicke 31 32 */ 32 public class EndsWith PatternVisitor extends UsagePatternVisitor {33 public class EndsWithInteractionPatternVisitor extends InteractionPatternVisitor { 33 34 34 35 /** … … 39 40 * @param endsWithPattern 40 41 */ 41 public EndsWith PatternVisitor(UsagePattern endsWithPattern) {42 public EndsWithInteractionPatternVisitor(InteractionPattern endsWithPattern, TaskTypeFilter taskType) { 42 43 this.containedPattern = endsWithPattern; 44 this.taskType = taskType; 43 45 } 44 46 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithEventVisitor.java
r1152 r1204 17 17 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 19 import de.ugoe.cs.autoquest.usability.rules.patterns. UsagePatternVisitor;19 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 20 20 import de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter; 21 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 21 22 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 22 23 … … 28 29 * @author Alexander Deicke 29 30 */ 30 public class StartsWithEventVisitor extends UsagePatternVisitor {31 public class StartsWithEventVisitor extends InteractionPatternVisitor { 31 32 32 33 /** … … 37 38 * @param eventType 38 39 */ 39 public StartsWithEventVisitor(EventTypeFilter eventType ) {40 public StartsWithEventVisitor(EventTypeFilter eventType, TaskTypeFilter taskType) { 40 41 this.eventType = eventType; 42 this.taskType = taskType; 41 43 } 42 44 -
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithInteractionPatternVisitor.java
r1179 r1204 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 21 import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternVisitor; 21 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPattern; 22 import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 23 import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter; 23 24 import de.ugoe.cs.autoquest.usability.util.PatternsVisitorUtil; 24 25 … … 30 31 * @author Alexander Deicke 31 32 */ 32 public class StartsWith PatternVisitor extends UsagePatternVisitor {33 public class StartsWithInteractionPatternVisitor extends InteractionPatternVisitor { 33 34 34 35 /** … … 39 40 * @param startsWithPattern 40 41 */ 41 public StartsWith PatternVisitor(UsagePattern startsWithPattern) {42 public StartsWithInteractionPatternVisitor(InteractionPattern startsWithPattern, TaskTypeFilter taskType) { 42 43 this.containedPattern = startsWithPattern; 44 this.taskType = taskType; 43 45 } 44 46
Note: See TracChangeset
for help on using the changeset viewer.