Ignore:
Timestamp:
11/08/13 22:34:21 (11 years ago)
Author:
khartmann
Message:
  • Reworked Filters to use the first instance of a task to provide type and target
  • Added a function to extract all tasks matching a given filter
  • Added simple console feedback for matched usability problems
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  
    1515package de.ugoe.cs.autoquest.usability.rules.patterns; 
    1616 
     17import java.util.Collection; 
     18import java.util.Iterator; 
    1719import java.util.List; 
    1820 
     
    107109     *  
    108110     * <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> 
    109134     * Checks a single {@link ITask} for the interaction pattern. 
    110135     * </p> 
     
    114139     */ 
    115140    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); 
    116145        applyAllVisitors(task); 
     146        System.out.println("------------"); 
    117147        if (allVisitorsArePresent()) { 
    118148            this.present = true; 
     
    121151            resetAllVisitors(); 
    122152        } 
     153        System.out.println("^^^^^^^^^^^^"); 
    123154    } 
    124155 
     
    134165     */ 
    135166    public boolean containedIn(ITask task) { 
     167        System.out.println('>'); 
    136168        checkTask(task); 
     169        System.out.println("< "+this.present); 
    137170        return this.present; 
    138171    } 
     
    151184        Optional<InteractionPatternVisitor> previousVisitor = Optional.absent(); 
    152185        for (InteractionPatternVisitor visitor : patternVisitors) { 
     186            System.out.print(visitor+" "); 
    153187            if (appliedOnSelectionNode(previousVisitor)) { 
     188                System.out.println("Selection"); 
    154189                for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) { 
    155190                    selection.accept(visitor); 
     
    157192            } 
    158193            else { 
     194                System.out.println("Normal"); 
    159195                previousVisitor = Optional.of(visitor); 
    160196                task.accept(visitor); 
    161197            } 
     198            System.out.println(visitor.isPresent() ? '1' : '0'); 
    162199        } 
    163200    } 
     
    208245 
    209246            }); 
    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(); 
    211250    } 
    212251 
     
    218257     */ 
    219258    private void resetAllVisitors() { 
     259        System.out.println("+RESET+"); 
    220260        for (InteractionPatternVisitor visitor : this.patternVisitors) { 
    221261            visitor.reset(); 
Note: See TracChangeset for help on using the changeset viewer.