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
Location:
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/UsabilityMetricsRuleset.java

    r1217 r1319  
    4242     *  
    4343     */ 
    44     private UsabilityMetricsRuleset(ITaskModel taskModel) { 
     44    public UsabilityMetricsRuleset(ITaskModel taskModel) { 
    4545        this.metrics = Lists.newArrayList(); 
    4646        metrics.add(new NoLetterOrDigitRatioMetric(taskModel)); 
  • 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(); 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternVisitor.java

    r1293 r1319  
    2020 
    2121import com.google.common.base.Splitter; 
     22import com.google.common.collect.Iterables; 
    2223import com.google.common.collect.Lists; 
    2324 
     25import de.ugoe.cs.autoquest.eventcore.Event; 
    2426import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    2527import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2628import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2729import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2831import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2932import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     
    3134import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    3235import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     36import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3337import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
    3438import de.ugoe.cs.autoquest.test.DummyGUIElement; 
     
    6771    public void visit(IEventTask event) { 
    6872        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()); 
    7176                this.present = eventTarget != null ? matchesEventType && matchesEventTarget : matchesEventType; 
    7277        } 
     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()); 
    7380    } 
    7481 
Note: See TracChangeset for help on using the changeset viewer.