Changeset 1319


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
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsPatternTest.java

    r1218 r1319  
    7575                      "  }" + 
    7676                      "  Selection sel1 {" + 
    77                       "    Selection sel2 {" + 
     77                      "    Sequence seq2 {" + 
    7878                      "      TextInput t2 {}" + 
    7979                      "    }" + 
    8080                      "  }" + 
    8181                      "  Selection sel1 {" + 
    82                       "    Selection sel2 {" + 
     82                      "    Sequence seq3 {" + 
    8383                      "      MouseClick t3 {}" + 
    8484                      "    }" + 
    8585                      "  }" + 
    86                       "  Sequence seq2 {" + 
     86                      "  Sequence seq4 {" + 
    8787                      "    EventTask target3 {}" + 
    8888                      "    EventTask target4 {}" + 
  • trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithPatternTest.java

    r1218 r1319  
    4242        // Given 
    4343        String spec = "UserSession {" + 
    44                               "  Sequence seq1 {" +  
     44                      "  Sequence seq1 {" +  
    4545                      "    TextInput t1 {}" + 
    4646                      "    Selection sel1 {" + 
     
    5050                      "      }" + 
    5151                      "    }" + 
    52                       "    Selection sel1 {" + 
     52                      "    Iteration iter1 {" + 
    5353                      "      MouseClick t2 {}" + 
    5454                      "    }" + 
     
    5757                      "  MouseClick t2 {}" + 
    5858                      "  Iteration iter1 {" + 
    59                       "    MouseClick t4 {}" + 
     59                      "    MouseClick t2 {}" + 
    6060                      "  }" +  
    6161                      "}"; 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/UsabilityEvaluator.java

    r1217 r1319  
    7777                rule.callEvaluationMethod(evaluationMethodCaller); 
    7878            if (defect.isPresent()) { 
    79                 result.addProblem(defect.get()); 
     79                UsabilityProblemDescription description = defect.get(); 
     80                logUsabilityProblem(description); 
     81                result.addProblem(description); 
    8082            } 
    8183        } 
     
    8385    } 
    8486 
     87    private void logUsabilityProblem(UsabilityProblemDescription description) { 
     88        Level level = null; 
     89        switch (description.getSeverityLevel()) { 
     90            case NONE: 
     91                break; 
     92            case INFO: 
     93            case LOW: 
     94                level = Level.INFO; 
     95                break; 
     96            case MEDIUM: 
     97            case HIGH: 
     98                level = Level.WARNING; 
     99        } 
     100        if (level != null) { 
     101            Console.print(description.getSeverityLevel().toString()); 
     102            Console.print(" : "); 
     103            Console.println(description.toString()); 
     104            //Console.traceln(level, description.toString()); 
     105        } 
     106    } 
     107 
    85108} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/result/UsabilityProblemDescription.java

    r1217 r1319  
    8585    } 
    8686 
     87    @Override 
     88    public String toString() { 
     89        return this.description; 
     90    } 
     91     
    8792    /** 
    8893     * <p> 
  • 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 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTargetFilter.java

    r1291 r1319  
    2424import de.ugoe.cs.autoquest.plugin.html.guimodel.HTMLText; 
    2525import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     26import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2627import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2729 
    2830/** 
     
    8587            @Override 
    8688            public IEventTarget apply(ITask task) { 
    87                 return ((IEventTask) task).getEventTarget(); 
     89                // XXX: Use the type of the first instance provided 
     90                ITaskInstance firstInstance = task.getInstances().iterator().next(); 
     91                return ((IEventTaskInstance) firstInstance).getEvent().getTarget(); 
    8892            } 
    8993        }; 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/taskmodel/filter/types/EventTypeFilter.java

    r1291 r1319  
    2828import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    2929import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    3031import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3133 
    3234/** 
     
    9799            @Override 
    98100            public IEventType apply(ITask task) { 
    99                 return ((IEventTask) task).getEventType(); 
     101                // XXX: Use the type of the first instance provided 
     102                ITaskInstance firstInstance = task.getInstances().iterator().next(); 
     103                return ((IEventTaskInstance) firstInstance).getEvent().getType(); 
    100104            } 
    101105        }; 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/NullTask.java

    r1217 r1319  
    1515package de.ugoe.cs.autoquest.usability.util; 
    1616 
     17import java.util.Collection; 
     18import java.util.Collections; 
     19 
    1720import org.apache.commons.lang.StringUtils; 
    1821 
    1922import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     23import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2024import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
    2125 
     
    9195    } 
    9296 
     97    @Override 
     98    public Collection<ITaskInstance> getInstances() { 
     99        // return nothing 
     100        return Collections.emptyList(); 
     101    } 
     102 
    93103} 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/util/TextInputUtil.java

    r1217 r1319  
    2626 
    2727import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2929import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3031 
    3132/** 
     
    4546     *  
    4647     * <p> 
    47      * Returns all entered words and signs of text input events. 
     48     * Returns all entered words and signs of all instances of text input events. 
    4849     * </p> 
    4950     *  
     
    5657        List<Iterable<String>> allTextInputs = Lists.newArrayList(); 
    5758        for (ITask taskWithTextInput : tasksWithTextInputEvents) { 
    58             TextInput textInput = (TextInput) ((IEventTask) taskWithTextInput).getEventType(); 
    59             allTextInputs.add(splitTextIntoWordsAndSigns(textInput.getEnteredText())); 
     59            System.out.print("+"); 
     60            for (ITaskInstance instance : taskWithTextInput.getInstances()) { 
     61                System.out.print("."); 
     62                TextInput textInput = 
     63                    (TextInput) ((IEventTaskInstance) instance).getEvent().getType(); 
     64                allTextInputs.add(splitTextIntoWordsAndSigns(textInput.getEnteredText())); 
     65            } 
     66            System.out.println(""); 
    6067        } 
     68        System.out.println(allTextInputs); 
    6169        return HashMultiset.create(Iterables.concat(allTextInputs)); 
    6270    } 
Note: See TracChangeset for help on using the changeset viewer.