Ignore:
Timestamp:
08/10/13 10:26:53 (11 years ago)
Author:
adeicke
Message:

Added possibility to consider event target in interaction patterns.

Location:
trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns
Files:
6 edited

Legend:

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

    r1217 r1293  
    2525import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.StartsWithEventVisitor; 
    2626import de.ugoe.cs.autoquest.usability.rules.patterns.visitors.StartsWithInteractionPatternVisitor; 
     27import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
    2728import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
    2829import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
     
    3637 */ 
    3738public class InteractionPatternBuilder { 
    38  
    39     /** 
    40      * <p> 
    41      * Type of root task. Determines the order in which sub task appear. 
    42      * </p> 
    43      */ 
    44     protected TaskTypeFilter rootTask; 
    45  
    46     /** 
    47      * <p> 
    48      * Interaction pattern starts with event. 
    49      * </p> 
    50      */ 
    51     protected EventTypeFilter startsWithEvent; 
    52  
    53     /** 
    54      * <p> 
    55      * Interaction pattern starts with interaction pattern. 
    56      * </p> 
    57      */ 
    58     protected InteractionPattern startsWithPattern; 
    59  
    60     /** 
    61      * <p> 
    62      * Interaction pattern ends with event. 
    63      * </p> 
    64      */ 
    65     protected EventTypeFilter endsWithEvent; 
    66  
    67     /** 
    68      * <p> 
    69      * Interaction pattern ends with interaction pattern. 
    70      * </p> 
    71      */ 
    72     protected InteractionPattern endsWithPattern; 
    73  
    74     /** 
    75      * <p> 
    76      * Interaction pattern contains certain event. 
    77      * </p> 
    78      */ 
    79     protected EventTypeFilter containsEvent; 
    80  
    81     /** 
    82      * <p> 
    83      * Interaction pattern contains certain interaction pattern. 
    84      * </p> 
    85      */ 
    86     protected InteractionPattern containsPattern; 
    8739 
    8840    /** 
     
    10759 
    10860        public StartsWithStep startsWithEvent(EventTypeFilter startsWithEventType); 
     61         
     62        public StartsWithStep startsWithEvent(EventTypeFilter startsWithEventType, EventTargetFilter eventTarget); 
    10963 
    11064        public StartsWithStep startsWithPattern(InteractionPattern endsWithPattern); 
    11165 
    11266        public ContainsStep containsEvent(EventTypeFilter containsEventType); 
     67         
     68        public ContainsStep containsEvent(EventTypeFilter containsEventType, EventTargetFilter eventTarget); 
    11369 
    11470        public ContainsStep containsPattern(InteractionPattern containsPattern); 
    11571 
    11672        public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType); 
     73         
     74        public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType, EventTargetFilter eventTarget); 
    11775 
    11876        public EndsWithStep endsWithPattern(InteractionPattern endsPattern); 
     
    12583 
    12684        public ContainsStep containsEvent(EventTypeFilter containsEventType); 
     85         
     86        public ContainsStep containsEvent(EventTypeFilter containsEventType, EventTargetFilter eventTarget); 
    12787 
    12888        public ContainsStep containsPattern(InteractionPattern containsPattern); 
    12989 
    13090        public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType); 
     91         
     92        public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType, EventTargetFilter eventTarget); 
    13193 
    13294        public EndsWithStep endsWithPattern(InteractionPattern endsPattern); 
     
    138100    public static interface ContainsStep { 
    139101 
    140         public ContainsStep containsEvent(EventTypeFilter containsEventType); 
    141  
    142         public ContainsStep containsPattern(InteractionPattern containsPattern); 
    143  
    144102        public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType); 
     103         
     104        public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType, EventTargetFilter eventTarget); 
    145105 
    146106        public EndsWithStep endsWithPattern(InteractionPattern endsPattern); 
     
    180140            return this; 
    181141        } 
     142         
     143                @Override 
     144                public StartsWithStep startsWithEvent( 
     145                                EventTypeFilter startsWithEventType, 
     146                                EventTargetFilter startsWithEventTarget) { 
     147            this.visitors.add(new StartsWithEventVisitor(startsWithEventType, startsWithEventTarget, concernedNode)); 
     148            return this; 
     149                } 
    182150 
    183151        @Override 
     
    194162        } 
    195163 
     164                @Override 
     165                public ContainsStep containsEvent(EventTypeFilter containsEventType, 
     166                                EventTargetFilter containsEventTarget) { 
     167            this.visitors.add(new ContainsEventVisitor(containsEventType, containsEventTarget ,concernedNode)); 
     168            return this; 
     169                } 
     170         
    196171        @Override 
    197172        public ContainsStep containsPattern(InteractionPattern containsPattern) { 
     
    206181            return this; 
    207182        } 
     183         
     184                @Override 
     185                public EndsWithStep endsWithEvent(EventTypeFilter endsWithEventType, 
     186                                EventTargetFilter endsWithEventTarget) { 
     187            this.visitors.add(new EndsWithEventVisitor(endsWithEventType, endsWithEventTarget ,concernedNode)); 
     188            return this; 
     189                } 
    208190 
    209191        @Override 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPatternVisitor.java

    r1217 r1293  
    2222import com.google.common.collect.Lists; 
    2323 
     24import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    2425import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2526import de.ugoe.cs.autoquest.eventcore.StringEventType; 
     
    3132import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3233import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
     34import de.ugoe.cs.autoquest.test.DummyGUIElement; 
     35import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
    3336import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
    3437import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
     
    4649 
    4750    protected EventTypeFilter eventType; 
     51     
     52    protected EventTargetFilter eventTarget; 
    4853 
    4954    protected InteractionPattern containedPattern; 
     
    6267    public void visit(IEventTask event) { 
    6368        if (!this.present && isEventVisitor()) { 
    64             IEventType eventType = event.getEventType(); 
    65             if (eventType instanceof StringEventType) { 
    66                 this.present = eventType.toString().equals(nameOfEventType()); 
    67             } 
    68             else { 
    69                 this.present = eventType.getClass().equals(this.eventType.clazz()); 
    70             } 
    71         } 
    72     } 
    73  
    74     public boolean isEventVisitor() { 
     69                boolean matchesEventType = matchesEventType(event.getEventType()); 
     70                boolean matchesEventTarget = matchesEventTarget(event.getEventTarget()); 
     71                this.present = eventTarget != null ? matchesEventType && matchesEventTarget : matchesEventType; 
     72        } 
     73    } 
     74 
     75    private boolean matchesEventType(IEventType eventType) { 
     76        if (eventType instanceof StringEventType) { 
     77            return eventType.toString().equals(nameOfEventType()); 
     78        } 
     79        else { 
     80            return eventType.getClass().equals(this.eventType.clazz()); 
     81        } 
     82        } 
     83 
     84        private boolean matchesEventTarget(IEventTarget eventTarget) { 
     85                if(this.eventTarget != null) { 
     86                        if(eventTarget instanceof DummyGUIElement) { 
     87                                return false; 
     88                        } else { 
     89                        return eventTarget.getClass().equals(this.eventTarget.clazz()); 
     90                } 
     91                } 
     92                return false; 
     93        } 
     94 
     95        public boolean isEventVisitor() { 
    7596        return this.eventType != null && this.containedPattern == null; 
    7697    } 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/LongFormUsageProblem.java

    r1217 r1293  
    2525import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2626import de.ugoe.cs.autoquest.usability.EvaluationMethodCaller; 
     27import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2728import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescriptionResolver; 
    28 import de.ugoe.cs.autoquest.usability.result.UsabilityProblemDescription; 
    2929import de.ugoe.cs.autoquest.usability.rules.UsabilityRule; 
    3030import de.ugoe.cs.autoquest.usability.rules.UsabilityUsageProblem; 
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/ContainsEventVisitor.java

    r1217 r1293  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2323import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
     24import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
    2425import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
    2526import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
     
    4647    } 
    4748 
    48     /* 
     49        public ContainsEventVisitor(EventTypeFilter eventType, 
     50                        EventTargetFilter eventTarget, TaskTypeFilter taskType) { 
     51                this.eventType = eventType; 
     52                this.eventTarget = eventTarget; 
     53                this.taskType = taskType; 
     54        } 
     55 
     56        /* 
    4957     * (non-Javadoc) 
    5058     *  
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/EndsWithEventVisitor.java

    r1217 r1293  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2020import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
     21import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
    2122import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
    2223import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
     
    4445    } 
    4546 
    46     /* 
     47        public EndsWithEventVisitor(EventTypeFilter eventType, 
     48                        EventTargetFilter eventTarget, TaskTypeFilter taskType) { 
     49                this.eventType = eventType; 
     50                this.eventTarget = eventTarget; 
     51                this.taskType = taskType; 
     52        } 
     53 
     54        /* 
    4755     * (non-Javadoc) 
    4856     *  
  • trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/StartsWithEventVisitor.java

    r1217 r1293  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2020import de.ugoe.cs.autoquest.usability.rules.patterns.InteractionPatternVisitor; 
     21import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTargetFilter; 
    2122import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.EventTypeFilter; 
    2223import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter; 
     
    4445    } 
    4546 
    46     /* 
     47    public StartsWithEventVisitor(EventTypeFilter eventType, 
     48                        EventTargetFilter eventTarget, 
     49                        TaskTypeFilter taskType) { 
     50        this.eventType = eventType; 
     51        this.eventTarget = eventTarget; 
     52        this.taskType = taskType; 
     53        } 
     54 
     55        /* 
    4756     * (non-Javadoc) 
    4857     *  
Note: See TracChangeset for help on using the changeset viewer.