Changeset 1294


Ignore:
Timestamp:
08/14/13 17:04:42 (11 years ago)
Author:
pharms
Message:
  • rework of task model to move event instance stuff to task instances
  • introduction of sequence, selection, iteration and optional instances
Location:
trunk
Files:
11 added
47 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/manager/TaskTreeManagerTest.java

    r1285 r1294  
    6868    public void testOneEventOnOneElement() { 
    6969        simulateEvent(new DummyInteraction("bla", 1), new DummyGUIElement("elem1")); 
    70         new TaskTreeChecker().assertTaskInstanceList 
     70        new TaskTreeChecker().assertUserSession 
    7171            ("UserSession session {" + 
    7272             "  Event bla {}" + 
     
    8686        simulateEvent(new DummyInteraction("ble", 1), eventTarget); 
    8787 
    88         new TaskTreeChecker().assertTaskInstanceList 
     88        new TaskTreeChecker().assertUserSession 
    8989            ("UserSession session {" + 
    9090             "  Event bla {}" + 
     
    114114        simulateEvent(new DummyInteraction("blum", 1), eventTarget6); 
    115115 
    116         new TaskTreeChecker(true).assertTaskInstanceList 
     116        new TaskTreeChecker(true).assertUserSession 
    117117            ("UserSession session {" + 
    118118             "  Event bla {}" + 
     
    152152        simulateEvent(new DummyInteraction("blop", 1), eventTarget6); 
    153153 
    154         new TaskTreeChecker().assertTaskInstanceList 
     154        new TaskTreeChecker().assertUserSession 
    155155            ("UserSession session {" + 
    156156             "  Event bla {}" + 
     
    181181        simulateEvent(event1, eventTarget1); 
    182182        simulateEvent(event1, eventTarget1); 
    183         new TaskTreeChecker().assertTaskInstanceList 
     183        new TaskTreeChecker().assertUserSession 
    184184            ("UserSession session {" + 
    185185             "  Iteration iteration1 {" + 
     
    201201        } 
    202202 
    203         new TaskTreeChecker().assertTaskInstanceList 
     203        new TaskTreeChecker().assertUserSession 
    204204            ("UserSession session {" + 
    205205             "  Iteration iteration1 {" + 
     
    240240        simulateEvent(event5, eventTarget1); 
    241241 
    242         new TaskTreeChecker().assertTaskInstanceList 
     242        new TaskTreeChecker().assertUserSession 
    243243            ("UserSession session {" + 
    244244             "  Event bli {}" + 
     
    285285        } 
    286286 
    287         new TaskTreeChecker(true).assertTaskInstanceList 
     287        new TaskTreeChecker(true).assertUserSession 
    288288            ("UserSession session {" + 
    289289             "  Iteration iteration2 {" + 
     
    426426        simulateEvent(event3, eventTarget1); 
    427427         
    428         new TaskTreeChecker().assertTaskInstanceList 
     428        new TaskTreeChecker().assertUserSession 
    429429            ("UserSession session {" + 
    430430             "  Iteration iteration1 {" + 
     
    459459        } 
    460460 
    461         new TaskTreeChecker().assertTaskInstanceList 
     461        new TaskTreeChecker().assertUserSession 
    462462            ("UserSession session {" + 
    463463             "  Iteration iteration1 {" + 
     
    540540        simulateEvent(event6, eventTarget1); 
    541541 
    542         new TaskTreeChecker().assertTaskInstanceList 
     542        new TaskTreeChecker().assertUserSession 
    543543            ("UserSession session {" + 
    544544             "  Event ble {}" + 
     
    610610        } 
    611611 
    612         new TaskTreeChecker().assertTaskInstanceList 
     612        new TaskTreeChecker().assertUserSession 
    613613            ("UserSession session {" + 
    614614             "  Iteration iteration3 {" + 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRuleTest.java

    r1146 r1294  
    2525import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2626import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    2927import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3028 
     
    3230 * @author Patrick Harms 
    3331 */ 
    34 public class EventTaskComparisonRuleTest { 
     32public class EventTaskComparisonRuleTest extends AbstractComparisonRuleTest { 
    3533 
    3634    /** 
     
    3937    @Test 
    4038    public void test_isApplicable_01() { 
    41         ITaskFactory taskFactory = new TaskFactory(); 
    42  
    43         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    44  
    45         IEventType eventType1 = new StringEventType("eventType1"); 
    46         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    47         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     39        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     40 
     41        IEventType eventType1 = new StringEventType("eventType1"); 
     42        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     43        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    4844 
    4945        assertTrue(rule.isApplicable(task1, task1)); 
     
    5551    @Test 
    5652    public void test_isApplicable_02() { 
    57         ITaskFactory taskFactory = new TaskFactory(); 
    58  
    59         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    60  
    61         IEventType eventType1 = new StringEventType("eventType1"); 
    62         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    63         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     53        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     54 
     55        IEventType eventType1 = new StringEventType("eventType1"); 
     56        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     57        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    6458 
    6559        IEventType eventType2 = new StringEventType("eventType2"); 
    6660        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    67         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     61        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    6862 
    6963        assertTrue(rule.isApplicable(task1, task2)); 
     
    7670    @Test 
    7771    public void test_isApplicable_03() { 
    78         ITaskFactory taskFactory = new TaskFactory(); 
    79  
    80         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    81  
    82         IEventType eventType1 = new StringEventType("eventType1"); 
    83         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    84         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     72        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     73 
     74        IEventType eventType1 = new StringEventType("eventType1"); 
     75        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     76        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8577        
    86         ITask selection = taskFactory.createNewSelection(); 
     78        ITask selection = createNewSelection(); 
    8779 
    8880        assertFalse(rule.isApplicable(task1, selection)); 
     
    9587    @Test 
    9688    public void test_isApplicable_04() { 
    97         ITaskFactory taskFactory = new TaskFactory(); 
    98  
    99         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    100  
    101         IEventType eventType1 = new StringEventType("eventType1"); 
    102         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    103         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    104  
    105         ITask sequence = taskFactory.createNewSequence(); 
     89        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     90 
     91        IEventType eventType1 = new StringEventType("eventType1"); 
     92        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     93        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     94 
     95        ITask sequence = createNewSequence(); 
    10696 
    10797        assertFalse(rule.isApplicable(task1, sequence)); 
     
    114104    @Test 
    115105    public void test_isApplicable_05() { 
    116         ITaskFactory taskFactory = new TaskFactory(); 
    117  
    118         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    119  
    120         IEventType eventType1 = new StringEventType("eventType1"); 
    121         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    122         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    123  
    124         ITask iteration = taskFactory.createNewIteration(); 
     106        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     107 
     108        IEventType eventType1 = new StringEventType("eventType1"); 
     109        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     110        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     111 
     112        ITask iteration = createNewIteration(); 
    125113 
    126114        assertFalse(rule.isApplicable(task1, iteration)); 
     
    133121    @Test 
    134122    public void test_isApplicable_06() { 
    135         ITaskFactory taskFactory = new TaskFactory(); 
    136  
    137         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    138  
    139         IEventType eventType1 = new StringEventType("eventType1"); 
    140         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    141         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    142  
    143         ITask optional = taskFactory.createNewOptional(); 
     123        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     124 
     125        IEventType eventType1 = new StringEventType("eventType1"); 
     126        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     127        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     128 
     129        ITask optional = createNewOptional(); 
    144130 
    145131        assertFalse(rule.isApplicable(task1, optional)); 
     
    151137     */ 
    152138    @Test 
     139    public void test_isApplicable_07() { 
     140        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     141 
     142        IEventType eventType1 = new StringEventType("eventType1"); 
     143        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     144        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     145 
     146        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     147                                     task1.getInstances().iterator().next())); 
     148    } 
     149    
     150    /** 
     151     * 
     152     */ 
     153    @Test 
     154    public void test_isApplicable_08() { 
     155        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     156 
     157        IEventType eventType1 = new StringEventType("eventType1"); 
     158        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     159        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     160 
     161        IEventType eventType2 = new StringEventType("eventType2"); 
     162        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     163        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     164 
     165        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     166                                     task2.getInstances().iterator().next())); 
     167        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     168                                     task1.getInstances().iterator().next())); 
     169    } 
     170 
     171    /** 
     172     * 
     173     */ 
     174    @Test 
     175    public void test_isApplicable_09() { 
     176        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     177 
     178        IEventType eventType1 = new StringEventType("eventType1"); 
     179        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     180        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     181 
     182        ITask selection = createNewSelection(); 
     183 
     184        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     185                                      selection.getInstances().iterator().next())); 
     186        assertFalse(rule.isApplicable(selection.getInstances().iterator().next(), 
     187                                      task1.getInstances().iterator().next())); 
     188    } 
     189 
     190    /** 
     191     * 
     192     */ 
     193    @Test 
     194    public void test_isApplicable_10() { 
     195        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     196 
     197        IEventType eventType1 = new StringEventType("eventType1"); 
     198        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     199        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     200 
     201        ITask sequence = createNewSequence(); 
     202 
     203        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     204                                      sequence.getInstances().iterator().next())); 
     205        assertFalse(rule.isApplicable(sequence.getInstances().iterator().next(), 
     206                                      task1.getInstances().iterator().next())); 
     207    } 
     208 
     209    /** 
     210     * 
     211     */ 
     212    @Test 
     213    public void test_isApplicable_11() { 
     214        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     215 
     216        IEventType eventType1 = new StringEventType("eventType1"); 
     217        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     218        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     219 
     220        ITask iteration = createNewIteration(); 
     221 
     222        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     223                                      iteration.getInstances().iterator().next())); 
     224        assertFalse(rule.isApplicable(iteration.getInstances().iterator().next(), 
     225                                      task1.getInstances().iterator().next())); 
     226    } 
     227 
     228    /** 
     229     * 
     230     */ 
     231    @Test 
     232    public void test_isApplicable_12() { 
     233        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     234 
     235        IEventType eventType1 = new StringEventType("eventType1"); 
     236        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     237        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     238 
     239        ITask optional = createNewOptional(); 
     240 
     241        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     242                                      optional.getInstances().iterator().next())); 
     243        assertFalse(rule.isApplicable(optional.getInstances().iterator().next(), 
     244                                      task1.getInstances().iterator().next())); 
     245    } 
     246 
     247    /** 
     248     * 
     249     */ 
     250    @Test 
    153251    public void test_compare_01() { 
    154         ITaskFactory taskFactory = new TaskFactory(); 
    155          
    156         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    157          
    158         IEventType eventType1 = new StringEventType("eventType1"); 
    159         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    160         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     252        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     253         
     254        IEventType eventType1 = new StringEventType("eventType1"); 
     255        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     256        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    161257         
    162258        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task1)); 
     
    171267    @Test 
    172268    public void test_compare_02() { 
    173         ITaskFactory taskFactory = new TaskFactory(); 
    174          
    175         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    176          
    177         IEventType eventType1 = new StringEventType("eventType1"); 
    178         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    179         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    180          
    181         ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     269        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     270         
     271        IEventType eventType1 = new StringEventType("eventType1"); 
     272        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     273        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     274         
     275        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
    182276         
    183277        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 
     
    197291    @Test 
    198292    public void test_compare_03() { 
    199         ITaskFactory taskFactory = new TaskFactory(); 
    200          
    201         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    202          
    203         IEventType eventType1 = new StringEventType("eventType1"); 
    204         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    205         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     293        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     294         
     295        IEventType eventType1 = new StringEventType("eventType1"); 
     296        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     297        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    206298         
    207299        IEventType eventType2 = new StringEventType("eventType2"); 
    208         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
     300        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
    209301 
    210302        assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 
     
    224316    @Test 
    225317    public void test_compare_04() { 
    226         ITaskFactory taskFactory = new TaskFactory(); 
    227          
    228         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    229          
    230         IEventType eventType1 = new StringEventType("eventType1"); 
    231         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    232         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     318        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     319         
     320        IEventType eventType1 = new StringEventType("eventType1"); 
     321        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     322        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    233323         
    234324        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    235         ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget2); 
     325        ITask task2 = createNewEventTask(eventType1, eventTarget2); 
    236326         
    237327        assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 
     
    252342    @Test 
    253343    public void test_compare_05() { 
    254         ITaskFactory taskFactory = new TaskFactory(); 
    255          
    256         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    257          
    258         IEventType eventType1 = new StringEventType("eventType1"); 
    259         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    260         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     344        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     345         
     346        IEventType eventType1 = new StringEventType("eventType1"); 
     347        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     348        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    261349         
    262350        IEventType eventType2 = new StringEventType("eventType2"); 
    263351        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    264         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     352        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    265353         
    266354        assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 
     
    275363    } 
    276364 
     365 
     366    /** 
     367     * 
     368     */ 
     369    @Test 
     370    public void test_compare_06() { 
     371        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     372         
     373        IEventType eventType1 = new StringEventType("eventType1"); 
     374        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     375        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     376         
     377        assertEquals(TaskEquality.LEXICALLY_EQUAL, 
     378                     rule.compare(task1.getInstances().iterator().next(), 
     379                                  task1.getInstances().iterator().next())); 
     380        assertTrue(rule.areLexicallyEqual(task1.getInstances().iterator().next(), 
     381                                          task1.getInstances().iterator().next())); 
     382        assertTrue(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(), 
     383                                              task1.getInstances().iterator().next())); 
     384        assertTrue(rule.areSemanticallyEqual(task1.getInstances().iterator().next(), 
     385                                             task1.getInstances().iterator().next())); 
     386    } 
     387     
     388    /** 
     389     * 
     390     */ 
     391    @Test 
     392    public void test_compare_07() { 
     393        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     394         
     395        IEventType eventType1 = new StringEventType("eventType1"); 
     396        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     397        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     398         
     399        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     400         
     401        assertEquals(TaskEquality.LEXICALLY_EQUAL, 
     402                     rule.compare(task1.getInstances().iterator().next(), 
     403                                  task2.getInstances().iterator().next())); 
     404        assertTrue(rule.areLexicallyEqual(task1.getInstances().iterator().next(), 
     405                                          task2.getInstances().iterator().next())); 
     406        assertTrue(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(), 
     407                                              task2.getInstances().iterator().next())); 
     408        assertTrue(rule.areSemanticallyEqual(task1.getInstances().iterator().next(), 
     409                                             task2.getInstances().iterator().next())); 
     410 
     411        assertEquals(TaskEquality.LEXICALLY_EQUAL, 
     412                     rule.compare(task2.getInstances().iterator().next(), 
     413                                  task1.getInstances().iterator().next())); 
     414        assertTrue(rule.areLexicallyEqual(task2.getInstances().iterator().next(), 
     415                                          task1.getInstances().iterator().next())); 
     416        assertTrue(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(), 
     417                                              task1.getInstances().iterator().next())); 
     418        assertTrue(rule.areSemanticallyEqual(task2.getInstances().iterator().next(), 
     419                                             task1.getInstances().iterator().next())); 
     420    } 
     421 
     422    /** 
     423     * 
     424     */ 
     425    @Test 
     426    public void test_compare_08() { 
     427        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     428         
     429        IEventType eventType1 = new StringEventType("eventType1"); 
     430        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     431        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     432         
     433        IEventType eventType2 = new StringEventType("eventType2"); 
     434        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     435         
     436        assertEquals(TaskEquality.UNEQUAL, 
     437                     rule.compare(task1.getInstances().iterator().next(), 
     438                                  task2.getInstances().iterator().next())); 
     439        assertFalse(rule.areLexicallyEqual(task1.getInstances().iterator().next(), 
     440                                           task2.getInstances().iterator().next())); 
     441        assertFalse(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(), 
     442                                               task2.getInstances().iterator().next())); 
     443        assertFalse(rule.areSemanticallyEqual(task1.getInstances().iterator().next(), 
     444                                              task2.getInstances().iterator().next())); 
     445 
     446        assertEquals(TaskEquality.UNEQUAL, 
     447                     rule.compare(task2.getInstances().iterator().next(), 
     448                                  task1.getInstances().iterator().next())); 
     449        assertFalse(rule.areLexicallyEqual(task2.getInstances().iterator().next(), 
     450                                           task1.getInstances().iterator().next())); 
     451        assertFalse(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(), 
     452                                               task1.getInstances().iterator().next())); 
     453        assertFalse(rule.areSemanticallyEqual(task2.getInstances().iterator().next(), 
     454                                              task1.getInstances().iterator().next())); 
     455    } 
     456 
     457    /** 
     458     * 
     459     */ 
     460    @Test 
     461    public void test_compare_09() { 
     462        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     463         
     464        IEventType eventType1 = new StringEventType("eventType1"); 
     465        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     466        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     467         
     468        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     469        ITask task2 = createNewEventTask(eventType1, eventTarget2); 
     470         
     471        assertEquals(TaskEquality.UNEQUAL, 
     472                     rule.compare(task1.getInstances().iterator().next(), 
     473                                  task2.getInstances().iterator().next())); 
     474        assertFalse(rule.areLexicallyEqual(task1.getInstances().iterator().next(), 
     475                                           task2.getInstances().iterator().next())); 
     476        assertFalse(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(), 
     477                                               task2.getInstances().iterator().next())); 
     478        assertFalse(rule.areSemanticallyEqual(task1.getInstances().iterator().next(), 
     479                                              task2.getInstances().iterator().next())); 
     480 
     481        assertEquals(TaskEquality.UNEQUAL, 
     482                     rule.compare(task2.getInstances().iterator().next(), 
     483                                  task1.getInstances().iterator().next())); 
     484        assertFalse(rule.areLexicallyEqual(task2.getInstances().iterator().next(), 
     485                                           task1.getInstances().iterator().next())); 
     486        assertFalse(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(), 
     487                                               task1.getInstances().iterator().next())); 
     488        assertFalse(rule.areSemanticallyEqual(task2.getInstances().iterator().next(), 
     489                                              task1.getInstances().iterator().next())); 
     490    } 
     491 
     492 
     493    /** 
     494     * 
     495     */ 
     496    @Test 
     497    public void test_compare_10() { 
     498        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     499         
     500        IEventType eventType1 = new StringEventType("eventType1"); 
     501        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     502        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     503         
     504        IEventType eventType2 = new StringEventType("eventType2"); 
     505        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     506        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     507         
     508        assertEquals(TaskEquality.UNEQUAL, 
     509                     rule.compare(task1.getInstances().iterator().next(), 
     510                                  task2.getInstances().iterator().next())); 
     511        assertFalse(rule.areLexicallyEqual(task1.getInstances().iterator().next(), 
     512                                           task2.getInstances().iterator().next())); 
     513        assertFalse(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(), 
     514                                               task2.getInstances().iterator().next())); 
     515        assertFalse(rule.areSemanticallyEqual(task1.getInstances().iterator().next(), 
     516                                              task2.getInstances().iterator().next())); 
     517 
     518        assertEquals(TaskEquality.UNEQUAL, 
     519                     rule.compare(task2.getInstances().iterator().next(), 
     520                                  task1.getInstances().iterator().next())); 
     521        assertFalse(rule.areLexicallyEqual(task2.getInstances().iterator().next(), 
     522                                           task1.getInstances().iterator().next())); 
     523        assertFalse(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(), 
     524                                               task1.getInstances().iterator().next())); 
     525        assertFalse(rule.areSemanticallyEqual(task2.getInstances().iterator().next(), 
     526                                              task1.getInstances().iterator().next())); 
     527    } 
     528 
    277529} 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRuleTest.java

    r1146 r1294  
    4242import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; 
    4343import de.ugoe.cs.autoquest.tasktrees.taskequality.EventTaskComparisonRule; 
    44 import de.ugoe.cs.autoquest.tasktrees.taskequality.GUIEventTaskComparisonRule; 
    45 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    4644import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    47 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    48 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    4945import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    5046 
     
    5248 * @author Patrick Harms 
    5349 */ 
    54 public class GUIEventTaskComparisonRuleTest { 
     50public class GUIEventTaskComparisonRuleTest extends AbstractComparisonRuleTest { 
    5551 
    5652    /** 
     
    5955    @Test 
    6056    public void test_isApplicable_01() { 
    61         ITaskFactory taskFactory = new TaskFactory(); 
    62  
    63         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    64  
    65         IEventType eventType1 = new StringEventType("eventType1"); 
    66         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    67         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     57        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     58 
     59        IEventType eventType1 = new StringEventType("eventType1"); 
     60        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     61        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    6862 
    6963        assertTrue(rule.isApplicable(task1, task1)); 
     
    7569    @Test 
    7670    public void test_isApplicable_02() { 
    77         ITaskFactory taskFactory = new TaskFactory(); 
    78  
    79         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    80  
    81         IEventType eventType1 = new StringEventType("eventType1"); 
    82         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    83         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     71        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     72 
     73        IEventType eventType1 = new StringEventType("eventType1"); 
     74        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     75        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8476 
    8577        IEventType eventType2 = new StringEventType("eventType2"); 
    8678        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    87         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     79        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    8880 
    8981        assertTrue(rule.isApplicable(task1, task2)); 
     
    9688    @Test 
    9789    public void test_isApplicable_03() { 
    98         ITaskFactory taskFactory = new TaskFactory(); 
    99  
    10090        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    10191 
    10292        IEventType eventType1 = new KeyboardFocusChange(); 
    10393        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    104         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     94        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    10595 
    10696        IEventType eventType2 = new KeyboardFocusChange(); 
    10797        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    108         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     98        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    10999 
    110100        assertTrue(rule.isApplicable(task1, task2)); 
     
    117107    @Test 
    118108    public void test_isApplicable_04() { 
    119         ITaskFactory taskFactory = new TaskFactory(); 
    120  
    121109        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    122110 
    123111        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    124112        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    125         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     113        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    126114 
    127115        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 
    128116        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    129         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     117        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    130118 
    131119        assertTrue(rule.isApplicable(task1, task2)); 
     
    138126    @Test 
    139127    public void test_isApplicable_05() { 
    140         ITaskFactory taskFactory = new TaskFactory(); 
    141  
    142128        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    143129 
    144130        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_C); 
    145131        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    146         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     132        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    147133 
    148134        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_D); 
    149135        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    150         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     136        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    151137 
    152138        assertTrue(rule.isApplicable(task1, task2)); 
     
    159145    @Test 
    160146    public void test_isApplicable_06() { 
    161         ITaskFactory taskFactory = new TaskFactory(); 
    162  
    163147        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    164148 
    165149        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 5, 6); 
    166150        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    167         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     151        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    168152 
    169153        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.MIDDLE, 3, 1); 
    170154        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    171         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     155        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    172156 
    173157        assertTrue(rule.isApplicable(task1, task2)); 
     
    180164    @Test 
    181165    public void test_isApplicable_07() { 
    182         ITaskFactory taskFactory = new TaskFactory(); 
    183  
    184166        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    185167 
    186168        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 4, 7); 
    187169        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    188         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     170        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    189171 
    190172        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.X, 9, 12); 
    191173        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    192         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     174        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    193175 
    194176        assertTrue(rule.isApplicable(task1, task2)); 
     
    201183    @Test 
    202184    public void test_isApplicable_08() { 
    203         ITaskFactory taskFactory = new TaskFactory(); 
    204  
    205185        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    206186 
    207187        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    208188        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    209         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     189        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    210190 
    211191        IEventType eventType2 = new MouseDragAndDrop(5, 6, 7, 8); 
    212192        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    213         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     193        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    214194 
    215195        assertTrue(rule.isApplicable(task1, task2)); 
     
    222202    @Test 
    223203    public void test_isApplicable_09() { 
    224         ITaskFactory taskFactory = new TaskFactory(); 
    225  
    226204        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    227205 
    228206        IEventType eventType1 = new Scroll(1, 2); 
    229207        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    230         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     208        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    231209 
    232210        IEventType eventType2 = new Scroll(3, 4); 
    233211        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    234         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     212        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    235213 
    236214        assertTrue(rule.isApplicable(task1, task2)); 
     
    243221    @Test 
    244222    public void test_isApplicable_10() { 
    245         ITaskFactory taskFactory = new TaskFactory(); 
    246  
    247223        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    248224 
     
    250226        IEventType eventType1 = new TextInput("text1", inputEvents); 
    251227        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    252         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     228        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    253229 
    254230        IEventType eventType2 = new TextInput("text2", inputEvents); 
    255231        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    256         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     232        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    257233 
    258234        assertTrue(rule.isApplicable(task1, task2)); 
     
    265241    @Test 
    266242    public void test_isApplicable_11() { 
    267         ITaskFactory taskFactory = new TaskFactory(); 
    268  
    269243        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    270244 
    271245        IEventType eventType1 = new TextSelection(); 
    272246        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    273         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     247        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    274248 
    275249        IEventType eventType2 = new ValueSelection<String>("value"); 
    276250        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    277         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
     251        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
    278252 
    279253        assertTrue(rule.isApplicable(task1, task2)); 
     
    286260    @Test 
    287261    public void test_isApplicable_12() { 
    288         ITaskFactory taskFactory = new TaskFactory(); 
    289  
    290         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    291  
    292         IEventType eventType1 = new StringEventType("eventType1"); 
    293         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    294         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    295  
    296         ITask selection = taskFactory.createNewSelection(); 
     262        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     263 
     264        IEventType eventType1 = new StringEventType("eventType1"); 
     265        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     266        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     267 
     268        ITask selection = createNewSelection(); 
    297269 
    298270        assertFalse(rule.isApplicable(task1, selection)); 
     
    305277    @Test 
    306278    public void test_isApplicable_13() { 
    307         ITaskFactory taskFactory = new TaskFactory(); 
    308  
    309         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    310  
    311         IEventType eventType1 = new StringEventType("eventType1"); 
    312         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    313         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    314  
    315         ITask sequence = taskFactory.createNewSequence(); 
     279        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     280 
     281        IEventType eventType1 = new StringEventType("eventType1"); 
     282        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     283        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     284 
     285        ITask sequence = createNewSequence(); 
    316286 
    317287        assertFalse(rule.isApplicable(task1, sequence)); 
     
    324294    @Test 
    325295    public void test_isApplicable_14() { 
    326         ITaskFactory taskFactory = new TaskFactory(); 
    327  
    328         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    329  
    330         IEventType eventType1 = new StringEventType("eventType1"); 
    331         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    332         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    333  
    334         ITask iteration = taskFactory.createNewIteration(); 
     296        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     297 
     298        IEventType eventType1 = new StringEventType("eventType1"); 
     299        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     300        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     301 
     302        ITask iteration = createNewIteration(); 
    335303 
    336304        assertFalse(rule.isApplicable(task1, iteration)); 
     
    343311    @Test 
    344312    public void test_isApplicable_15() { 
    345         ITaskFactory taskFactory = new TaskFactory(); 
    346  
    347         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    348  
    349         IEventType eventType1 = new StringEventType("eventType1"); 
    350         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    351         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    352  
    353         ITask optional = taskFactory.createNewOptional(); 
     313        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     314 
     315        IEventType eventType1 = new StringEventType("eventType1"); 
     316        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     317        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     318 
     319        ITask optional = createNewOptional(); 
    354320 
    355321        assertFalse(rule.isApplicable(task1, optional)); 
     
    357323    } 
    358324 
     325 
     326    /** 
     327     * 
     328     */ 
     329    @Test 
     330    public void test_isApplicable_16() { 
     331        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     332 
     333        IEventType eventType1 = new StringEventType("eventType1"); 
     334        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     335        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     336 
     337        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     338                                     task1.getInstances().iterator().next())); 
     339    } 
     340 
     341    /** 
     342     * 
     343     */ 
     344    @Test 
     345    public void test_isApplicable_17() { 
     346        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     347 
     348        IEventType eventType1 = new StringEventType("eventType1"); 
     349        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     350        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     351 
     352        IEventType eventType2 = new StringEventType("eventType2"); 
     353        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     354        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     355 
     356        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     357                                     task2.getInstances().iterator().next())); 
     358        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     359                                     task1.getInstances().iterator().next())); 
     360    } 
     361 
     362    /** 
     363     * 
     364     */ 
     365    @Test 
     366    public void test_isApplicable_18() { 
     367        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     368 
     369        IEventType eventType1 = new KeyboardFocusChange(); 
     370        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     371        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     372 
     373        IEventType eventType2 = new KeyboardFocusChange(); 
     374        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     375        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     376 
     377        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     378                                     task2.getInstances().iterator().next())); 
     379        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     380                                     task1.getInstances().iterator().next())); 
     381    } 
     382 
     383    /** 
     384     * 
     385     */ 
     386    @Test 
     387    public void test_isApplicable_19() { 
     388        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     389 
     390        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
     391        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     392        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     393 
     394        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 
     395        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     396        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     397 
     398        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     399                                     task2.getInstances().iterator().next())); 
     400        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     401                                     task1.getInstances().iterator().next())); 
     402    } 
     403 
     404    /** 
     405     * 
     406     */ 
     407    @Test 
     408    public void test_isApplicable_20() { 
     409        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     410 
     411        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_C); 
     412        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     413        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     414 
     415        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_D); 
     416        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     417        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     418 
     419        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     420                                     task2.getInstances().iterator().next())); 
     421        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     422                                     task1.getInstances().iterator().next())); 
     423    } 
     424 
     425    /** 
     426     * 
     427     */ 
     428    @Test 
     429    public void test_isApplicable_21() { 
     430        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     431 
     432        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 5, 6); 
     433        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     434        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     435 
     436        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.MIDDLE, 3, 1); 
     437        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     438        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     439 
     440        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     441                                     task2.getInstances().iterator().next())); 
     442        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     443                                     task1.getInstances().iterator().next())); 
     444    } 
     445 
     446    /** 
     447     * 
     448     */ 
     449    @Test 
     450    public void test_isApplicable_22() { 
     451        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     452 
     453        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 4, 7); 
     454        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     455        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     456 
     457        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.X, 9, 12); 
     458        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     459        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     460 
     461        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     462                                     task2.getInstances().iterator().next())); 
     463        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     464                                     task1.getInstances().iterator().next())); 
     465    } 
     466 
     467    /** 
     468     * 
     469     */ 
     470    @Test 
     471    public void test_isApplicable_23() { 
     472        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     473 
     474        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
     475        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     476        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     477 
     478        IEventType eventType2 = new MouseDragAndDrop(5, 6, 7, 8); 
     479        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     480        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     481 
     482        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     483                                     task2.getInstances().iterator().next())); 
     484        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     485                                     task1.getInstances().iterator().next())); 
     486    } 
     487 
     488    /** 
     489     * 
     490     */ 
     491    @Test 
     492    public void test_isApplicable_24() { 
     493        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     494 
     495        IEventType eventType1 = new Scroll(1, 2); 
     496        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     497        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     498 
     499        IEventType eventType2 = new Scroll(3, 4); 
     500        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     501        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     502 
     503        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     504                                     task2.getInstances().iterator().next())); 
     505        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     506                                     task1.getInstances().iterator().next())); 
     507    } 
     508 
     509    /** 
     510     * 
     511     */ 
     512    @Test 
     513    public void test_isApplicable_25() { 
     514        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     515 
     516        List<Event> inputEvents = new ArrayList<Event>(); 
     517        IEventType eventType1 = new TextInput("text1", inputEvents); 
     518        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     519        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     520 
     521        IEventType eventType2 = new TextInput("text2", inputEvents); 
     522        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     523        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     524 
     525        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), task2.getInstances().iterator().next())); 
     526        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), task1.getInstances().iterator().next())); 
     527    } 
     528 
     529    /** 
     530     * 
     531     */ 
     532    @Test 
     533    public void test_isApplicable_26() { 
     534        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     535 
     536        IEventType eventType1 = new TextSelection(); 
     537        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     538        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     539 
     540        IEventType eventType2 = new ValueSelection<String>("value"); 
     541        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     542        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     543 
     544        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(), 
     545                                     task2.getInstances().iterator().next())); 
     546        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(), 
     547                                     task1.getInstances().iterator().next())); 
     548    } 
     549 
     550    /** 
     551     * 
     552     */ 
     553    @Test 
     554    public void test_isApplicable_27() { 
     555        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     556 
     557        IEventType eventType1 = new StringEventType("eventType1"); 
     558        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     559        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     560 
     561        ITask selection = createNewSelection(); 
     562 
     563        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     564                                      selection.getInstances().iterator().next())); 
     565        assertFalse(rule.isApplicable(selection.getInstances().iterator().next(), 
     566                                      task1.getInstances().iterator().next())); 
     567    } 
     568 
     569    /** 
     570     * 
     571     */ 
     572    @Test 
     573    public void test_isApplicable_28() { 
     574        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     575 
     576        IEventType eventType1 = new StringEventType("eventType1"); 
     577        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     578        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     579 
     580        ITask sequence = createNewSequence(); 
     581 
     582        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     583                                      sequence.getInstances().iterator().next())); 
     584        assertFalse(rule.isApplicable(sequence.getInstances().iterator().next(), 
     585                                      task1.getInstances().iterator().next())); 
     586    } 
     587 
     588    /** 
     589     * 
     590     */ 
     591    @Test 
     592    public void test_isApplicable_29() { 
     593        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     594 
     595        IEventType eventType1 = new StringEventType("eventType1"); 
     596        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     597        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     598 
     599        ITask iteration = createNewIteration(); 
     600 
     601        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     602                                      iteration.getInstances().iterator().next())); 
     603        assertFalse(rule.isApplicable(iteration.getInstances().iterator().next(), 
     604                                      task1.getInstances().iterator().next())); 
     605    } 
     606 
     607    /** 
     608     * 
     609     */ 
     610    @Test 
     611    public void test_isApplicable_30() { 
     612        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     613 
     614        IEventType eventType1 = new StringEventType("eventType1"); 
     615        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     616        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     617 
     618        ITask optional = createNewOptional(); 
     619 
     620        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(), 
     621                                      optional.getInstances().iterator().next())); 
     622        assertFalse(rule.isApplicable(optional.getInstances().iterator().next(), 
     623                                      task1.getInstances().iterator().next())); 
     624    } 
     625 
    359626    /** 
    360627     * 
     
    362629    @Test 
    363630    public void test_compare_KeyboardFocusChange_01() { 
    364         ITaskFactory taskFactory = new TaskFactory(); 
    365          
    366631        IEventType eventType1 = new KeyboardFocusChange(); 
    367632        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    368         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    369          
    370         assertLexicallyEqual(task1, task1); 
     633        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     634         
     635        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    371636    } 
    372637 
     
    376641    @Test 
    377642    public void test_compare_KeyboardFocusChange_02() { 
    378         ITaskFactory taskFactory = new TaskFactory(); 
    379          
    380643        IEventType eventType1 = new KeyboardFocusChange(); 
    381644        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    382         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     645        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    383646 
    384647        IEventType eventType2 = new KeyboardFocusChange(); 
    385         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    386          
    387         assertLexicallyEqual(task1, task2); 
     648        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     649         
     650        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    388651    } 
    389652 
     
    393656    @Test 
    394657    public void test_compare_KeyboardFocusChange_03() { 
    395         ITaskFactory taskFactory = new TaskFactory(); 
    396          
    397658        IEventType eventType1 = new KeyboardFocusChange(); 
    398659        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    399         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     660        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    400661 
    401662        IEventType eventType2 = new KeyboardFocusChange(); 
    402663        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    403         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    404          
    405         assertUnequal(task1, task2); 
     664        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     665         
     666        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    406667    } 
    407668 
     
    411672    @Test 
    412673    public void test_compare_KeyPressed_01() { 
    413         ITaskFactory taskFactory = new TaskFactory(); 
    414          
    415674        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    416675        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    417         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    418          
    419         assertLexicallyEqual(task1, task1); 
     676        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     677         
     678        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    420679    } 
    421680 
     
    425684    @Test 
    426685    public void test_compare_KeyPressed_02() { 
    427         ITaskFactory taskFactory = new TaskFactory(); 
    428          
    429686        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    430687        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    431         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     688        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    432689         
    433690        IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 
    434         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    435          
    436         assertLexicallyEqual(task1, task2); 
     691        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     692         
     693        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    437694    } 
    438695 
     
    442699    @Test 
    443700    public void test_compare_KeyPressed_03() { 
    444         ITaskFactory taskFactory = new TaskFactory(); 
    445          
    446701        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    447702        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    448         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     703        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    449704         
    450705        IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_B); 
    451         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    452          
    453         assertSemanticallyEqual(task1, task2); 
     706        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     707         
     708        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    454709    } 
    455710 
     
    459714    @Test 
    460715    public void test_compare_KeyPressed_04() { 
    461         ITaskFactory taskFactory = new TaskFactory(); 
    462          
    463716        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    464717        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    465         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     718        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    466719         
    467720        IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 
    468721        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    469         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    470          
    471         assertUnequal(task1, task2); 
     722        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     723         
     724        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    472725    } 
    473726     
     
    477730    @Test 
    478731    public void test_compare_KeyReleased_01() { 
    479         ITaskFactory taskFactory = new TaskFactory(); 
    480          
    481732        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    482733        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    483         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    484          
    485         assertLexicallyEqual(task1, task1); 
     734        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     735         
     736        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    486737    } 
    487738 
     
    491742    @Test 
    492743    public void test_compare_KeyReleased_02() { 
    493         ITaskFactory taskFactory = new TaskFactory(); 
    494          
    495744        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    496745        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    497         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     746        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    498747         
    499748        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 
    500         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    501          
    502         assertLexicallyEqual(task1, task2); 
     749        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     750         
     751        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    503752    } 
    504753 
     
    508757    @Test 
    509758    public void test_compare_KeyReleased_03() { 
    510         ITaskFactory taskFactory = new TaskFactory(); 
    511          
    512759        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    513760        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    514         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     761        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    515762         
    516763        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 
    517         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    518          
    519         assertSemanticallyEqual(task1, task2); 
     764        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     765         
     766        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    520767    } 
    521768 
     
    525772    @Test 
    526773    public void test_compare_KeyReleased_04() { 
    527         ITaskFactory taskFactory = new TaskFactory(); 
    528          
    529774        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    530775        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    531         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     776        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    532777         
    533778        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 
    534779        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    535         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    536          
    537         assertUnequal(task1, task2); 
     780        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     781         
     782        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    538783    } 
    539784     
     
    543788    @Test 
    544789    public void test_compare_KeyTyped_01() { 
    545         ITaskFactory taskFactory = new TaskFactory(); 
    546          
    547790        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    548791        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    549         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    550          
    551         assertLexicallyEqual(task1, task1); 
     792        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     793         
     794        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    552795    } 
    553796 
     
    557800    @Test 
    558801    public void test_compare_KeyTyped_02() { 
    559         ITaskFactory taskFactory = new TaskFactory(); 
    560          
    561802        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    562803        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    563         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     804        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    564805         
    565806        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 
    566         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    567          
    568         assertLexicallyEqual(task1, task2); 
     807        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     808         
     809        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    569810    } 
    570811 
     
    574815    @Test 
    575816    public void test_compare_KeyTyped_03() { 
    576         ITaskFactory taskFactory = new TaskFactory(); 
    577          
    578817        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    579818        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    580         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     819        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    581820         
    582821        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_B); 
    583         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    584          
    585         assertSemanticallyEqual(task1, task2); 
     822        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     823         
     824        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    586825    } 
    587826 
     
    591830    @Test 
    592831    public void test_compare_KeyTyped_04() { 
    593         ITaskFactory taskFactory = new TaskFactory(); 
    594          
    595832        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    596833        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    597         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     834        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    598835         
    599836        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 
    600837        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    601         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    602          
    603         assertUnequal(task1, task2); 
     838        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     839         
     840        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    604841    } 
    605842     
     
    609846    @Test 
    610847    public void test_compare_MouseButtonDown_01() { 
    611         ITaskFactory taskFactory = new TaskFactory(); 
    612          
    613848        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    614849        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    615         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    616          
    617         assertLexicallyEqual(task1, task1); 
     850        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     851         
     852        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    618853    } 
    619854 
     
    623858    @Test 
    624859    public void test_compare_MouseButtonDown_02() { 
    625         ITaskFactory taskFactory = new TaskFactory(); 
    626          
    627860        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    628861        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    629         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     862        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    630863         
    631864        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    632         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    633          
    634         assertLexicallyEqual(task1, task2); 
     865        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     866         
     867        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    635868    } 
    636869 
     
    640873    @Test 
    641874    public void test_compare_MouseButtonDown_03() { 
    642         ITaskFactory taskFactory = new TaskFactory(); 
    643          
    644875        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    645876        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    646         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     877        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    647878         
    648879        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 3); 
    649         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    650          
    651         assertSemanticallyEqual(task1, task2); 
     880        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     881         
     882        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    652883    } 
    653884 
     
    657888    @Test 
    658889    public void test_compare_MouseButtonDown_04() { 
    659         ITaskFactory taskFactory = new TaskFactory(); 
    660          
    661890        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    662891        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    663         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     892        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    664893         
    665894        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 3, 2); 
    666         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    667          
    668         assertSemanticallyEqual(task1, task2); 
     895        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     896         
     897        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    669898    } 
    670899 
     
    674903    @Test 
    675904    public void test_compare_MouseButtonDown_05() { 
    676         ITaskFactory taskFactory = new TaskFactory(); 
    677          
    678905        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    679906        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    680         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     907        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    681908         
    682909        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    683         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    684          
    685         assertUnequal(task1, task2); 
     910        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     911         
     912        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    686913    } 
    687914     
     
    691918    @Test 
    692919    public void test_compare_MouseButtonDown_06() { 
    693         ITaskFactory taskFactory = new TaskFactory(); 
    694          
    695920        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    696921        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    697         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     922        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    698923         
    699924        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    700925        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    701         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    702          
    703         assertUnequal(task1, task2); 
     926        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     927         
     928        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    704929    } 
    705930     
     
    709934    @Test 
    710935    public void test_compare_MouseButtonUp_01() { 
    711         ITaskFactory taskFactory = new TaskFactory(); 
    712          
    713936        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    714937        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    715         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    716          
    717         assertLexicallyEqual(task1, task1); 
     938        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     939         
     940        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    718941    } 
    719942 
     
    723946    @Test 
    724947    public void test_compare_MouseButtonUp_02() { 
    725         ITaskFactory taskFactory = new TaskFactory(); 
    726          
    727948        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    728949        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    729         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     950        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    730951         
    731952        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    732         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    733          
    734         assertLexicallyEqual(task1, task2); 
     953        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     954         
     955        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    735956    } 
    736957 
     
    740961    @Test 
    741962    public void test_compare_MouseButtonUp_03() { 
    742         ITaskFactory taskFactory = new TaskFactory(); 
    743          
    744963        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    745964        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    746         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     965        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    747966         
    748967        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 3); 
    749         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    750          
    751         assertSemanticallyEqual(task1, task2); 
     968        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     969         
     970        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    752971    } 
    753972 
     
    757976    @Test 
    758977    public void test_compare_MouseButtonUp_04() { 
    759         ITaskFactory taskFactory = new TaskFactory(); 
    760          
    761978        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    762979        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    763         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     980        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    764981         
    765982        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 3, 2); 
    766         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    767          
    768         assertSemanticallyEqual(task1, task2); 
     983        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     984         
     985        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    769986    } 
    770987 
     
    774991    @Test 
    775992    public void test_compare_MouseButtonUp_05() { 
    776         ITaskFactory taskFactory = new TaskFactory(); 
    777          
    778993        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    779994        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    780         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     995        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    781996         
    782997        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    783         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    784          
    785         assertUnequal(task1, task2); 
     998        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     999         
     1000        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    7861001    } 
    7871002     
     
    7911006    @Test 
    7921007    public void test_compare_MouseButtonUp_06() { 
    793         ITaskFactory taskFactory = new TaskFactory(); 
    794          
    7951008        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    7961009        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    797         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1010        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    7981011         
    7991012        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8001013        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    801         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    802          
    803         assertUnequal(task1, task2); 
     1014        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1015         
     1016        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    8041017    } 
    8051018     
     
    8091022    @Test 
    8101023    public void test_compare_MouseClick_01() { 
    811         ITaskFactory taskFactory = new TaskFactory(); 
    812          
    8131024        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8141025        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    815         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    816          
    817         assertLexicallyEqual(task1, task1); 
     1026        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1027         
     1028        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    8181029    } 
    8191030 
     
    8231034    @Test 
    8241035    public void test_compare_MouseClick_02() { 
    825         ITaskFactory taskFactory = new TaskFactory(); 
    826          
    8271036        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8281037        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    829         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1038        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8301039         
    8311040        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    832         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    833          
    834         assertLexicallyEqual(task1, task2); 
     1041        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1042         
     1043        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    8351044    } 
    8361045 
     
    8401049    @Test 
    8411050    public void test_compare_MouseClick_03() { 
    842         ITaskFactory taskFactory = new TaskFactory(); 
    843          
    8441051        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8451052        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    846         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1053        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8471054         
    8481055        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 3); 
    849         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    850          
    851         assertSemanticallyEqual(task1, task2); 
     1056        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1057         
     1058        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    8521059    } 
    8531060 
     
    8571064    @Test 
    8581065    public void test_compare_MouseClick_04() { 
    859         ITaskFactory taskFactory = new TaskFactory(); 
    860          
    8611066        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8621067        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    863         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1068        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8641069         
    8651070        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 3, 2); 
    866         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    867          
    868         assertSemanticallyEqual(task1, task2); 
     1071        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1072         
     1073        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    8691074    } 
    8701075 
     
    8741079    @Test 
    8751080    public void test_compare_MouseClick_05() { 
    876         ITaskFactory taskFactory = new TaskFactory(); 
    877          
    8781081        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8791082        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    880         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1083        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8811084         
    8821085        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    883         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    884          
    885         assertUnequal(task1, task2); 
     1086        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1087         
     1088        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    8861089    } 
    8871090     
     
    8911094    @Test 
    8921095    public void test_compare_MouseClick_06() { 
    893         ITaskFactory taskFactory = new TaskFactory(); 
    894          
    8951096        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    8961097        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    897         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1098        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    8981099         
    8991100        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9001101        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    901         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    902          
    903         assertUnequal(task1, task2); 
     1102        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1103         
     1104        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    9041105    } 
    9051106     
     
    9091110    @Test 
    9101111    public void test_compare_MouseDoubleClick_01() { 
    911         ITaskFactory taskFactory = new TaskFactory(); 
    912          
    9131112        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9141113        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    915         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    916          
    917         assertLexicallyEqual(task1, task1); 
     1114        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1115         
     1116        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    9181117    } 
    9191118 
     
    9231122    @Test 
    9241123    public void test_compare_MouseDoubleClick_02() { 
    925         ITaskFactory taskFactory = new TaskFactory(); 
    926          
    9271124        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9281125        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    929         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1126        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    9301127         
    9311128        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    932         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    933          
    934         assertLexicallyEqual(task1, task2); 
     1129        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1130         
     1131        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    9351132    } 
    9361133 
     
    9401137    @Test 
    9411138    public void test_compare_MouseDoubleClick_03() { 
    942         ITaskFactory taskFactory = new TaskFactory(); 
    943          
    9441139        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9451140        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    946         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1141        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    9471142         
    9481143        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 3); 
    949         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    950          
    951         assertSemanticallyEqual(task1, task2); 
     1144        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1145         
     1146        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    9521147    } 
    9531148 
     
    9571152    @Test 
    9581153    public void test_compare_MouseDoubleClick_04() { 
    959         ITaskFactory taskFactory = new TaskFactory(); 
    960          
    9611154        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9621155        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    963         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1156        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    9641157         
    9651158        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 3, 2); 
    966         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    967          
    968         assertSemanticallyEqual(task1, task2); 
     1159        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1160         
     1161        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    9691162    } 
    9701163 
     
    9741167    @Test 
    9751168    public void test_compare_MouseDoubleClick_05() { 
    976         ITaskFactory taskFactory = new TaskFactory(); 
    977          
    9781169        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9791170        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    980         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1171        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    9811172         
    9821173        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    983         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    984          
    985         assertUnequal(task1, task2); 
     1174        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1175         
     1176        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    9861177    } 
    9871178     
     
    9911182    @Test 
    9921183    public void test_compare_MouseDoubleClick_06() { 
    993         ITaskFactory taskFactory = new TaskFactory(); 
    994          
    9951184        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9961185        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    997         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1186        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    9981187         
    9991188        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    10001189        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1001         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    1002          
    1003         assertUnequal(task1, task2); 
     1190        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1191         
     1192        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    10041193    } 
    10051194     
     
    10091198    @Test 
    10101199    public void test_compare_MouseDragAndDrop_01() { 
    1011         ITaskFactory taskFactory = new TaskFactory(); 
    1012          
    10131200        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10141201        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1015         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    1016          
    1017         assertLexicallyEqual(task1, task1); 
     1202        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1203         
     1204        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    10181205    } 
    10191206 
     
    10231210    @Test 
    10241211    public void test_compare_MouseDragAndDrop_02() { 
    1025         ITaskFactory taskFactory = new TaskFactory(); 
    1026          
    10271212        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10281213        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1029         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1214        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    10301215         
    10311216        IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 
    1032         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1033          
    1034         assertLexicallyEqual(task1, task2); 
     1217        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1218         
     1219        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    10351220    } 
    10361221 
     
    10401225    @Test 
    10411226    public void test_compare_MouseDragAndDrop_03() { 
    1042         ITaskFactory taskFactory = new TaskFactory(); 
    1043          
    10441227        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10451228        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1046         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1229        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    10471230         
    10481231        IEventType eventType2 = new MouseDragAndDrop(5, 2, 3, 4); 
    1049         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1050          
    1051         assertSemanticallyEqual(task1, task2); 
     1232        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1233         
     1234        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    10521235    } 
    10531236 
     
    10571240    @Test 
    10581241    public void test_compare_MouseDragAndDrop_04() { 
    1059         ITaskFactory taskFactory = new TaskFactory(); 
    1060          
    10611242        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10621243        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1063         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1244        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    10641245         
    10651246        IEventType eventType2 = new MouseDragAndDrop(1, 5, 3, 4); 
    1066         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1067          
    1068         assertSemanticallyEqual(task1, task2); 
     1247        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1248         
     1249        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    10691250    } 
    10701251 
     
    10741255    @Test 
    10751256    public void test_compare_MouseDragAndDrop_05() { 
    1076         ITaskFactory taskFactory = new TaskFactory(); 
    1077          
    10781257        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10791258        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1080         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1259        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    10811260         
    10821261        IEventType eventType2 = new MouseDragAndDrop(1, 2, 5, 4); 
    1083         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1084          
    1085         assertSemanticallyEqual(task1, task2); 
     1262        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1263         
     1264        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    10861265    } 
    10871266 
     
    10911270    @Test 
    10921271    public void test_compare_MouseDragAndDrop_06() { 
    1093         ITaskFactory taskFactory = new TaskFactory(); 
    1094          
    10951272        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10961273        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1097         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1274        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    10981275         
    10991276        IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 5); 
    1100         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1101          
    1102         assertSemanticallyEqual(task1, task2); 
     1277        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1278         
     1279        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    11031280    } 
    11041281 
     
    11081285    @Test 
    11091286    public void test_compare_MouseDragAndDrop_07() { 
    1110         ITaskFactory taskFactory = new TaskFactory(); 
    1111          
    11121287        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    11131288        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1114         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1289        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    11151290         
    11161291        IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 
    11171292        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1118         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    1119          
    1120         assertUnequal(task1, task2); 
     1293        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1294         
     1295        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    11211296    } 
    11221297 
     
    11261301    @Test 
    11271302    public void test_compare_Scroll_01() { 
    1128         ITaskFactory taskFactory = new TaskFactory(); 
    1129          
    11301303        IEventType eventType1 = new Scroll(1, 2); 
    11311304        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1132         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    1133          
    1134         assertLexicallyEqual(task1, task1); 
     1305        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1306         
     1307        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    11351308    } 
    11361309 
     
    11401313    @Test 
    11411314    public void test_compare_Scroll_02() { 
    1142         ITaskFactory taskFactory = new TaskFactory(); 
    1143          
    11441315        IEventType eventType1 = new Scroll(1, 2); 
    11451316        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1146         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1317        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    11471318         
    11481319        IEventType eventType2 = new Scroll(1, 2); 
    1149         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1150          
    1151         assertLexicallyEqual(task1, task2); 
     1320        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1321         
     1322        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    11521323    } 
    11531324 
     
    11571328    @Test 
    11581329    public void test_compare_Scroll_03() { 
    1159         ITaskFactory taskFactory = new TaskFactory(); 
    1160          
    11611330        IEventType eventType1 = new Scroll(1, 2); 
    11621331        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1163         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1332        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    11641333         
    11651334        IEventType eventType2 = new Scroll(3, 2); 
    1166         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1167          
    1168         assertSemanticallyEqual(task1, task2); 
     1335        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1336         
     1337        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    11691338    } 
    11701339 
     
    11741343    @Test 
    11751344    public void test_compare_Scroll_04() { 
    1176         ITaskFactory taskFactory = new TaskFactory(); 
    1177          
    11781345        IEventType eventType1 = new Scroll(1, 2); 
    11791346        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1180         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1347        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    11811348         
    11821349        IEventType eventType2 = new Scroll(1, 3); 
    1183         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1184          
    1185         assertSemanticallyEqual(task1, task2); 
     1350        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1351         
     1352        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    11861353    } 
    11871354 
     
    11911358    @Test 
    11921359    public void test_compare_Scroll_05() { 
    1193         ITaskFactory taskFactory = new TaskFactory(); 
    1194          
    11951360        IEventType eventType1 = new Scroll(1, 2); 
    11961361        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1197         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1362        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    11981363         
    11991364        IEventType eventType2 = new Scroll(1, 2); 
    12001365        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1201         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    1202          
    1203         assertUnequal(task1, task2); 
     1366        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1367         
     1368        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    12041369    } 
    12051370     
     
    12091374    @Test 
    12101375    public void test_compare_TextInput_01() { 
    1211         ITaskFactory taskFactory = new TaskFactory(); 
    1212          
    12131376        IEventType eventType1 = new StringEventType("eventType1"); 
    12141377        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     
    12161379        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12171380        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1218         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    1219          
    1220         assertLexicallyEqual(task1, task1); 
     1381        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1382         
     1383        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    12211384    } 
    12221385     
     
    12261389    @Test 
    12271390    public void test_compare_TextInput_02() { 
    1228         ITaskFactory taskFactory = new TaskFactory(); 
    1229          
    12301391        IEventType eventType1 = new StringEventType("eventType1"); 
    12311392        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     
    12331394        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12341395        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1235         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1396        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    12361397         
    12371398        IEventType eventType2 = new TextInput("enteredText1", textInputEvents1); 
    1238         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1239  
    1240         assertLexicallyEqual(task1, task2); 
     1399        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1400 
     1401        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    12411402    } 
    12421403     
     
    12461407    @Test 
    12471408    public void test_compare_TextInput_03() { 
    1248         ITaskFactory taskFactory = new TaskFactory(); 
    1249          
    12501409        IEventType eventType1 = new StringEventType("eventType1"); 
    12511410        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     
    12531412        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12541413        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1255         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1414        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    12561415         
    12571416        IEventType eventType2 = new StringEventType("eventType2"); 
     
    12591418        textInputEvents2.add(new Event(eventType2, eventTarget1)); 
    12601419        eventType2 = new TextInput("enteredText1", textInputEvents2); 
    1261         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1262  
    1263         assertSyntacticallyEqual(task1, task2); 
     1420        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1421 
     1422        assertSyntacticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    12641423    } 
    12651424     
     
    12691428    @Test 
    12701429    public void test_compare_TextInput_04() { 
    1271         ITaskFactory taskFactory = new TaskFactory(); 
    1272          
    12731430        IEventType eventType1 = new StringEventType("eventType1"); 
    12741431        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     
    12761433        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12771434        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1278         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1435        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    12791436         
    12801437        IEventType eventType2 = new StringEventType("eventType2"); 
     
    12821439        textInputEvents2.add(new Event(eventType2, eventTarget1)); 
    12831440        eventType2 = new TextInput("enteredText2", textInputEvents2); 
    1284         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1285  
    1286         assertSemanticallyEqual(task1, task2); 
     1441        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1442 
     1443        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    12871444    } 
    12881445     
     
    12921449    @Test 
    12931450    public void test_compare_TextInput_05() { 
    1294         ITaskFactory taskFactory = new TaskFactory(); 
    1295          
    12961451        IEventType eventType1 = new StringEventType("eventType1"); 
    12971452        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     
    12991454        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    13001455        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1301         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    1302          
    1303         IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1304         ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget2); 
    1305  
    1306         assertUnequal(task1, task2); 
     1456        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1457         
     1458        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     1459        ITask task2 = createNewEventTask(eventType1, eventTarget2); 
     1460 
     1461        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    13071462    } 
    13081463 
     
    13121467    @Test 
    13131468    public void test_compare_TextSelection_01() { 
    1314         ITaskFactory taskFactory = new TaskFactory(); 
    1315          
    13161469        IEventType eventType1 = new TextSelection(); 
    13171470        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1318         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    1319          
    1320         assertLexicallyEqual(task1, task1); 
     1471        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1472         
     1473        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    13211474    } 
    13221475 
     
    13261479    @Test 
    13271480    public void test_compare_TextSelection_02() { 
    1328         ITaskFactory taskFactory = new TaskFactory(); 
    1329          
    13301481        IEventType eventType1 = new TextSelection(); 
    13311482        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1332         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1483        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    13331484 
    13341485        IEventType eventType2 = new TextSelection(); 
    1335         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1336          
    1337         assertLexicallyEqual(task1, task2); 
     1486        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1487         
     1488        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    13381489    } 
    13391490 
     
    13431494    @Test 
    13441495    public void test_compare_TextSelection_03() { 
    1345         ITaskFactory taskFactory = new TaskFactory(); 
    1346          
    13471496        IEventType eventType1 = new TextSelection(); 
    13481497        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1349         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1498        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    13501499 
    13511500        IEventType eventType2 = new TextSelection(); 
    13521501        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1353         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    1354          
    1355         assertUnequal(task1, task2); 
     1502        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1503         
     1504        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    13561505    } 
    13571506 
     
    13611510    @Test 
    13621511    public void test_compare_ValueSelection_01() { 
    1363         ITaskFactory taskFactory = new TaskFactory(); 
    1364          
    13651512        IEventType eventType1 = new ValueSelection<String>("value1"); 
    13661513        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1367         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    1368          
    1369         assertLexicallyEqual(task1, task1); 
     1514        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     1515         
     1516        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task1); 
    13701517    } 
    13711518 
     
    13751522    @Test 
    13761523    public void test_compare_ValueSelection_02() { 
    1377         ITaskFactory taskFactory = new TaskFactory(); 
    1378          
    13791524        IEventType eventType1 = new ValueSelection<String>("value1"); 
    13801525        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1381         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1526        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    13821527         
    13831528        IEventType eventType2 = new ValueSelection<String>("value1"); 
    1384         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1385          
    1386         assertLexicallyEqual(task1, task2); 
     1529        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1530         
     1531        assertLexicallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    13871532    } 
    13881533 
     
    13921537    @Test 
    13931538    public void test_compare_ValueSelection_03() { 
    1394         ITaskFactory taskFactory = new TaskFactory(); 
    1395          
    13961539        IEventType eventType1 = new ValueSelection<String>("value1"); 
    13971540        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1398         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1541        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    13991542         
    14001543        IEventType eventType2 = new ValueSelection<String>("value2"); 
    1401         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    1402          
    1403         assertSemanticallyEqual(task1, task2); 
     1544        ITask task2 = createNewEventTask(eventType2, eventTarget1); 
     1545         
     1546        assertSemanticallyEqual(new GUIEventTaskComparisonRule(), task1, task2); 
    14041547    } 
    14051548 
     
    14091552    @Test 
    14101553    public void test_compare_ValueSelection_04() { 
    1411         ITaskFactory taskFactory = new TaskFactory(); 
    1412          
    14131554        IEventType eventType1 = new ValueSelection<String>("value1"); 
    14141555        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1415         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     1556        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
    14161557         
    14171558        IEventType eventType2 = new ValueSelection<String>("value1"); 
    14181559        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1419         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    1420          
    1421         assertUnequal(task1, task2); 
    1422     } 
    1423      
    1424     /** 
    1425      * 
    1426      */ 
    1427     private void assertLexicallyEqual(ITask task1, ITask task2) { 
    1428         GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    1429          
    1430         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 
    1431         assertTrue(rule.areLexicallyEqual(task1, task2)); 
    1432         assertTrue(rule.areSyntacticallyEqual(task1, task2)); 
    1433         assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    1434  
    1435         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 
    1436         assertTrue(rule.areLexicallyEqual(task2, task1)); 
    1437         assertTrue(rule.areSyntacticallyEqual(task2, task1)); 
    1438         assertTrue(rule.areSemanticallyEqual(task2, task1)); 
    1439     } 
    1440  
    1441     /** 
    1442      * 
    1443      */ 
    1444     private void assertSyntacticallyEqual(ITask task1, ITask task2) { 
    1445         GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    1446          
    1447         assertEquals(TaskEquality.SYNTACTICALLY_EQUAL, rule.compare(task1, task2)); 
    1448         assertFalse(rule.areLexicallyEqual(task1, task2)); 
    1449         assertTrue(rule.areSyntacticallyEqual(task1, task2)); 
    1450         assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    1451  
    1452         assertEquals(TaskEquality.SYNTACTICALLY_EQUAL, rule.compare(task2, task1)); 
    1453         assertFalse(rule.areLexicallyEqual(task2, task1)); 
    1454         assertTrue(rule.areSyntacticallyEqual(task2, task1)); 
    1455         assertTrue(rule.areSemanticallyEqual(task2, task1)); 
    1456     } 
    1457  
    1458     /** 
    1459      * 
    1460      */ 
    1461     private void assertSemanticallyEqual(ITask task1, ITask task2) { 
    1462         GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    1463          
    1464         assertEquals(TaskEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2)); 
    1465         assertFalse(rule.areLexicallyEqual(task1, task2)); 
    1466         assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    1467         assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    1468  
    1469         assertEquals(TaskEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1)); 
    1470         assertFalse(rule.areLexicallyEqual(task2, task1)); 
    1471         assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
    1472         assertTrue(rule.areSemanticallyEqual(task2, task1)); 
    1473     } 
    1474  
    1475     /** 
    1476      * 
    1477      */ 
    1478     private void assertUnequal(ITask task1, ITask task2) { 
    1479         GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    1480          
    1481         assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 
    1482         assertFalse(rule.areLexicallyEqual(task1, task2)); 
    1483         assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    1484         assertFalse(rule.areSemanticallyEqual(task1, task2)); 
    1485  
    1486         assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 
    1487         assertFalse(rule.areLexicallyEqual(task2, task1)); 
    1488         assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
    1489         assertFalse(rule.areSemanticallyEqual(task2, task1)); 
     1560        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     1561         
     1562        assertUnequal(new GUIEventTaskComparisonRule(), task1, task2); 
    14901563    } 
    14911564} 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/IterationComparisonRuleTest.java

    r1190 r1294  
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2424import de.ugoe.cs.autoquest.tasktrees.taskequality.IterationComparisonRule; 
    25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2726import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2927import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3328import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3429 
     
    3631 * @author Patrick Harms 
    3732 */ 
    38 public class IterationComparisonRuleTest { 
    39  
    40     /** 
    41      * 
    42      */ 
    43     @Test 
    44     public void test() { 
    45         ITaskFactory taskFactory = new TaskFactory(); 
    46         ITaskBuilder treeBuilder = new TaskBuilder(); 
    47          
     33public class IterationComparisonRuleTest extends AbstractComparisonRuleTest { 
     34 
     35    /** 
     36     * 
     37     */ 
     38    @Test 
     39    public void test_isApplicable_01() { 
     40        IterationComparisonRule rule = new IterationComparisonRule(); 
     41         
     42        ITask task1 = createNewIteration(); 
     43         
     44        assertTrue(rule.isApplicable(task1, task1)); 
     45    } 
     46 
     47    /** 
     48     * 
     49     */ 
     50    @Test 
     51    public void test_isApplicable_02() { 
     52        IterationComparisonRule rule = new IterationComparisonRule(); 
     53 
     54        ITask task1 = createNewIteration(); 
     55        ITask task2 = createNewIteration(); 
     56         
     57        assertTrue(rule.isApplicable(task1, task2)); 
     58        assertTrue(rule.isApplicable(task2, task1)); 
     59    } 
     60 
     61    /** 
     62     * 
     63     */ 
     64    @Test 
     65    public void test_isApplicable_03() { 
     66        IterationComparisonRule rule = new IterationComparisonRule(); 
     67 
     68        ITask task1 = createNewIteration(); 
     69        ITask task2 = createNewSequence(); 
     70         
     71        assertFalse(rule.isApplicable(task1, task2)); 
     72        assertFalse(rule.isApplicable(task2, task1)); 
     73    } 
     74 
     75    /** 
     76     * 
     77     */ 
     78    @Test 
     79    public void test_isApplicable_04() { 
     80        IterationComparisonRule rule = new IterationComparisonRule(); 
     81 
     82        ITask task1 = createNewIteration(); 
     83        ITask task2 = createNewSelection(); 
     84         
     85        assertFalse(rule.isApplicable(task1, task2)); 
     86        assertFalse(rule.isApplicable(task2, task1)); 
     87    } 
     88 
     89    /** 
     90     * 
     91     */ 
     92    @Test 
     93    public void test_isApplicable_05() { 
     94        IterationComparisonRule rule = new IterationComparisonRule(); 
     95 
     96        ITask task1 = createNewIteration(); 
     97        ITask task2 = createNewOptional(); 
     98         
     99        assertFalse(rule.isApplicable(task1, task2)); 
     100        assertFalse(rule.isApplicable(task2, task1)); 
     101    } 
     102 
     103    /** 
     104     * 
     105     */ 
     106    @Test 
     107    public void test_isApplicable_06() { 
     108        IterationComparisonRule rule = new IterationComparisonRule(); 
     109         
     110        IEventType eventType1 = new StringEventType("eventType1"); 
     111        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     112 
     113        ITask task1 = createNewIteration(); 
     114        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     115         
     116        assertFalse(rule.isApplicable(task1, task2)); 
     117        assertFalse(rule.isApplicable(task2, task1)); 
     118    } 
     119 
     120    /** 
     121     * 
     122     */ 
     123    @Test 
     124    public void test_compare_01() { 
     125        IterationComparisonRule rule = new IterationComparisonRule(); 
     126         
     127        IIteration iteration1 = createNewIteration(); 
     128         
     129        assertLexicallyEqual(rule, iteration1, iteration1); 
     130    } 
     131 
     132    /** 
     133     * 
     134     */ 
     135    @Test 
     136    public void test_compare_02() { 
     137        IterationComparisonRule rule = new IterationComparisonRule(); 
     138         
     139        IIteration iteration1 = createNewIteration(); 
     140        IIteration iteration2 = createNewIteration(); 
     141         
     142        assertLexicallyEqual(rule, iteration1, iteration2); 
     143    } 
     144 
     145    /** 
     146     * 
     147     */ 
     148    @Test 
     149    public void test_compare_03() { 
     150        IterationComparisonRule rule = new IterationComparisonRule(); 
     151         
     152        IEventType eventType1 = new StringEventType("eventType1"); 
     153        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     154 
     155        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     156         
     157        IIteration iteration1 = createNewIteration(); 
     158        IIteration iteration2 = createNewIteration(); 
     159         
     160        setMarkedTask(iteration1, task1); 
     161         
     162        assertUnequal(rule, iteration1, iteration2); 
     163    } 
     164 
     165    /** 
     166     * 
     167     */ 
     168    @Test 
     169    public void test_compare_04() { 
     170        IterationComparisonRule rule = new IterationComparisonRule(); 
     171         
     172        IEventType eventType1 = new StringEventType("eventType1"); 
     173        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     174 
     175        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     176         
     177        IIteration iteration1 = createNewIteration(); 
     178        IIteration iteration2 = createNewIteration(); 
     179         
     180        setMarkedTask(iteration1, task1); 
     181        setMarkedTask(iteration2, task1); 
     182         
     183        assertLexicallyEqual(rule, iteration1, iteration2); 
     184    } 
     185 
     186    /** 
     187     * 
     188     */ 
     189    @Test 
     190    public void test_compare_05() { 
    48191        IterationComparisonRule rule = new IterationComparisonRule(); 
    49192         
     
    54197        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    55198 
    56         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    57         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    58          
    59         assertFalse(rule.isApplicable(task1, task2)); 
    60          
    61         IIteration iteration1 = taskFactory.createNewIteration(); 
    62         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration1)); 
    63  
    64         IIteration iteration2 = taskFactory.createNewIteration(); 
    65          
    66         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 
    67         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 
    68          
    69         treeBuilder.setMarkedTask(iteration1, task1); 
    70          
    71         assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration1, iteration2)); 
    72         assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration2, iteration1)); 
    73          
    74         treeBuilder.setMarkedTask(iteration2, task1); 
    75          
    76         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 
    77         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 
    78          
    79         treeBuilder.setMarkedTask(iteration1, task2); 
    80          
    81         assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration1, iteration2)); 
    82         assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration2, iteration1)); 
    83          
    84         treeBuilder.setMarkedTask(iteration2, task2); 
    85          
    86         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 
    87         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 
    88          
    89         ISelection selection1 = taskFactory.createNewSelection(); 
    90         treeBuilder.addChild(selection1, task2); 
    91         treeBuilder.setMarkedTask(iteration1, selection1); 
    92          
    93         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 
    94         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 
    95          
    96         ISelection selection2 = taskFactory.createNewSelection(); 
    97         treeBuilder.addChild(selection2, task2); 
    98         treeBuilder.setMarkedTask(iteration2, selection2); 
    99          
    100         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 
    101         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 
    102          
    103         assertFalse(rule.isApplicable(iteration1, selection1)); 
    104         assertFalse(rule.isApplicable(selection1, iteration1)); 
    105         assertFalse(rule.isApplicable(iteration2, selection1)); 
    106         assertFalse(rule.isApplicable(selection1, iteration2)); 
    107  
    108         assertFalse(rule.isApplicable(iteration1, selection2)); 
    109         assertFalse(rule.isApplicable(selection2, iteration1)); 
    110         assertFalse(rule.isApplicable(iteration2, selection2)); 
    111         assertFalse(rule.isApplicable(selection2, iteration2)); 
     199        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     200        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     201         
     202        IIteration iteration1 = createNewIteration(); 
     203        IIteration iteration2 = createNewIteration(); 
     204         
     205        setMarkedTask(iteration1, task1); 
     206        setMarkedTask(iteration1, task2); 
     207         
     208        assertUnequal(rule, iteration1, iteration2); 
     209    } 
     210 
     211    /** 
     212     * 
     213     */ 
     214    @Test 
     215    public void test_compare_06() { 
     216        IterationComparisonRule rule = new IterationComparisonRule(); 
     217         
     218        IEventType eventType1 = new StringEventType("eventType1"); 
     219        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     220 
     221        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     222         
     223        IIteration iteration1 = createNewIteration(); 
     224        IIteration iteration2 = createNewIteration(); 
     225         
     226        ISelection selection1 = createNewSelection(); 
     227        addChild(selection1, task1); 
     228        setMarkedTask(iteration1, selection1); 
     229         
     230        setMarkedTask(iteration2, task1); 
     231         
     232        assertLexicallyEqual(rule, iteration1, iteration2); 
     233    } 
     234 
     235    /** 
     236     * 
     237     */ 
     238    @Test 
     239    public void test_compare_07() { 
     240        IterationComparisonRule rule = new IterationComparisonRule(); 
     241         
     242        IEventType eventType1 = new StringEventType("eventType1"); 
     243        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     244 
     245        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     246         
     247        IIteration iteration1 = createNewIteration(); 
     248        IIteration iteration2 = createNewIteration(); 
     249         
     250        ISelection selection1 = createNewSelection(); 
     251        addChild(selection1, task1); 
     252        setMarkedTask(iteration1, selection1); 
     253         
     254        ISelection selection2 = createNewSelection(); 
     255        addChild(selection2, task1); 
     256        setMarkedTask(iteration2, selection2); 
     257         
     258        assertLexicallyEqual(rule, iteration1, iteration2); 
     259    } 
     260 
     261    /** 
     262     * 
     263     */ 
     264    @Test 
     265    public void test_compare_08() { 
     266        IterationComparisonRule rule = new IterationComparisonRule(); 
     267         
     268        IEventType eventType1 = new StringEventType("eventType1"); 
     269        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     270 
     271        IEventType eventType2 = new StringEventType("eventType2"); 
     272        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     273 
     274        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     275        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     276         
     277        IIteration iteration1 = createNewIteration(); 
     278        IIteration iteration2 = createNewIteration(); 
     279         
     280        ISelection selection1 = createNewSelection(); 
     281        addChild(selection1, task1); 
     282        addChild(selection1, task2); 
     283        setMarkedTask(iteration1, selection1); 
     284 
     285        ISelection selection2 = createNewSelection(); 
     286        addChild(selection2, task2); 
     287        setMarkedTask(iteration2, selection2); 
     288         
     289        assertLexicallyEqual(rule, iteration1, iteration2); 
    112290    } 
    113291 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SelectionComparisonRuleTest.java

    r1190 r1294  
    2222import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2524import de.ugoe.cs.autoquest.tasktrees.taskequality.SelectionComparisonRule; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2926import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3327import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3428 
     
    3630 * @author Patrick Harms 
    3731 */ 
    38 public class SelectionComparisonRuleTest { 
    39  
    40     /** 
    41      *  
    42      */ 
    43     @Test 
    44     public void test() { 
    45         ITaskFactory taskFactory = new TaskFactory(); 
    46         ITaskBuilder treeBuilder = new TaskBuilder(); 
    47          
     32public class SelectionComparisonRuleTest extends AbstractComparisonRuleTest { 
     33 
     34    /** 
     35     * 
     36     */ 
     37    @Test 
     38    public void test_isApplicable_01() { 
     39        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     40         
     41        ITask task1 = createNewSelection(); 
     42         
     43        assertTrue(rule.isApplicable(task1, task1)); 
     44    } 
     45 
     46    /** 
     47     * 
     48     */ 
     49    @Test 
     50    public void test_isApplicable_02() { 
     51        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     52 
     53        ITask task1 = createNewSelection(); 
     54        ITask task2 = createNewSelection(); 
     55         
     56        assertTrue(rule.isApplicable(task1, task2)); 
     57        assertTrue(rule.isApplicable(task2, task1)); 
     58    } 
     59 
     60    /** 
     61     * 
     62     */ 
     63    @Test 
     64    public void test_isApplicable_03() { 
     65        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     66 
     67        ITask task1 = createNewSelection(); 
     68        ITask task2 = createNewSequence(); 
     69         
     70        assertFalse(rule.isApplicable(task1, task2)); 
     71        assertFalse(rule.isApplicable(task2, task1)); 
     72    } 
     73 
     74    /** 
     75     * 
     76     */ 
     77    @Test 
     78    public void test_isApplicable_04() { 
     79        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     80 
     81        ITask task1 = createNewSelection(); 
     82        ITask task2 = createNewIteration(); 
     83         
     84        assertFalse(rule.isApplicable(task1, task2)); 
     85        assertFalse(rule.isApplicable(task2, task1)); 
     86    } 
     87 
     88    /** 
     89     * 
     90     */ 
     91    @Test 
     92    public void test_isApplicable_05() { 
     93        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     94 
     95        ITask task1 = createNewSelection(); 
     96        ITask task2 = createNewOptional(); 
     97         
     98        assertFalse(rule.isApplicable(task1, task2)); 
     99        assertFalse(rule.isApplicable(task2, task1)); 
     100    } 
     101 
     102    /** 
     103     * 
     104     */ 
     105    @Test 
     106    public void test_isApplicable_06() { 
     107        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     108         
     109        IEventType eventType1 = new StringEventType("eventType1"); 
     110        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     111 
     112        ITask task1 = createNewSelection(); 
     113        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     114         
     115        assertFalse(rule.isApplicable(task1, task2)); 
     116        assertFalse(rule.isApplicable(task2, task1)); 
     117    } 
     118 
     119    /** 
     120     *  
     121     */ 
     122    @Test 
     123    public void test_compare_01() { 
     124        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     125         
     126        ISelection selection1 = createNewSelection(); 
     127        assertLexicallyEqual(rule, selection1, selection1); 
     128    } 
     129 
     130    /** 
     131     *  
     132     */ 
     133    @Test 
     134    public void test_compare_02() { 
     135        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     136         
     137        ISelection selection1 = createNewSelection(); 
     138        ISelection selection2 = createNewSelection(); 
     139         
     140        assertLexicallyEqual(rule, selection1, selection2); 
     141    } 
     142 
     143    /** 
     144     *  
     145     */ 
     146    @Test 
     147    public void test_compare_03() { 
     148        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     149         
     150        IEventType eventType1 = new StringEventType("eventType1"); 
     151        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     152 
     153        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     154         
     155        ISelection selection1 = createNewSelection(); 
     156        ISelection selection2 = createNewSelection(); 
     157         
     158        addChild(selection1, task1); 
     159         
     160        assertUnequal(rule, selection1, selection2); 
     161    } 
     162 
     163    /** 
     164     *  
     165     */ 
     166    @Test 
     167    public void test_compare_04() { 
     168        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     169         
     170        IEventType eventType1 = new StringEventType("eventType1"); 
     171        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     172 
     173        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     174         
     175        ISelection selection1 = createNewSelection(); 
     176        ISelection selection2 = createNewSelection(); 
     177         
     178        addChild(selection1, task1); 
     179        addChild(selection2, task1); 
     180         
     181        assertLexicallyEqual(rule, selection1, selection2); 
     182    } 
     183 
     184    /** 
     185     *  
     186     */ 
     187    @Test 
     188    public void test_compare_05() { 
    48189        SelectionComparisonRule rule = new SelectionComparisonRule(); 
    49190         
     
    54195        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    55196 
    56         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    57         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    58          
    59         assertFalse(rule.isApplicable(task1, task2)); 
    60          
    61         ISelection selection1 = taskFactory.createNewSelection(); 
    62         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection1)); 
    63  
    64         ISelection selection2 = taskFactory.createNewSelection(); 
    65          
    66         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2)); 
    67         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1)); 
    68          
    69         treeBuilder.addChild(selection1, task1); 
    70          
    71         assertEquals(TaskEquality.UNEQUAL, rule.compare(selection1, selection2)); 
    72         assertEquals(TaskEquality.UNEQUAL, rule.compare(selection2, selection1)); 
    73          
    74         treeBuilder.addChild(selection2, task1); 
    75          
    76         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2)); 
    77         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1)); 
    78          
    79         treeBuilder.addChild(selection1, task2); 
    80          
    81         assertEquals(TaskEquality.UNEQUAL, rule.compare(selection1, selection2)); 
    82         assertEquals(TaskEquality.UNEQUAL, rule.compare(selection2, selection1)); 
    83          
    84         treeBuilder.addChild(selection2, task2); 
    85          
    86         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2)); 
    87         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1)); 
    88          
    89         ISelection selection3 = taskFactory.createNewSelection(); 
    90         treeBuilder.addChild(selection3, task2); 
    91         treeBuilder.addChild(selection3, task1); 
    92          
    93         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection3)); 
    94         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection3, selection1)); 
    95          
    96         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection3)); 
    97         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection3, selection2)); 
    98  
    99         ISequence sequence = taskFactory.createNewSequence(); 
    100         assertFalse(rule.isApplicable(selection1, sequence)); 
    101         assertFalse(rule.isApplicable(sequence, selection1)); 
    102         assertFalse(rule.isApplicable(selection2, sequence)); 
    103         assertFalse(rule.isApplicable(sequence, selection2)); 
    104         assertFalse(rule.isApplicable(selection3, sequence)); 
    105         assertFalse(rule.isApplicable(sequence, selection3)); 
     197        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     198        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     199         
     200        ISelection selection1 = createNewSelection(); 
     201        ISelection selection2 = createNewSelection(); 
     202         
     203        addChild(selection1, task1); 
     204        addChild(selection2, task2); 
     205         
     206        assertUnequal(rule, selection1, selection2); 
     207    } 
     208 
     209    /** 
     210     *  
     211     */ 
     212    @Test 
     213    public void test_compare_06() { 
     214        SelectionComparisonRule rule = new SelectionComparisonRule(); 
     215         
     216        IEventType eventType1 = new StringEventType("eventType1"); 
     217        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     218 
     219        IEventType eventType2 = new StringEventType("eventType2"); 
     220        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     221 
     222        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     223        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     224         
     225        ISelection selection1 = createNewSelection(); 
     226        ISelection selection2 = createNewSelection(); 
     227         
     228        addChild(selection1, task1); 
     229        addChild(selection2, task2); 
     230         
     231        ISelection selection3 = createNewSelection(); 
     232        addChild(selection3, task1); 
     233        assertLexicallyEqual(rule, selection1, selection3); 
     234         
     235        addChild(selection3, task2); 
     236        assertLexicallyEqual(rule, selection2, selection3); 
    106237    } 
    107238 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SequenceComparisonRuleTest.java

    r1190 r1294  
    2222import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2524import de.ugoe.cs.autoquest.tasktrees.taskequality.SequenceComparisonRule; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    2725import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2926import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3327import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3428 
     
    3630 * @author Patrick Harms 
    3731 */ 
    38 public class SequenceComparisonRuleTest { 
    39  
    40     /** 
    41      *  
    42      */ 
    43     @Test 
    44     public void test() { 
    45         ITaskFactory taskFactory = new TaskFactory(); 
    46         ITaskBuilder treeBuilder = new TaskBuilder(); 
    47          
     32public class SequenceComparisonRuleTest extends AbstractComparisonRuleTest { 
     33 
     34    /** 
     35     * 
     36     */ 
     37    @Test 
     38    public void test_isApplicable_01() { 
     39        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     40         
     41        ITask task1 = createNewSequence(); 
     42         
     43        assertTrue(rule.isApplicable(task1, task1)); 
     44    } 
     45 
     46    /** 
     47     * 
     48     */ 
     49    @Test 
     50    public void test_isApplicable_02() { 
     51        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     52 
     53        ITask task1 = createNewSequence(); 
     54        ITask task2 = createNewSequence(); 
     55         
     56        assertTrue(rule.isApplicable(task1, task2)); 
     57        assertTrue(rule.isApplicable(task2, task1)); 
     58    } 
     59 
     60    /** 
     61     * 
     62     */ 
     63    @Test 
     64    public void test_isApplicable_03() { 
     65        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     66 
     67        ITask task1 = createNewSequence(); 
     68        ITask task2 = createNewSelection(); 
     69         
     70        assertFalse(rule.isApplicable(task1, task2)); 
     71        assertFalse(rule.isApplicable(task2, task1)); 
     72    } 
     73 
     74    /** 
     75     * 
     76     */ 
     77    @Test 
     78    public void test_isApplicable_04() { 
     79        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     80 
     81        ITask task1 = createNewSequence(); 
     82        ITask task2 = createNewIteration(); 
     83         
     84        assertFalse(rule.isApplicable(task1, task2)); 
     85        assertFalse(rule.isApplicable(task2, task1)); 
     86    } 
     87 
     88    /** 
     89     * 
     90     */ 
     91    @Test 
     92    public void test_isApplicable_05() { 
     93        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     94 
     95        ITask task1 = createNewSequence(); 
     96        ITask task2 = createNewOptional(); 
     97         
     98        assertFalse(rule.isApplicable(task1, task2)); 
     99        assertFalse(rule.isApplicable(task2, task1)); 
     100    } 
     101 
     102    /** 
     103     * 
     104     */ 
     105    @Test 
     106    public void test_isApplicable_06() { 
     107        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     108         
     109        IEventType eventType1 = new StringEventType("eventType1"); 
     110        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     111 
     112        ITask task1 = createNewSequence(); 
     113        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     114         
     115        assertFalse(rule.isApplicable(task1, task2)); 
     116        assertFalse(rule.isApplicable(task2, task1)); 
     117    } 
     118 
     119    /** 
     120     *  
     121     */ 
     122    @Test 
     123    public void test_compare_01() { 
     124        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     125         
     126        ISequence sequence1 = createNewSequence(); 
     127        assertLexicallyEqual(rule, sequence1, sequence1); 
     128    } 
     129 
     130    /** 
     131     *  
     132     */ 
     133    @Test 
     134    public void test_compare_02() { 
     135        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     136         
     137        ISequence sequence1 = createNewSequence(); 
     138        ISequence sequence2 = createNewSequence(); 
     139         
     140        assertLexicallyEqual(rule, sequence1, sequence2); 
     141    } 
     142 
     143    /** 
     144     *  
     145     */ 
     146    @Test 
     147    public void test_compare_03() { 
     148        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     149         
     150        IEventType eventType1 = new StringEventType("eventType1"); 
     151        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     152 
     153        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     154         
     155        ISequence sequence1 = createNewSequence(); 
     156        ISequence sequence2 = createNewSequence(); 
     157         
     158        addChild(sequence1, task1); 
     159         
     160        assertUnequal(rule, sequence1, sequence2); 
     161    } 
     162 
     163    /** 
     164     *  
     165     */ 
     166    @Test 
     167    public void test_compare_04() { 
     168        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     169         
     170        IEventType eventType1 = new StringEventType("eventType1"); 
     171        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     172 
     173        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     174         
     175        ISequence sequence1 = createNewSequence(); 
     176        ISequence sequence2 = createNewSequence(); 
     177         
     178        addChild(sequence1, task1); 
     179        addChild(sequence2, task1); 
     180         
     181        assertLexicallyEqual(rule, sequence1, sequence2); 
     182    } 
     183 
     184    /** 
     185     *  
     186     */ 
     187    @Test 
     188    public void test_compare_05() { 
    48189        SequenceComparisonRule rule = new SequenceComparisonRule(); 
    49190         
     
    54195        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    55196 
    56         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    57         ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    58          
    59         assertFalse(rule.isApplicable(task1, task2)); 
    60          
    61         ISequence sequence1 = taskFactory.createNewSequence(); 
    62         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence1)); 
    63  
    64         ISequence sequence2 = taskFactory.createNewSequence(); 
    65          
    66         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2)); 
    67         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1)); 
    68          
    69         treeBuilder.addChild(sequence1, task1); 
    70          
    71         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence1, sequence2)); 
    72         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence2, sequence1)); 
    73          
    74         treeBuilder.addChild(sequence2, task1); 
    75          
    76         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2)); 
    77         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1)); 
    78          
    79         treeBuilder.addChild(sequence1, task2); 
    80          
    81         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence1, sequence2)); 
    82         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence2, sequence1)); 
    83          
    84         treeBuilder.addChild(sequence2, task2); 
    85          
    86         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2)); 
    87         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1)); 
    88          
    89         ISequence sequence3 = taskFactory.createNewSequence(); 
    90         treeBuilder.addChild(sequence3, task2); 
    91         treeBuilder.addChild(sequence3, task1); 
    92          
    93         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence1, sequence3)); 
    94         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence3, sequence1)); 
    95         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence2, sequence3)); 
    96         assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence3, sequence2)); 
    97  
    98         ISelection selection = taskFactory.createNewSelection(); 
    99         assertFalse(rule.isApplicable(sequence1, selection)); 
    100         assertFalse(rule.isApplicable(selection, sequence1)); 
    101         assertFalse(rule.isApplicable(sequence2, selection)); 
    102         assertFalse(rule.isApplicable(selection, sequence2)); 
    103         assertFalse(rule.isApplicable(sequence3, selection)); 
    104         assertFalse(rule.isApplicable(selection, sequence3)); 
     197        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     198        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     199         
     200        ISequence sequence1 = createNewSequence(); 
     201        ISequence sequence2 = createNewSequence(); 
     202         
     203        addChild(sequence1, task1); 
     204        addChild(sequence2, task1); 
     205         
     206        addChild(sequence1, task2); 
     207         
     208        assertUnequal(rule, sequence1, sequence2); 
     209    } 
     210 
     211    /** 
     212     *  
     213     */ 
     214    @Test 
     215    public void test_compare_06() { 
     216        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     217         
     218        IEventType eventType1 = new StringEventType("eventType1"); 
     219        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     220 
     221        IEventType eventType2 = new StringEventType("eventType2"); 
     222        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     223 
     224        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     225        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     226         
     227        ISequence sequence1 = createNewSequence(); 
     228        ISequence sequence2 = createNewSequence(); 
     229         
     230        addChild(sequence1, task1); 
     231        addChild(sequence2, task1); 
     232         
     233        addChild(sequence1, task2); 
     234        addChild(sequence2, task2); 
     235         
     236        assertLexicallyEqual(rule, sequence1, sequence2); 
     237    } 
     238 
     239    /** 
     240     *  
     241     */ 
     242    @Test 
     243    public void test_compare_07() { 
     244        SequenceComparisonRule rule = new SequenceComparisonRule(); 
     245         
     246        IEventType eventType1 = new StringEventType("eventType1"); 
     247        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     248 
     249        IEventType eventType2 = new StringEventType("eventType2"); 
     250        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
     251 
     252        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     253        ITask task2 = createNewEventTask(eventType2, eventTarget2); 
     254         
     255        ISequence sequence1 = createNewSequence(); 
     256        ISequence sequence2 = createNewSequence(); 
     257         
     258        addChild(sequence1, task1); 
     259        addChild(sequence1, task2); 
     260         
     261        addChild(sequence2, task2); 
     262        addChild(sequence2, task1); 
     263         
     264        assertUnequal(rule, sequence1, sequence2); 
    105265    } 
    106266 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRuleTest.java

    r1190 r1294  
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2424import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndIterationComparisonRule; 
    25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2726import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2927import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3328import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3429 
     
    3631 * @author Patrick Harms 
    3732 */ 
    38 public class TaskAndIterationComparisonRuleTest { 
    39  
    40     /** 
    41      * 
    42      */ 
    43     @Test 
    44     public void test() { 
    45         ITaskFactory taskFactory = new TaskFactory(); 
    46         ITaskBuilder treeBuilder = new TaskBuilder(); 
    47          
    48         TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
    49          
    50         IEventType eventType1 = new StringEventType("eventType1"); 
    51         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    52         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    53          
    54         assertNull(rule.compare(task1, task1)); 
    55          
    56         IIteration iteration1 = taskFactory.createNewIteration(); 
    57         assertNull(rule.compare(iteration1, iteration1)); 
    58         assertNull(rule.compare(task1, iteration1)); 
    59         assertNull(rule.compare(iteration1, task1)); 
    60  
    61         treeBuilder.setMarkedTask(iteration1, task1); 
    62          
    63         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); 
    64         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); 
    65          
    66         ISelection selection1 = taskFactory.createNewSelection(); 
    67         treeBuilder.addChild(selection1, task1); 
    68         treeBuilder.setMarkedTask(iteration1, selection1); 
    69          
    70         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); 
    71         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); 
     33public class TaskAndIterationComparisonRuleTest extends AbstractComparisonRuleTest { 
     34 
     35    /** 
     36     * 
     37     */ 
     38    @Test 
     39    public void test_isApplicable_01() { 
     40        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     41         
     42        ITask task1 = createNewSequence(); 
     43         
     44        assertFalse(rule.isApplicable(task1, task1)); 
     45    } 
     46 
     47    /** 
     48     * 
     49     */ 
     50    @Test 
     51    public void test_isApplicable_02() { 
     52        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     53         
     54        ITask task1 = createNewSelection(); 
     55         
     56        assertFalse(rule.isApplicable(task1, task1)); 
     57    } 
     58 
     59    /** 
     60     * 
     61     */ 
     62    @Test 
     63    public void test_isApplicable_03() { 
     64        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     65         
     66        ITask task1 = createNewIteration(); 
     67         
     68        assertFalse(rule.isApplicable(task1, task1)); 
     69    } 
     70 
     71    /** 
     72     * 
     73     */ 
     74    @Test 
     75    public void test_isApplicable_04() { 
     76        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     77         
     78        ITask task1 = createNewOptional(); 
     79         
     80        assertFalse(rule.isApplicable(task1, task1)); 
     81    } 
     82 
     83    /** 
     84     * 
     85     */ 
     86    @Test 
     87    public void test_isApplicable_05() { 
     88        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     89         
     90        IEventType eventType1 = new StringEventType("eventType1"); 
     91        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     92 
     93        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     94         
     95        assertFalse(rule.isApplicable(task1, task1)); 
     96    } 
     97 
     98    /** 
     99     * 
     100     */ 
     101    @Test 
     102    public void test_isApplicable_06() { 
     103        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     104 
     105        ITask task1 = createNewIteration(); 
     106        ITask task2 = createNewSequence(); 
     107         
     108        assertTrue(rule.isApplicable(task1, task2)); 
     109        assertTrue(rule.isApplicable(task2, task1)); 
     110    } 
     111 
     112    /** 
     113     * 
     114     */ 
     115    @Test 
     116    public void test_isApplicable_07() { 
     117        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     118 
     119        ITask task1 = createNewIteration(); 
     120        ITask task2 = createNewSelection(); 
     121         
     122        assertTrue(rule.isApplicable(task1, task2)); 
     123        assertTrue(rule.isApplicable(task2, task1)); 
     124    } 
     125 
     126    /** 
     127     * 
     128     */ 
     129    @Test 
     130    public void test_isApplicable_08() { 
     131        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     132 
     133        ITask task1 = createNewIteration(); 
     134        ITask task2 = createNewOptional(); 
     135         
     136        assertTrue(rule.isApplicable(task1, task2)); 
     137        assertTrue(rule.isApplicable(task2, task1)); 
     138    } 
     139 
     140    /** 
     141     * 
     142     */ 
     143    @Test 
     144    public void test_isApplicable_09() { 
     145        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     146 
     147        ITask task1 = createNewIteration(); 
     148         
     149        IEventType eventType1 = new StringEventType("eventType1"); 
     150        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     151 
     152        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     153         
     154        assertTrue(rule.isApplicable(task1, task2)); 
     155        assertTrue(rule.isApplicable(task2, task1)); 
     156    } 
     157 
     158    /** 
     159     * 
     160     */ 
     161    @Test 
     162    public void test_isApplicable_10() { 
     163        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     164 
     165        ITask task1 = createNewSequence(); 
     166        ITask task2 = createNewSelection(); 
     167         
     168        assertFalse(rule.isApplicable(task1, task2)); 
     169        assertFalse(rule.isApplicable(task2, task1)); 
     170    } 
     171 
     172    /** 
     173     * 
     174     */ 
     175    @Test 
     176    public void test_isApplicable_11() { 
     177        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     178 
     179        ITask task1 = createNewSequence(); 
     180        ITask task2 = createNewOptional(); 
     181         
     182        assertFalse(rule.isApplicable(task1, task2)); 
     183        assertFalse(rule.isApplicable(task2, task1)); 
     184    } 
     185 
     186    /** 
     187     * 
     188     */ 
     189    @Test 
     190    public void test_isApplicable_12() { 
     191        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     192 
     193        ITask task1 = createNewSequence(); 
     194         
     195        IEventType eventType1 = new StringEventType("eventType1"); 
     196        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     197 
     198        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     199         
     200        assertFalse(rule.isApplicable(task1, task2)); 
     201        assertFalse(rule.isApplicable(task2, task1)); 
     202    } 
     203 
     204    /** 
     205     * 
     206     */ 
     207    @Test 
     208    public void test_isApplicable_13() { 
     209        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     210 
     211        ITask task1 = createNewSelection(); 
     212        ITask task2 = createNewOptional(); 
     213         
     214        assertFalse(rule.isApplicable(task1, task2)); 
     215        assertFalse(rule.isApplicable(task2, task1)); 
     216    } 
     217 
     218    /** 
     219     * 
     220     */ 
     221    @Test 
     222    public void test_isApplicable_14() { 
     223        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     224 
     225        ITask task1 = createNewSelection(); 
     226         
     227        IEventType eventType1 = new StringEventType("eventType1"); 
     228        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     229 
     230        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     231         
     232        assertFalse(rule.isApplicable(task1, task2)); 
     233        assertFalse(rule.isApplicable(task2, task1)); 
     234    } 
     235 
     236    /** 
     237     * 
     238     */ 
     239    @Test 
     240    public void test_compare_01() { 
     241        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     242         
     243        IEventType eventType1 = new StringEventType("eventType1"); 
     244        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     245        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     246         
     247        IIteration iteration1 = createNewIteration(); 
     248         
     249        assertNullEquality(rule, iteration1, task1); 
     250    } 
     251 
     252    /** 
     253     * 
     254     */ 
     255    @Test 
     256    public void test_compare_02() { 
     257        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     258         
     259        IEventType eventType1 = new StringEventType("eventType1"); 
     260        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     261        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     262         
     263        IIteration iteration1 = createNewIteration(); 
     264        setMarkedTask(iteration1, task1); 
     265         
     266        assertLexicallyEqual(rule, task1, iteration1); 
     267    } 
     268 
     269    /** 
     270     * 
     271     */ 
     272    @Test 
     273    public void test_compare_03() { 
     274        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); 
     275         
     276        IEventType eventType1 = new StringEventType("eventType1"); 
     277        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     278        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     279         
     280        IIteration iteration1 = createNewIteration(); 
     281         
     282        ISelection selection1 = createNewSelection(); 
     283        addChild(selection1, task1); 
     284        setMarkedTask(iteration1, selection1); 
     285         
     286        assertLexicallyEqual(rule, task1, iteration1); 
    72287    } 
    73288 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRuleTest.java

    r1190 r1294  
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2424import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndSelectionComparisonRule; 
    25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2826import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3227import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3328 
     
    3530 * @author Patrick Harms 
    3631 */ 
    37 public class TaskAndSelectionComparisonRuleTest { 
    38  
    39     /** 
    40      * 
    41      */ 
    42     @Test 
    43     public void test() { 
    44         ITaskFactory taskFactory = new TaskFactory(); 
    45         ITaskBuilder treeBuilder = new TaskBuilder(); 
    46          
    47         TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
    48          
    49         IEventType eventType1 = new StringEventType("eventType1"); 
    50         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    51         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    52          
    53         assertNull(rule.compare(task1, task1)); 
    54          
    55         ISelection selection1 = taskFactory.createNewSelection(); 
    56         assertNull(rule.compare(selection1, selection1)); 
    57         assertNull(rule.compare(task1, selection1)); 
    58         assertNull(rule.compare(selection1, task1)); 
    59  
    60         treeBuilder.addChild(selection1, task1); 
    61          
    62         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1)); 
    63         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1)); 
    64          
    65         selection1 = taskFactory.createNewSelection(); 
    66         ISelection selection2 = taskFactory.createNewSelection(); 
    67         treeBuilder.addChild(selection2, task1); 
    68         treeBuilder.addChild(selection1, selection2); 
    69          
    70         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1)); 
    71         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1)); 
     32public class TaskAndSelectionComparisonRuleTest extends AbstractComparisonRuleTest { 
     33 
     34    /** 
     35     * 
     36     */ 
     37    @Test 
     38    public void test_isApplicable_01() { 
     39        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     40         
     41        ITask task1 = createNewSequence(); 
     42         
     43        assertFalse(rule.isApplicable(task1, task1)); 
     44    } 
     45 
     46    /** 
     47     * 
     48     */ 
     49    @Test 
     50    public void test_isApplicable_02() { 
     51        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     52         
     53        ITask task1 = createNewSelection(); 
     54         
     55        assertFalse(rule.isApplicable(task1, task1)); 
     56    } 
     57 
     58    /** 
     59     * 
     60     */ 
     61    @Test 
     62    public void test_isApplicable_03() { 
     63        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     64         
     65        ITask task1 = createNewIteration(); 
     66         
     67        assertFalse(rule.isApplicable(task1, task1)); 
     68    } 
     69 
     70    /** 
     71     * 
     72     */ 
     73    @Test 
     74    public void test_isApplicable_04() { 
     75        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     76         
     77        ITask task1 = createNewOptional(); 
     78         
     79        assertFalse(rule.isApplicable(task1, task1)); 
     80    } 
     81 
     82    /** 
     83     * 
     84     */ 
     85    @Test 
     86    public void test_isApplicable_05() { 
     87        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     88         
     89        IEventType eventType1 = new StringEventType("eventType1"); 
     90        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     91 
     92        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     93         
     94        assertFalse(rule.isApplicable(task1, task1)); 
     95    } 
     96 
     97    /** 
     98     * 
     99     */ 
     100    @Test 
     101    public void test_isApplicable_06() { 
     102        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     103 
     104        ITask task1 = createNewSelection(); 
     105        ITask task2 = createNewSequence(); 
     106         
     107        assertTrue(rule.isApplicable(task1, task2)); 
     108        assertTrue(rule.isApplicable(task2, task1)); 
     109    } 
     110 
     111    /** 
     112     * 
     113     */ 
     114    @Test 
     115    public void test_isApplicable_07() { 
     116        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     117 
     118        ITask task1 = createNewSelection(); 
     119        ITask task2 = createNewIteration(); 
     120         
     121        assertTrue(rule.isApplicable(task1, task2)); 
     122        assertTrue(rule.isApplicable(task2, task1)); 
     123    } 
     124 
     125    /** 
     126     * 
     127     */ 
     128    @Test 
     129    public void test_isApplicable_08() { 
     130        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     131 
     132        ITask task1 = createNewSelection(); 
     133        ITask task2 = createNewOptional(); 
     134         
     135        assertTrue(rule.isApplicable(task1, task2)); 
     136        assertTrue(rule.isApplicable(task2, task1)); 
     137    } 
     138 
     139    /** 
     140     * 
     141     */ 
     142    @Test 
     143    public void test_isApplicable_09() { 
     144        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     145 
     146        ITask task1 = createNewSelection(); 
     147         
     148        IEventType eventType1 = new StringEventType("eventType1"); 
     149        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     150 
     151        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     152         
     153        assertTrue(rule.isApplicable(task1, task2)); 
     154        assertTrue(rule.isApplicable(task2, task1)); 
     155    } 
     156 
     157    /** 
     158     * 
     159     */ 
     160    @Test 
     161    public void test_isApplicable_10() { 
     162        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     163 
     164        ITask task1 = createNewSequence(); 
     165        ITask task2 = createNewIteration(); 
     166         
     167        assertFalse(rule.isApplicable(task1, task2)); 
     168        assertFalse(rule.isApplicable(task2, task1)); 
     169    } 
     170 
     171    /** 
     172     * 
     173     */ 
     174    @Test 
     175    public void test_isApplicable_11() { 
     176        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     177 
     178        ITask task1 = createNewSequence(); 
     179        ITask task2 = createNewOptional(); 
     180         
     181        assertFalse(rule.isApplicable(task1, task2)); 
     182        assertFalse(rule.isApplicable(task2, task1)); 
     183    } 
     184 
     185    /** 
     186     * 
     187     */ 
     188    @Test 
     189    public void test_isApplicable_12() { 
     190        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     191 
     192        ITask task1 = createNewSequence(); 
     193         
     194        IEventType eventType1 = new StringEventType("eventType1"); 
     195        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     196 
     197        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     198         
     199        assertFalse(rule.isApplicable(task1, task2)); 
     200        assertFalse(rule.isApplicable(task2, task1)); 
     201    } 
     202 
     203    /** 
     204     * 
     205     */ 
     206    @Test 
     207    public void test_isApplicable_13() { 
     208        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     209 
     210        ITask task1 = createNewIteration(); 
     211        ITask task2 = createNewOptional(); 
     212         
     213        assertFalse(rule.isApplicable(task1, task2)); 
     214        assertFalse(rule.isApplicable(task2, task1)); 
     215    } 
     216 
     217    /** 
     218     * 
     219     */ 
     220    @Test 
     221    public void test_isApplicable_14() { 
     222        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     223 
     224        ITask task1 = createNewIteration(); 
     225         
     226        IEventType eventType1 = new StringEventType("eventType1"); 
     227        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     228 
     229        ITask task2 = createNewEventTask(eventType1, eventTarget1); 
     230         
     231        assertFalse(rule.isApplicable(task1, task2)); 
     232        assertFalse(rule.isApplicable(task2, task1)); 
     233    } 
     234 
     235    /** 
     236     * 
     237     */ 
     238    @Test 
     239    public void test_compare_01() { 
     240        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     241         
     242        IEventType eventType1 = new StringEventType("eventType1"); 
     243        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     244        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     245         
     246        ISelection selection1 = createNewSelection(); 
     247         
     248        assertNullEquality(rule, task1, selection1); 
     249    } 
     250 
     251    /** 
     252     * 
     253     */ 
     254    @Test 
     255    public void test_compare_02() { 
     256        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
     257         
     258        IEventType eventType1 = new StringEventType("eventType1"); 
     259        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
     260        ITask task1 = createNewEventTask(eventType1, eventTarget1); 
     261         
     262        ISelection selection1 = createNewSelection(); 
     263        addChild(selection1, task1); 
     264         
     265        assertLexicallyEqual(rule, task1, selection1); 
    72266    } 
    73267 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java

    r1281 r1294  
    3333import de.ugoe.cs.autoquest.tasktrees.TaskTreeValidator; 
    3434import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     35import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3536import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 
    3637import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    7475     * 
    7576     */ 
    76     protected void applyRule(Class<? extends ITaskInstanceListScopeRule> ruleClass, 
    77                              String                                      inputSpec, 
    78                              String                                      expectedOutputSpec) 
     77    protected void applyRule(Class<? extends ITaskInstanceScopeRule> ruleClass, 
     78                             String                                  inputSpec, 
     79                             String                                  expectedOutputSpec) 
    7980    { 
    80         ITaskInstanceListScopeRule rule = null; 
     81        ITaskInstanceScopeRule rule = null; 
    8182         
    8283        CONSTRUCTOR_ITERATION: 
     
    100101             
    101102            try { 
    102                 rule = (ITaskInstanceListScopeRule) constructor.newInstance(parameters.toArray()); 
     103                rule = (ITaskInstanceScopeRule) constructor.newInstance(parameters.toArray()); 
    103104            } 
    104105            catch (IllegalArgumentException e) { 
     
    127128        RuleApplicationStatus status; 
    128129         
    129         ITaskInstanceList inputList = decoder.decode(inputSpec); 
    130          
    131         Stack<ITaskInstanceList> toBeAppliedOn = new Stack<ITaskInstanceList>(); 
     130        ITaskInstance inputList = (ITaskInstance) decoder.decode(inputSpec); 
     131         
     132        Stack<ITaskInstance> toBeAppliedOn = new Stack<ITaskInstance>(); 
    132133        toBeAppliedOn.push(inputList); 
    133134         
     
    156157        while ((!toBeAppliedOn.isEmpty()) || (status == RuleApplicationStatus.FINISHED)); 
    157158 
    158         ITaskInstanceList expectedList = decoder.decode(expectedOutputSpec); 
    159          
    160         new TaskTreeChecker().assertTaskInstanceListsEqual(expectedList, inputList); 
     159        ITaskInstance expectedList = (ITaskInstance) decoder.decode(expectedOutputSpec); 
     160         
     161        new TaskTreeChecker().assertTaskInstancesEqual(expectedList, inputList); 
    161162    } 
    162163 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceTrieTest.java

    r1285 r1294  
    15101510        int order = 3; 
    15111511         
    1512         TaskInstanceTrieTester tester = new TaskInstanceTrieTester(1000, 1000000, order); 
    1513  
    1514         long start = System.currentTimeMillis(); 
    1515         fixture.trainSessions(Arrays.asList(tester.userSession), order); 
    1516         System.out.println("testing session with 1000000 task instances and 1000 symbols took " + 
     1512        TaskInstanceTrieTester tester = new TaskInstanceTrieTester(1000, 100000, order); 
     1513 
     1514        long start = System.currentTimeMillis(); 
     1515        fixture.trainSessions(Arrays.asList(tester.userSession), order); 
     1516        System.out.println("testing session with 100000 task instances and 1000 symbols took " + 
    15171517                           (System.currentTimeMillis() - start) + "ms"); 
    15181518         
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolBucketedMapTest.java

    r1285 r1294  
    2828import org.junit.Test; 
    2929 
     30import de.ugoe.cs.autoquest.eventcore.Event; 
    3031import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     33import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    3134import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3235import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     
    6063    @Test 
    6164    public void testSymbolMap_1() { 
    62         SymbolMap<ITaskInstance, String> symbolMap = 
    63             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     65        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     66            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    6467         
    6568        assertNotNull(symbolMap); 
     
    6972    @Test 
    7073    public void testSymbolMap_2() { 
    71         TaskSymbolBucketedMap<String> symbolMap1 = 
    72             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     74        TaskSymbolBucketedMap<String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     75            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    7376         
    7477        ITaskInstance taskInstance = createTaskInstance("symbol"); 
     
    8992    @Test 
    9093    public void testAddSymbol_1() { 
    91         SymbolMap<ITaskInstance, String> symbolMap = 
    92             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     94        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     95            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    9396             
    9497        ITaskInstance taskInstance = createTaskInstance("symbol"); 
     
    102105    @Test 
    103106    public void testAddSymbol_2() { 
    104         SymbolMap<ITaskInstance, String> symbolMap = 
    105             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     107        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     108            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    106109         
    107110        int entryCount = 2000; 
     
    122125    @Test 
    123126    public void testAddSymbol_3() { 
    124         SymbolMap<ITaskInstance, String> symbolMap = 
    125             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     127        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     128            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    126129         
    127130        int entryCount = 2000; 
     
    148151    @Test(expected = java.lang.IllegalArgumentException.class) 
    149152    public void testAddSymbol_4() { 
    150         SymbolMap<ITaskInstance, String> symbolMap = 
    151             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     153        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     154            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    152155             
    153156        symbolMap.addSymbol(null, null); 
     
    156159    @Test 
    157160    public void testSize_1() { 
    158         SymbolMap<ITaskInstance, String> symbolMap = 
    159             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     161        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     162            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    160163             
    161164        assertEquals(0, symbolMap.size()); 
     
    164167    @Test 
    165168    public void testSize_2() { 
    166         SymbolMap<ITaskInstance, String> symbolMap = 
    167             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     169        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     170            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    168171             
    169172        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    174177    @Test 
    175178    public void testSize_3() { 
    176         SymbolMap<ITaskInstance, String> symbolMap = 
    177             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     179        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     180            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    178181         
    179182        int entryCount = 2000; 
     
    188191    @Test 
    189192    public void testSize_4() { 
    190         SymbolMap<ITaskInstance, String> symbolMap = 
    191             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     193        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     194            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    192195         
    193196        int entryCount = 2000; 
     
    207210    @Test 
    208211    public void testSize_5() { 
    209         SymbolMap<ITaskInstance, String> symbolMap = 
    210             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     212        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     213            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    211214         
    212215        int entryCount = 2000; 
     
    225228    @Test 
    226229    public void testIsEmpty_1() { 
    227         SymbolMap<ITaskInstance, String> symbolMap = 
    228             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     230        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     231            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    229232             
    230233        assertTrue(symbolMap.isEmpty()); 
     
    233236    @Test 
    234237    public void testIsEmpty_2() { 
    235         SymbolMap<ITaskInstance, String> symbolMap = 
    236             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     238        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     239            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    237240             
    238241        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    243246    @Test 
    244247    public void testIsEmpty_3() { 
    245         SymbolMap<ITaskInstance, String> symbolMap = 
    246             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     248        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     249            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    247250         
    248251        int entryCount = 2000; 
     
    257260    @Test 
    258261    public void testIsEmpty_4() { 
    259         SymbolMap<ITaskInstance, String> symbolMap = 
    260             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     262        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     263            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    261264         
    262265        int entryCount = 2000; 
     
    276279    @Test 
    277280    public void testIsEmpty_5() { 
    278         SymbolMap<ITaskInstance, String> symbolMap = 
    279             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     281        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     282            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    280283         
    281284        int entryCount = 2000; 
     
    294297    @Test 
    295298    public void testContainsSymbol_1() { 
    296         SymbolMap<ITaskInstance, String> symbolMap = 
    297             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     299        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     300            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    298301             
    299302        assertFalse(symbolMap.containsSymbol(createTaskInstance("symbol"))); 
     
    302305    @Test 
    303306    public void testContainsSymbol_2() { 
    304         SymbolMap<ITaskInstance, String> symbolMap = 
    305             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     307        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     308            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    306309             
    307310        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    312315    @Test 
    313316    public void testContainsSymbol_3() { 
    314         SymbolMap<ITaskInstance, String> symbolMap = 
    315             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     317        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     318            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    316319         
    317320        int entryCount = 2000; 
     
    328331    @Test 
    329332    public void testContainsSymbol_4() { 
    330         SymbolMap<ITaskInstance, String> symbolMap = 
    331             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     333        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     334            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    332335         
    333336        int entryCount = 2000; 
     
    349352    @Test 
    350353    public void testContainsSymbol_5() { 
    351         SymbolMap<ITaskInstance, String> symbolMap = 
    352             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     354        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     355            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    353356         
    354357        int entryCount = 2000; 
     
    377380    @Test(expected = java.lang.IllegalArgumentException.class) 
    378381    public void testContainsSymbol_6() { 
    379         SymbolMap<ITaskInstance, String> symbolMap = 
    380             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     382        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     383            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    381384             
    382385        symbolMap.containsSymbol(null); 
     
    385388    @Test 
    386389    public void testGetValue_1() { 
    387         SymbolMap<ITaskInstance, String> symbolMap = 
    388             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     390        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     391            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    389392             
    390393        assertNull(symbolMap.getValue(createTaskInstance("symbol"))); 
     
    393396    @Test 
    394397    public void testGetValue_2() { 
    395         SymbolMap<ITaskInstance, String> symbolMap = 
    396             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     398        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     399            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    397400             
    398401        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    403406    @Test 
    404407    public void testGetValue_3() { 
    405         SymbolMap<ITaskInstance, String> symbolMap = 
    406             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     408        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     409            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    407410             
    408411        symbolMap.addSymbol(createTaskInstance("symbol1"), null); 
     
    413416    @Test 
    414417    public void testGetValue_4() { 
    415         SymbolMap<ITaskInstance, String> symbolMap = 
    416             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     418        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     419            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    417420         
    418421        int entryCount = 2000; 
     
    429432    @Test 
    430433    public void testGetValue_5() { 
    431         SymbolMap<ITaskInstance, String> symbolMap = 
    432             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     434        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     435            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    433436         
    434437        int entryCount = 2000; 
     
    455458    @Test 
    456459    public void testGetValue_6() { 
    457         SymbolMap<ITaskInstance, String> symbolMap = 
    458             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     460        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     461            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    459462         
    460463        int entryCount = 2000; 
     
    483486    @Test(expected = java.lang.IllegalArgumentException.class) 
    484487    public void testGetValue_7() { 
    485         SymbolMap<ITaskInstance, String> symbolMap = 
    486             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     488        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     489            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    487490             
    488491        symbolMap.getValue(null); 
     
    491494    @Test 
    492495    public void testRemoveSymbol_1() { 
    493         SymbolMap<ITaskInstance, String> symbolMap = 
    494             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     496        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     497            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    495498             
    496499        assertNull(symbolMap.removeSymbol(createTaskInstance("symbol"))); 
     
    499502    @Test 
    500503    public void testRemoveSymbol_2() { 
    501         SymbolMap<ITaskInstance, String> symbolMap = 
    502             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     504        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     505            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    503506             
    504507        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    510513    @Test 
    511514    public void testRemoveSymbol_3() { 
    512         SymbolMap<ITaskInstance, String> symbolMap = 
    513             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     515        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     516            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    514517             
    515518        symbolMap.addSymbol(createTaskInstance("symbol1"), null); 
     
    521524    @Test 
    522525    public void testRemoveSymbol_4() { 
    523         SymbolMap<ITaskInstance, String> symbolMap = 
    524             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     526        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     527            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    525528         
    526529        int entryCount = 2000; 
     
    539542    @Test 
    540543    public void testRemoveSymbol_5() { 
    541         SymbolMap<ITaskInstance, String> symbolMap = 
    542             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     544        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     545            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    543546         
    544547        int entryCount = 2000; 
     
    567570    @Test 
    568571    public void testRemoveSymbol_6() { 
    569         SymbolMap<ITaskInstance, String> symbolMap = 
    570             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     572        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     573            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    571574         
    572575        int entryCount = 2000; 
     
    597600    @Test(expected = java.lang.IllegalArgumentException.class) 
    598601    public void testRemoveSymbol_7() { 
    599         SymbolMap<ITaskInstance, String> symbolMap = 
    600             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     602        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     603            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    601604             
    602605        symbolMap.removeSymbol(null); 
     
    605608    @Test 
    606609    public void testGetSymbols_1() { 
    607         SymbolMap<ITaskInstance, String> symbolMap = 
    608             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     610        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     611            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    609612             
    610613        assertNotNull(symbolMap.getSymbols()); 
     
    614617    @Test 
    615618    public void testGetSymbols_2() { 
    616         SymbolMap<ITaskInstance, String> symbolMap = 
    617             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     619        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     620            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    618621          
    619622        ITaskInstance task = createTaskInstance("symbol1"); 
     
    627630    @Test 
    628631    public void testGetSymbols_3() { 
    629         SymbolMap<ITaskInstance, String> symbolMap = 
    630             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     632        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     633            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    631634             
    632635        ITaskInstance task = createTaskInstance("symbol1"); 
     
    640643    @Test 
    641644    public void testGetSymbols_4() { 
    642         SymbolMap<ITaskInstance, String> symbolMap = 
    643             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     645        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     646            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    644647        Set<ITaskInstance> expectedSymbols = new HashSet<ITaskInstance>(); 
    645648         
     
    667670    @Test 
    668671    public void testGetSymbols_5() { 
    669         SymbolMap<ITaskInstance, String> symbolMap = 
    670             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     672        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     673            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    671674        Set<ITaskInstance> expectedSymbols = new HashSet<ITaskInstance>(); 
    672675         
     
    701704    @Test 
    702705    public void testGetSymbols_6() { 
    703         SymbolMap<ITaskInstance, String> symbolMap = 
    704             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     706        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     707            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    705708        List<ITaskInstance> expectedSymbols = new ArrayList<ITaskInstance>(); 
    706709         
     
    732735    @Test 
    733736    public void testGetValues_1() { 
    734         SymbolMap<ITaskInstance, String> symbolMap = 
    735             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     737        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     738            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    736739             
    737740        assertNotNull(symbolMap.getValues()); 
     
    741744    @Test 
    742745    public void testGetValues_2() { 
    743         SymbolMap<ITaskInstance, String> symbolMap = 
    744             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     746        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     747            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    745748             
    746749        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    753756    @Test 
    754757    public void testGetValues_3() { 
    755         SymbolMap<ITaskInstance, String> symbolMap = 
    756             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     758        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     759            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    757760             
    758761        symbolMap.addSymbol(createTaskInstance("symbol1"), null); 
     
    765768    @Test 
    766769    public void testGetValues_4() { 
    767         SymbolMap<ITaskInstance, String> symbolMap = 
    768             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     770        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     771            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    769772        Set<String> expectedValues = new HashSet<String>(); 
    770773         
     
    791794    @Test 
    792795    public void testGetValues_5() { 
    793         SymbolMap<ITaskInstance, String> symbolMap = 
    794             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     796        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     797            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    795798        Set<String> expectedValues = new HashSet<String>(); 
    796799         
     
    823826    @Test 
    824827    public void testGetValues_6() { 
    825         SymbolMap<ITaskInstance, String> symbolMap = 
    826             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     828        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     829            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    827830        Set<String> expectedValues = new HashSet<String>(); 
    828831         
     
    854857    @Test 
    855858    public void testClear_1() { 
    856         SymbolMap<ITaskInstance, String> symbolMap = 
    857             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     859        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     860            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    858861         
    859862        symbolMap.clear(); 
     
    863866    @Test 
    864867    public void testClear_2() { 
    865         SymbolMap<ITaskInstance, String> symbolMap = 
    866             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     868        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     869            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    867870             
    868871        symbolMap.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    874877    @Test 
    875878    public void testClear_3() { 
    876         SymbolMap<ITaskInstance, String> symbolMap = 
    877             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     879        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     880            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    878881             
    879882        symbolMap.addSymbol(createTaskInstance("symbol1"), null); 
     
    885888    @Test 
    886889    public void testClear_4() { 
    887         SymbolMap<ITaskInstance, String> symbolMap = 
    888             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     890        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     891            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    889892         
    890893        int entryCount = 2000; 
     
    900903    @Test 
    901904    public void testClear_5() { 
    902         SymbolMap<ITaskInstance, String> symbolMap = 
    903             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     905        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     906            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    904907         
    905908        int entryCount = 2000; 
     
    920923    @Test 
    921924    public void testClear_6() { 
    922         SymbolMap<ITaskInstance, String> symbolMap = 
    923             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     925        SymbolMap<ITaskInstance, String> symbolMap = new TaskSymbolBucketedMap<String> 
     926            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    924927         
    925928        int entryCount = 2000; 
     
    939942    @Test 
    940943    public void testEquals_1() { 
    941         SymbolMap<ITaskInstance, String> symbolMap1 = 
    942             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    943          
    944         SymbolMap<ITaskInstance, String> symbolMap2 = 
    945             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     944        SymbolMap<ITaskInstance, String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     945            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     946         
     947        SymbolMap<ITaskInstance, String> symbolMap2 = new TaskSymbolBucketedMap<String> 
     948            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    946949         
    947950        assertTrue(symbolMap1.equals(symbolMap2)); 
     
    950953    @Test 
    951954    public void testEquals_2() { 
    952         SymbolMap<ITaskInstance, String> symbolMap1 = 
    953             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    954              
    955         SymbolMap<ITaskInstance, String> symbolMap2 = 
    956             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     955        SymbolMap<ITaskInstance, String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     956            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     957             
     958        SymbolMap<ITaskInstance, String> symbolMap2 = new TaskSymbolBucketedMap<String> 
     959            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    957960             
    958961        symbolMap1.addSymbol(createTaskInstance("symbol1"), "value1"); 
     
    963966    @Test 
    964967    public void testEquals_3() { 
    965         SymbolMap<ITaskInstance, String> symbolMap1 = 
    966             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    967              
    968         SymbolMap<ITaskInstance, String> symbolMap2 = 
    969             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     968        SymbolMap<ITaskInstance, String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     969            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     970             
     971        SymbolMap<ITaskInstance, String> symbolMap2 = new TaskSymbolBucketedMap<String> 
     972            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    970973         
    971974        ITaskInstance task = createTaskInstance("symbol1"); 
     
    978981    @Test 
    979982    public void testEquals_4() { 
    980         SymbolMap<ITaskInstance, String> symbolMap1 = 
    981             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     983        SymbolMap<ITaskInstance, String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     984            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    982985                 
    983         SymbolMap<ITaskInstance, String> symbolMap2 = 
    984             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     986        SymbolMap<ITaskInstance, String> symbolMap2 = new TaskSymbolBucketedMap<String> 
     987            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    985988         
    986989        int entryCount = 1000; 
     
    9971000    @Test 
    9981001    public void testEquals_5() { 
    999         SymbolMap<ITaskInstance, String> symbolMap1 = 
    1000             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     1002        SymbolMap<ITaskInstance, String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     1003            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    10011004                
    1002         SymbolMap<ITaskInstance, String> symbolMap2 = 
    1003             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     1005        SymbolMap<ITaskInstance, String> symbolMap2 = new TaskSymbolBucketedMap<String> 
     1006            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    10041007         
    10051008        int entryCount = 1000; 
     
    10241027    @Test 
    10251028    public void testEquals_6() { 
    1026         SymbolMap<ITaskInstance, String> symbolMap1 = 
    1027             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     1029        SymbolMap<ITaskInstance, String> symbolMap1 = new TaskSymbolBucketedMap<String> 
     1030            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    10281031                 
    1029         SymbolMap<ITaskInstance, String> symbolMap2 = 
    1030             new TaskSymbolBucketedMap<String>(new TaskComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
     1032        SymbolMap<ITaskInstance, String> symbolMap2 = new TaskSymbolBucketedMap<String> 
     1033            (new TaskInstanceComparator(TaskEquality.SEMANTICALLY_EQUAL)); 
    10311034         
    10321035        int entryCount = 1000; 
     
    10521055     
    10531056    /** 
    1054      * <p> 
    1055      * TODO: comment 
    1056      * </p> 
    10571057     * 
    1058      * @param string 
    1059      * @return 
    10601058     */ 
    10611059    private ITaskInstance createTaskInstance(String id) { 
    10621060        ITask task = tasks.get(id); 
    1063          
     1061        Event event = null; 
     1062        
    10641063        if (task == null) { 
    1065             task = taskFactory.createNewEventTask 
    1066                 (new DummyInteraction(id, 0), new DummyGUIElement("default")); 
    1067              
     1064            event = new Event(new DummyInteraction(id, 0), new DummyGUIElement("default")); 
     1065            task = taskFactory.createNewEventTask(event.toString()); 
     1066            
    10681067            tasks.put(id, task); 
    10691068        } 
    1070          
    1071         return taskFactory.createNewTaskInstance(task); 
     1069        else { 
     1070            event = ((IEventTaskInstance) task.getInstances().iterator().next()).getEvent(); 
     1071        } 
     1072        
     1073        return taskFactory.createNewTaskInstance((IEventTask) task, event); 
    10721074    } 
    10731075 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolIdentityMapTest.java

    r1285 r1294  
    2828import org.junit.Test; 
    2929 
     30import de.ugoe.cs.autoquest.eventcore.Event; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3134import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     
    10541057                           " took " + (System.currentTimeMillis() - start)); 
    10551058    } 
     1059     
    10561060    /** 
    1057      * <p> 
    1058      * TODO: comment 
    1059      * </p> 
    10601061     * 
    1061      * @param string 
    1062      * @return 
    10631062     */ 
    10641063    private ITaskInstance createTaskInstance(String id) { 
    10651064        ITask task = tasks.get(id); 
     1065        Event event = null; 
    10661066         
    10671067        if (task == null) { 
    1068             task = taskFactory.createNewEventTask 
    1069                 (new DummyInteraction(id, 0), new DummyGUIElement("default")); 
     1068            event = new Event(new DummyInteraction(id, 0), new DummyGUIElement("default")); 
     1069            task = taskFactory.createNewEventTask(event.toString()); 
    10701070             
    10711071            tasks.put(id, task); 
    10721072        } 
    1073          
    1074         return taskFactory.createNewTaskInstance(task); 
     1073        else { 
     1074            event = ((IEventTaskInstance) task.getInstances().iterator().next()).getEvent(); 
     1075        } 
     1076         
     1077        return taskFactory.createNewTaskInstance((IEventTask) task, event); 
    10751078    } 
    10761079 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModelTest.java

    r1146 r1294  
    2424import org.junit.Test; 
    2525 
     26import de.ugoe.cs.autoquest.eventcore.Event; 
    2627import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    2728import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2829import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2931import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3135import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     36import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3237import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     38import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    3339import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3440import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     
    4551 
    4652/** 
    47  * TODO comment 
    48  *  
    49  * @version $Revision: $ $Date: 02.04.2012$ 
    50  * @author 2012, last modified by $Author: patrick$ 
     53 * 
    5154 */ 
    5255public class TaskModelTest { 
     
    6972        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    7073         
    71         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     74        IEventTask task = createNewEventTask(eventType, eventTarget); 
    7275         
    7376        assertNotNull(task); 
     
    7679        assertTrue(task.equals(task)); 
    7780         
    78         assertEquals(eventType, task.getEventType()); 
    79         assertEquals(eventTarget, task.getEventTarget()); 
     81        IEventTaskInstance instance = (IEventTaskInstance) task.getInstances().iterator().next(); 
     82        assertEquals(eventType, instance.getEvent().getType()); 
     83        assertEquals(eventTarget, instance.getEvent().getTarget()); 
    8084    } 
    8185 
     
    8892        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    8993         
    90         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    91         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     94        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     95        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
    9296         
    9397        // the tasks will not be equal as they should have a different id 
     
    103107        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    104108         
    105         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
    106         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task); 
    107         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task); 
     109        IEventTask task = createNewEventTask(eventType, eventTarget); 
     110        ITaskInstance taskInstance1 = createNewTaskInstance(task); 
     111        ITaskInstance taskInstance2 = createNewTaskInstance(task); 
    108112         
    109113        assertFalse(taskInstance1.equals(taskInstance2)); 
     
    133137        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    134138         
    135         IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 
     139        IEventTask child = createNewEventTask(eventType, eventTarget); 
    136140 
    137141        ISequence task = taskFactory.createNewSequence(); 
     
    152156        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    153157         
    154         IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    155         IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 
    156         IEventTask child3 = taskFactory.createNewEventTask(eventType, eventTarget); 
    157         IEventTask child4 = taskFactory.createNewEventTask(eventType, eventTarget); 
    158         IEventTask child5 = taskFactory.createNewEventTask(eventType, eventTarget); 
     158        IEventTask child1 = createNewEventTask(eventType, eventTarget); 
     159        IEventTask child2 = createNewEventTask(eventType, eventTarget); 
     160        IEventTask child3 = createNewEventTask(eventType, eventTarget); 
     161        IEventTask child4 = createNewEventTask(eventType, eventTarget); 
     162        IEventTask child5 = createNewEventTask(eventType, eventTarget); 
    159163 
    160164        ISequence task = taskFactory.createNewSequence(); 
     
    198202        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    199203         
    200         IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 
     204        IEventTask child = createNewEventTask(eventType, eventTarget); 
    201205 
    202206        ISelection task = taskFactory.createNewSelection(); 
     
    217221        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    218222         
    219         IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    220         IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 
    221         IEventTask child3 = taskFactory.createNewEventTask(eventType, eventTarget); 
    222         IEventTask child4 = taskFactory.createNewEventTask(eventType, eventTarget); 
    223         IEventTask child5 = taskFactory.createNewEventTask(eventType, eventTarget); 
     223        IEventTask child1 = createNewEventTask(eventType, eventTarget); 
     224        IEventTask child2 = createNewEventTask(eventType, eventTarget); 
     225        IEventTask child3 = createNewEventTask(eventType, eventTarget); 
     226        IEventTask child4 = createNewEventTask(eventType, eventTarget); 
     227        IEventTask child5 = createNewEventTask(eventType, eventTarget); 
    224228 
    225229        ISelection task = taskFactory.createNewSelection(); 
     
    262266        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    263267         
    264         IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 
     268        IEventTask child = createNewEventTask(eventType, eventTarget); 
    265269 
    266270        IIteration task = taskFactory.createNewIteration(); 
     
    279283        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    280284         
    281         IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    282         IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     285        IEventTask child1 = createNewEventTask(eventType, eventTarget); 
     286        IEventTask child2 = createNewEventTask(eventType, eventTarget); 
    283287 
    284288        IIteration task = taskFactory.createNewIteration(); 
     
    312316        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    313317         
    314         IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 
     318        IEventTask child = createNewEventTask(eventType, eventTarget); 
    315319 
    316320        IOptional task = taskFactory.createNewOptional(); 
     
    329333        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    330334         
    331         IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    332         IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     335        IEventTask child1 = createNewEventTask(eventType, eventTarget); 
     336        IEventTask child2 = createNewEventTask(eventType, eventTarget); 
    333337 
    334338        IOptional task = taskFactory.createNewOptional(); 
     
    348352        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    349353         
    350         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
    351          
    352         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
     354        IEventTask task = createNewEventTask(eventType, eventTarget); 
     355         
     356        IEventTaskInstance taskInstance = createNewTaskInstance(task); 
    353357         
    354358        assertNotNull(taskInstance); 
     
    356360        assertTrue(taskInstance.equals(taskInstance)); 
    357361        assertFalse(taskInstance.equals(task)); 
    358         assertNotNull(taskInstance.getChildren()); 
    359         assertEquals(0, taskInstance.getChildren().size()); 
    360362    } 
    361363 
     
    368370        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    369371         
    370         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
    371          
    372         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task); 
    373         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task); 
     372        IEventTask task = createNewEventTask(eventType, eventTarget); 
     373         
     374        ITaskInstance taskInstance1 = createNewTaskInstance(task); 
     375        ITaskInstance taskInstance2 = createNewTaskInstance(task); 
    374376         
    375377        assertFalse(taskInstance1.equals(taskInstance2)); 
    376     } 
    377  
    378     /** 
    379      * 
    380      */ 
    381     @Test(expected=IllegalArgumentException.class) 
    382     public void test_EventTaskInstance_03() throws Exception { 
    383         IEventType eventType = new DummyInteraction("interaction", 1); 
    384         IEventTarget eventTarget = new DummyGUIElement("elem"); 
    385          
    386         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
    387          
    388         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task); 
    389         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task); 
    390          
    391         taskBuilder.addChild(taskInstance1, taskInstance2); 
    392378    } 
    393379 
     
    400386        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    401387         
    402         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     388        IEventTask task = createNewEventTask(eventType, eventTarget); 
    403389         
    404390        ISequence sequence = taskFactory.createNewSequence(); 
    405391         
    406         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    407         ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 
     392        ITaskInstance taskInstance = createNewTaskInstance(task); 
     393        ISequenceInstance sequenceInstance = createNewTaskInstance(sequence); 
    408394         
    409395        taskBuilder.addChild(sequenceInstance, taskInstance); 
     
    418404        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    419405         
    420         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     406        IEventTask task = createNewEventTask(eventType, eventTarget); 
    421407         
    422408        ISequence sequence = taskFactory.createNewSequence(); 
    423409        taskBuilder.addChild(sequence, task); 
    424410         
    425         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    426         ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 
     411        ITaskInstance taskInstance = createNewTaskInstance(task); 
     412        ISequenceInstance sequenceInstance = createNewTaskInstance(sequence); 
    427413         
    428414        taskBuilder.addChild(sequenceInstance, taskInstance); 
    429415         
    430         assertNotNull(sequenceInstance.getChildren()); 
    431         assertEquals(1, sequenceInstance.getChildren().size()); 
    432         assertEquals(taskInstance, sequenceInstance.getChildren().get(0)); 
     416        assertEquals(1, sequenceInstance.size()); 
     417        assertEquals(taskInstance, sequenceInstance.get(0)); 
    433418    } 
    434419 
     
    441426        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    442427         
    443         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    444         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
    445         IEventTask task3 = taskFactory.createNewEventTask(eventType, eventTarget); 
    446         IEventTask task4 = taskFactory.createNewEventTask(eventType, eventTarget); 
    447         IEventTask task5 = taskFactory.createNewEventTask(eventType, eventTarget); 
     428        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     429        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
     430        IEventTask task3 = createNewEventTask(eventType, eventTarget); 
     431        IEventTask task4 = createNewEventTask(eventType, eventTarget); 
     432        IEventTask task5 = createNewEventTask(eventType, eventTarget); 
    448433         
    449434        ISequence sequence = taskFactory.createNewSequence(); 
     
    454439        taskBuilder.addChild(sequence, task5); 
    455440         
    456         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 
    457         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 
    458         ITaskInstance taskInstance3 = taskFactory.createNewTaskInstance(task3); 
    459         ITaskInstance taskInstance4 = taskFactory.createNewTaskInstance(task4); 
    460         ITaskInstance taskInstance5 = taskFactory.createNewTaskInstance(task5); 
    461         ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 
     441        ITaskInstance taskInstance1 = createNewTaskInstance(task1); 
     442        ITaskInstance taskInstance2 = createNewTaskInstance(task2); 
     443        ITaskInstance taskInstance3 = createNewTaskInstance(task3); 
     444        ITaskInstance taskInstance4 = createNewTaskInstance(task4); 
     445        ITaskInstance taskInstance5 = createNewTaskInstance(task5); 
     446        ISequenceInstance sequenceInstance = createNewTaskInstance(sequence); 
    462447         
    463448        taskBuilder.addChild(sequenceInstance, taskInstance1); 
     
    467452        taskBuilder.addChild(sequenceInstance, taskInstance5); 
    468453         
    469         assertNotNull(sequenceInstance.getChildren()); 
    470         assertEquals(5, sequenceInstance.getChildren().size()); 
    471         assertEquals(taskInstance1, sequenceInstance.getChildren().get(0)); 
    472         assertEquals(taskInstance2, sequenceInstance.getChildren().get(1)); 
    473         assertEquals(taskInstance3, sequenceInstance.getChildren().get(2)); 
    474         assertEquals(taskInstance4, sequenceInstance.getChildren().get(3)); 
    475         assertEquals(taskInstance5, sequenceInstance.getChildren().get(4)); 
     454        assertEquals(5, sequenceInstance.size()); 
     455        assertEquals(taskInstance1, sequenceInstance.get(0)); 
     456        assertEquals(taskInstance2, sequenceInstance.get(1)); 
     457        assertEquals(taskInstance3, sequenceInstance.get(2)); 
     458        assertEquals(taskInstance4, sequenceInstance.get(3)); 
     459        assertEquals(taskInstance5, sequenceInstance.get(4)); 
    476460    } 
    477461 
     
    484468        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    485469         
    486         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     470        IEventTask task = createNewEventTask(eventType, eventTarget); 
    487471         
    488472        ISelection selection = taskFactory.createNewSelection(); 
    489473         
    490         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    491         ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 
    492          
    493         taskBuilder.addChild(selectionInstance, taskInstance); 
     474        ITaskInstance taskInstance = createNewTaskInstance(task); 
     475        ISelectionInstance selectionInstance = createNewTaskInstance(selection); 
     476         
     477        taskBuilder.setChild(selectionInstance, taskInstance); 
    494478    } 
    495479 
     
    502486        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    503487         
    504         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     488        IEventTask task = createNewEventTask(eventType, eventTarget); 
    505489         
    506490        ISelection selection = taskFactory.createNewSelection(); 
    507491        taskBuilder.addChild(selection, task); 
    508492         
    509         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    510         ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 
    511          
    512         taskBuilder.addChild(selectionInstance, taskInstance); 
    513          
    514         assertNotNull(selectionInstance.getChildren()); 
    515         assertEquals(1, selectionInstance.getChildren().size()); 
    516         assertEquals(taskInstance, selectionInstance.getChildren().get(0)); 
    517     } 
    518  
    519     /** 
    520      * 
    521      */ 
    522     @Test(expected=IllegalArgumentException.class) 
     493        ITaskInstance taskInstance = createNewTaskInstance(task); 
     494        ISelectionInstance selectionInstance = createNewTaskInstance(selection); 
     495         
     496        taskBuilder.setChild(selectionInstance, taskInstance); 
     497         
     498        assertNotNull(selectionInstance.getChild()); 
     499        assertEquals(taskInstance, selectionInstance.getChild()); 
     500    } 
     501 
     502    /** 
     503     * 
     504     */ 
     505    @Test 
    523506    public void test_SelectionInstance_03() throws Exception { 
    524507        IEventType eventType = new DummyInteraction("interaction", 1); 
    525508        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    526509         
    527         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    528         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
    529         IEventTask task3 = taskFactory.createNewEventTask(eventType, eventTarget); 
    530         IEventTask task4 = taskFactory.createNewEventTask(eventType, eventTarget); 
    531         IEventTask task5 = taskFactory.createNewEventTask(eventType, eventTarget); 
     510        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     511        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
     512        IEventTask task3 = createNewEventTask(eventType, eventTarget); 
     513        IEventTask task4 = createNewEventTask(eventType, eventTarget); 
     514        IEventTask task5 = createNewEventTask(eventType, eventTarget); 
    532515         
    533516        ISelection selection = taskFactory.createNewSelection(); 
     
    538521        taskBuilder.addChild(selection, task5); 
    539522         
    540         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 
    541         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 
    542         ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 
    543          
    544         taskBuilder.addChild(selectionInstance, taskInstance1); 
    545         taskBuilder.addChild(selectionInstance, taskInstance2); 
     523        ITaskInstance taskInstance1 = createNewTaskInstance(task1); 
     524        ITaskInstance taskInstance2 = createNewTaskInstance(task2); 
     525        ISelectionInstance selectionInstance = createNewTaskInstance(selection); 
     526         
     527        taskBuilder.setChild(selectionInstance, taskInstance1); 
     528        taskBuilder.setChild(selectionInstance, taskInstance2); 
     529         
     530        assertEquals(taskInstance2, selectionInstance.getChild()); 
    546531    } 
    547532 
     
    554539        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    555540         
    556         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     541        IEventTask task = createNewEventTask(eventType, eventTarget); 
    557542         
    558543        IIteration iteration = taskFactory.createNewIteration(); 
    559544         
    560         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    561         ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 
     545        ITaskInstance taskInstance = createNewTaskInstance(task); 
     546        IIterationInstance iterationInstance = createNewTaskInstance(iteration); 
    562547         
    563548        taskBuilder.addChild(iterationInstance, taskInstance); 
     
    572557        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    573558         
    574         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     559        IEventTask task = createNewEventTask(eventType, eventTarget); 
    575560         
    576561        IIteration iteration = taskFactory.createNewIteration(); 
    577562        taskBuilder.setMarkedTask(iteration, task); 
    578563         
    579         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    580         ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 
     564        ITaskInstance taskInstance = createNewTaskInstance(task); 
     565        IIterationInstance iterationInstance = createNewTaskInstance(iteration); 
    581566         
    582567        taskBuilder.addChild(iterationInstance, taskInstance); 
    583568         
    584         assertNotNull(iterationInstance.getChildren()); 
    585         assertEquals(1, iterationInstance.getChildren().size()); 
    586         assertEquals(taskInstance, iterationInstance.getChildren().get(0)); 
     569        assertEquals(1, iterationInstance.size()); 
     570        assertEquals(taskInstance, iterationInstance.get(0)); 
    587571    } 
    588572 
     
    595579        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    596580         
    597         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    598         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     581        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     582        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
    599583         
    600584        IIteration iteration = taskFactory.createNewIteration(); 
     
    602586        taskBuilder.setMarkedTask(iteration, task2); 
    603587         
    604         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 
    605         ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 
     588        ITaskInstance taskInstance1 = createNewTaskInstance(task1); 
     589        IIterationInstance iterationInstance = createNewTaskInstance(iteration); 
    606590         
    607591        taskBuilder.addChild(iterationInstance, taskInstance1); 
     
    616600        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    617601         
    618         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    619         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     602        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     603        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
    620604         
    621605        IIteration iteration = taskFactory.createNewIteration(); 
     
    623607        taskBuilder.setMarkedTask(iteration, task2); 
    624608         
    625         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 
    626         ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 
     609        ITaskInstance taskInstance2 = createNewTaskInstance(task2); 
     610        IIterationInstance iterationInstance = createNewTaskInstance(iteration); 
    627611         
    628612        taskBuilder.addChild(iterationInstance, taskInstance2); 
    629613         
    630         assertNotNull(iterationInstance.getChildren()); 
    631         assertEquals(1, iterationInstance.getChildren().size()); 
    632         assertEquals(taskInstance2, iterationInstance.getChildren().get(0)); 
     614        assertEquals(1, iterationInstance.size()); 
     615        assertEquals(taskInstance2, iterationInstance.get(0)); 
    633616    } 
    634617 
     
    641624        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    642625         
    643         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     626        IEventTask task = createNewEventTask(eventType, eventTarget); 
    644627         
    645628        IOptional optional = taskFactory.createNewOptional(); 
    646629         
    647         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    648         ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 
    649          
    650         taskBuilder.addChild(optionalInstance, taskInstance); 
     630        ITaskInstance taskInstance = createNewTaskInstance(task); 
     631        IOptionalInstance optionalInstance = createNewTaskInstance(optional); 
     632         
     633        taskBuilder.setChild(optionalInstance, taskInstance); 
    651634    } 
    652635 
     
    659642        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    660643         
    661         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     644        IEventTask task = createNewEventTask(eventType, eventTarget); 
    662645         
    663646        IOptional optional = taskFactory.createNewOptional(); 
    664647        taskBuilder.setMarkedTask(optional, task); 
    665648         
    666         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    667         ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 
    668          
    669         taskBuilder.addChild(optionalInstance, taskInstance); 
    670          
    671         assertNotNull(optionalInstance.getChildren()); 
    672         assertEquals(1, optionalInstance.getChildren().size()); 
    673         assertEquals(taskInstance, optionalInstance.getChildren().get(0)); 
     649        ITaskInstance taskInstance = createNewTaskInstance(task); 
     650        IOptionalInstance optionalInstance = createNewTaskInstance(optional); 
     651         
     652        taskBuilder.setChild(optionalInstance, taskInstance); 
     653         
     654        assertNotNull(optionalInstance.getChild()); 
     655        assertEquals(taskInstance, optionalInstance.getChild()); 
    674656    } 
    675657 
     
    682664        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    683665         
    684         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    685         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     666        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     667        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
    686668         
    687669        IOptional optional = taskFactory.createNewOptional(); 
     
    689671        taskBuilder.setMarkedTask(optional, task2); 
    690672         
    691         ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 
    692         ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 
    693          
    694         taskBuilder.addChild(optionalInstance, taskInstance1); 
     673        ITaskInstance taskInstance1 = createNewTaskInstance(task1); 
     674        IOptionalInstance optionalInstance = createNewTaskInstance(optional); 
     675         
     676        taskBuilder.setChild(optionalInstance, taskInstance1); 
    695677    } 
    696678 
     
    703685        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    704686         
    705         IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 
    706         IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 
     687        IEventTask task1 = createNewEventTask(eventType, eventTarget); 
     688        IEventTask task2 = createNewEventTask(eventType, eventTarget); 
    707689         
    708690        IOptional optional = taskFactory.createNewOptional(); 
     
    710692        taskBuilder.setMarkedTask(optional, task2); 
    711693         
    712         ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 
    713         ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 
    714          
    715         taskBuilder.addChild(optionalInstance, taskInstance2); 
    716          
    717         assertNotNull(optionalInstance.getChildren()); 
    718         assertEquals(1, optionalInstance.getChildren().size()); 
    719         assertEquals(taskInstance2, optionalInstance.getChildren().get(0)); 
     694        ITaskInstance taskInstance2 = createNewTaskInstance(task2); 
     695        IOptionalInstance optionalInstance = createNewTaskInstance(optional); 
     696         
     697        taskBuilder.setChild(optionalInstance, taskInstance2); 
     698         
     699        assertNotNull(optionalInstance.getChild()); 
     700        assertEquals(taskInstance2, optionalInstance.getChild()); 
    720701    } 
    721702 
     
    740721        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    741722         
    742         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     723        IEventTask task = createNewEventTask(eventType, eventTarget); 
    743724         
    744725        IUserSession userSession = taskFactory.createUserSession(); 
    745726         
    746         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
     727        ITaskInstance taskInstance = createNewTaskInstance(task); 
    747728         
    748729        taskBuilder.addExecutedTask(userSession, taskInstance); 
     
    761742        IEventTarget eventTarget = new DummyGUIElement("elem"); 
    762743         
    763         IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 
     744        IEventTask task = createNewEventTask(eventType, eventTarget); 
    764745        ISequence sequence = taskFactory.createNewSequence(); 
    765746        ISelection selection = taskFactory.createNewSelection(); 
     
    772753        taskBuilder.setMarkedTask(optional, task); 
    773754         
    774         ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 
    775         ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 
    776         ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 
    777         ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 
    778         ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 
    779          
    780         taskBuilder.addChild(sequenceInstance, taskFactory.createNewTaskInstance(task)); 
    781         taskBuilder.addChild(selectionInstance, taskFactory.createNewTaskInstance(task)); 
    782         taskBuilder.addChild(iterationInstance, taskFactory.createNewTaskInstance(task)); 
    783         taskBuilder.addChild(optionalInstance, taskFactory.createNewTaskInstance(task)); 
     755        ITaskInstance taskInstance = createNewTaskInstance(task); 
     756        ISequenceInstance sequenceInstance = createNewTaskInstance(sequence); 
     757        ISelectionInstance selectionInstance = createNewTaskInstance(selection); 
     758        IIterationInstance iterationInstance = createNewTaskInstance(iteration); 
     759        IOptionalInstance optionalInstance = createNewTaskInstance(optional); 
     760         
     761        taskBuilder.addChild(sequenceInstance, createNewTaskInstance(task)); 
     762        taskBuilder.setChild(selectionInstance, createNewTaskInstance(task)); 
     763        taskBuilder.addChild(iterationInstance, createNewTaskInstance(task)); 
     764        taskBuilder.setChild(optionalInstance, createNewTaskInstance(task)); 
    784765         
    785766        IUserSession userSession = taskFactory.createUserSession(); 
     
    823804            } 
    824805             
    825             ITaskInstance taskInstance = instantiateTask(task, noOfMaxChildren); 
     806            ISequenceInstance sequenceInstance = 
     807                (ISequenceInstance) instantiateTask(task, noOfMaxChildren); 
    826808             
    827809            System.err.println("  creating user session"); 
     
    829811            IUserSession session = taskFactory.createUserSession(); 
    830812             
    831             for (ITaskInstance child : taskInstance.getChildren()) { 
     813            for (ITaskInstance child : sequenceInstance) { 
    832814                taskBuilder.addExecutedTask(session, child); 
    833815            } 
     
    836818            sessions.add(session); 
    837819             
    838             ITaskModel taskTree = taskFactory.createTaskModel(sessions); 
     820            ITaskModel taskModel = taskFactory.createTaskModel(sessions); 
    839821 
    840822            System.err.println("  validating task tree"); 
    841823            Map<ITask, ITaskInfo> actualTaskInfos = new HashMap<ITask, ITaskInfo>(); 
    842824             
    843             for (ITask currentTask : taskTree.getTasks()) { 
    844                 actualTaskInfos.put(currentTask, taskTree.getTaskInfo(currentTask)); 
     825            for (ITask currentTask : taskModel.getTasks()) { 
     826                actualTaskInfos.put(currentTask, taskModel.getTaskInfo(currentTask)); 
    845827            } 
    846828             
     
    988970        Thread.sleep(2); 
    989971        long id = System.currentTimeMillis(); 
    990         IEventTask task = taskFactory.createNewEventTask 
     972        IEventTask task = createNewEventTask 
    991973            (new DummyInteraction("interaction" + id, 1), new DummyGUIElement("elem" + id)); 
    992974 
     
    10641046         
    10651047        for (int i = 0; i < noOfChildren; i++) { 
    1066             ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 
     1048            ITask child; 
     1049            do { 
     1050                child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 
     1051            } 
     1052            while (child instanceof ISelection); 
     1053             
    10671054            taskBuilder.addChild(selection, child); 
    10681055        } 
     
    10991086        IIteration iteration = taskFactory.createNewIteration(); 
    11001087 
    1101         ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 
     1088        ITask child; 
     1089        do { 
     1090            child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 
     1091        } 
     1092        while ((child instanceof IOptional) || (child instanceof IIteration)); 
     1093         
    11021094        taskBuilder.setMarkedTask(iteration, child); 
    11031095 
     
    11331125        IOptional optional = taskFactory.createNewOptional(); 
    11341126 
    1135         ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 
     1127        ITask child; 
     1128        do { 
     1129            child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 
     1130        } 
     1131        while (child instanceof IOptional); 
     1132         
    11361133        taskBuilder.setMarkedTask(optional, child); 
    11371134 
     
    11931190     */ 
    11941191    private ITaskInstance instantiateTask(ITask task, int maxIterationCount) throws Exception { 
    1195         ITaskInstance instance = taskFactory.createNewTaskInstance(task); 
     1192        ITaskInstance instance = createNewTaskInstance(task); 
    11961193 
    11971194        if (task instanceof ISequence) { 
    11981195            for (ITask child : ((ISequence) task).getChildren()) { 
    1199                 taskBuilder.addChild(instance, instantiateTask(child, maxIterationCount)); 
     1196                taskBuilder.addChild 
     1197                    ((ISequenceInstance) instance, instantiateTask(child, maxIterationCount)); 
    12001198            } 
    12011199        } 
     
    12031201            List<ITask> children = ((ISelection) task).getChildren(); 
    12041202            int index = randomize(children.size()); 
    1205             taskBuilder.addChild(instance, instantiateTask(children.get(index), maxIterationCount)); 
     1203            taskBuilder.setChild((ISelectionInstance) instance, 
     1204                                 instantiateTask(children.get(index),maxIterationCount)); 
    12061205        } 
    12071206        else if (task instanceof IIteration) { 
     
    12101209             
    12111210            for (int i = 0; i < count; i++) { 
    1212                 taskBuilder.addChild(instance, instantiateTask(child, maxIterationCount)); 
     1211                taskBuilder.addChild 
     1212                    ((IIterationInstance) instance, instantiateTask(child, maxIterationCount)); 
    12131213            } 
    12141214        } 
     
    12171217             
    12181218            if (randomize(1) == 0) { 
    1219                 taskBuilder.addChild(instance, instantiateTask(child, maxIterationCount)); 
     1219                taskBuilder.setChild((IOptionalInstance) instance, 
     1220                                     instantiateTask(child, maxIterationCount)); 
    12201221            } 
    12211222        } 
     
    12441245        return value + min; 
    12451246    } 
     1247     
     1248    /** 
     1249     * 
     1250     */ 
     1251    protected IEventTask createNewEventTask(IEventType eventType, IEventTarget eventTarget) { 
     1252        IEventTask eventTask = taskFactory.createNewEventTask(eventType + " --> " + eventTarget); 
     1253        taskFactory.createNewTaskInstance(eventTask, new Event(eventType, eventTarget)); 
     1254        return eventTask; 
     1255    } 
     1256 
     1257    /** 
     1258     * 
     1259     */ 
     1260    private ITaskInstance createNewTaskInstance(ITask task) { 
     1261        if (task instanceof IEventTask) { 
     1262            return createNewTaskInstance((IEventTask) task); 
     1263        } 
     1264        else if (task instanceof ISequence) { 
     1265            return createNewTaskInstance((ISequence) task); 
     1266        } 
     1267        else if (task instanceof ISelection) { 
     1268            return createNewTaskInstance((ISelection) task); 
     1269        } 
     1270        else if (task instanceof IIteration) { 
     1271            return createNewTaskInstance((IIteration) task); 
     1272        } 
     1273        else if (task instanceof IOptional) { 
     1274            return createNewTaskInstance((IOptional) task); 
     1275        } 
     1276         
     1277        throw new IllegalArgumentException("unknown type of task"); 
     1278    } 
     1279 
     1280    /** 
     1281     * 
     1282     */ 
     1283    private IEventTaskInstance createNewTaskInstance(IEventTask task) { 
     1284        IEventTaskInstance existingInstance = 
     1285            (IEventTaskInstance) task.getInstances().iterator().next(); 
     1286        return taskFactory.createNewTaskInstance(task, existingInstance.getEvent()); 
     1287    } 
     1288 
     1289    /** 
     1290     * 
     1291     */ 
     1292    private ISequenceInstance createNewTaskInstance(ISequence task) { 
     1293        return taskFactory.createNewTaskInstance(task); 
     1294    } 
     1295 
     1296    /** 
     1297     * 
     1298     */ 
     1299    private ISelectionInstance createNewTaskInstance(ISelection task) { 
     1300        return taskFactory.createNewTaskInstance(task); 
     1301    } 
     1302 
     1303    /** 
     1304     * 
     1305     */ 
     1306    private IIterationInstance createNewTaskInstance(IIteration task) { 
     1307        return taskFactory.createNewTaskInstance(task); 
     1308    } 
     1309 
     1310    /** 
     1311     * 
     1312     */ 
     1313    private IOptionalInstance createNewTaskInstance(IOptional task) { 
     1314        return taskFactory.createNewTaskInstance(task); 
     1315    } 
     1316 
    12461317} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/TaskTreeManager.java

    r1154 r1294  
    2121 
    2222import de.ugoe.cs.autoquest.eventcore.Event; 
    23 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     23import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    2424import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    2525import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    124124    public void handleNewEvent(Event event) { 
    125125        assertSessionSequence(); 
    126         ITask eventTask = taskFactory.createNewEventTask(event.getType(), event.getTarget()); 
    127         taskBuilder.addExecutedTask(currentSession, taskFactory.createNewTaskInstance(eventTask)); 
     126        String description = event.getType().getName() + " \u21D2 " + event.getTarget(); 
     127        IEventTask eventTask = taskFactory.createNewEventTask(description); 
     128        taskBuilder.addExecutedTask 
     129            (currentSession, taskFactory.createNewTaskInstance(eventTask, event)); 
    128130    } 
    129131 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRule.java

    r1146 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
     17import java.util.Collection; 
     18 
    1719import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     20import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    1821import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1923 
    2024/** 
     
    2933     
    3034    /* (non-Javadoc) 
    31      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     35     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    3236     */ 
    3337    @Override 
     
    3741 
    3842    /* (non-Javadoc) 
    39      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     43     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    4044     */ 
    4145    @Override 
    4246    public boolean areLexicallyEqual(ITask task1, ITask task2) { 
    43         IEventTask eventTask1 = (IEventTask) task1; 
    44         IEventTask eventTask2 = (IEventTask) task2; 
     47        Collection<ITaskInstance> taskInstances1 = task1.getInstances(); 
     48        Collection<ITaskInstance> taskInstances2 = task2.getInstances(); 
    4549         
    46         return (eventTask1.getEventType().equals(eventTask2.getEventType()) && 
    47                 eventTask1.getEventTarget().equals(eventTask2.getEventTarget())); 
     50        for (ITaskInstance instance1 : taskInstances1) { 
     51            boolean found = false; 
     52             
     53            for (ITaskInstance instance2 : taskInstances2) { 
     54                if (areLexicallyEqual(instance1, instance2)) { 
     55                    found = true; 
     56                    break; 
     57                } 
     58            } 
     59             
     60            if (!found) { 
     61                return false; 
     62            } 
     63        } 
     64         
     65        return true; 
    4866    } 
    4967 
    5068    /* (non-Javadoc) 
    51      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     69     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    5270     */ 
    5371    @Override 
     
    5775 
    5876    /* (non-Javadoc) 
    59      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     77     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    6078     */ 
    6179    @Override 
     
    6482    } 
    6583 
     84    /* (non-Javadoc) 
     85     * @see TaskComparisonRule#compare(ITask, ITask) 
     86     */ 
    6687    @Override 
    6788    public TaskEquality compare(ITask task1, ITask task2) { 
     
    7495    } 
    7596 
     97     
     98    /* (non-Javadoc) 
     99     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     100     */ 
     101    @Override 
     102    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     103        return 
     104            (instance1 instanceof IEventTaskInstance) && (instance2 instanceof IEventTaskInstance); 
     105    } 
     106 
     107    /* (non-Javadoc) 
     108     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     109     */ 
     110    @Override 
     111    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     112        IEventTaskInstance eventTask1 = (IEventTaskInstance) instance1; 
     113        IEventTaskInstance eventTask2 = (IEventTaskInstance) instance2; 
     114         
     115        return (eventTask1.getEvent().getType().equals(eventTask2.getEvent().getType()) && 
     116                eventTask1.getEvent().getTarget().equals(eventTask2.getEvent().getTarget())); 
     117    } 
     118 
     119    /* (non-Javadoc) 
     120     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     121     */ 
     122    @Override 
     123    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     124        return areLexicallyEqual(instance1, instance2); 
     125    } 
     126 
     127    /* (non-Javadoc) 
     128     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     129     */ 
     130    @Override 
     131    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     132        return areLexicallyEqual(instance1, instance2); 
     133    } 
     134 
     135    /* (non-Javadoc) 
     136     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     137     */ 
     138    @Override 
     139    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     140        if (areLexicallyEqual(instance1, instance2)) { 
     141            return TaskEquality.LEXICALLY_EQUAL; 
     142        } 
     143        else { 
     144            return TaskEquality.UNEQUAL; 
     145        } 
     146    } 
     147 
    76148} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRule.java

    r1154 r1294  
    1414 
    1515package de.ugoe.cs.autoquest.tasktrees.taskequality; 
     16 
     17import java.util.Collection; 
    1618 
    1719import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     
    4143import de.ugoe.cs.autoquest.eventcore.guimodel.IText; 
    4244import de.ugoe.cs.autoquest.eventcore.guimodel.IToolTip; 
    43 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     45import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    4446import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     47import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    4548 
    4649/** 
     
    6164     
    6265    /* (non-Javadoc) 
    63      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     66     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    6467     */ 
    6568    @Override 
    6669    public boolean isApplicable(ITask task1, ITask task2) { 
    67         return 
    68             ((task1 instanceof IEventTask) && (task2 instanceof IEventTask) && 
    69             (((IEventTask) task1).getEventType() instanceof IInteraction) && 
    70             (((IEventTask) task2).getEventType() instanceof IInteraction)); 
    71     } 
    72  
    73     /* (non-Javadoc) 
    74      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     70        for (ITaskInstance instance : task1.getInstances()) { 
     71            if ((!(instance instanceof IEventTaskInstance)) || 
     72                (!(((IEventTaskInstance) instance).getEvent().getType() instanceof IInteraction))) 
     73            { 
     74                return false; 
     75            } 
     76        } 
     77         
     78        for (ITaskInstance instance : task2.getInstances()) { 
     79            if ((!(instance instanceof IEventTaskInstance)) || 
     80                (!(((IEventTaskInstance) instance).getEvent().getType() instanceof IInteraction))) 
     81            { 
     82                return false; 
     83            } 
     84        } 
     85         
     86        return true; 
     87    } 
     88 
     89    /* (non-Javadoc) 
     90     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    7591     */ 
    7692    @Override 
     
    8197 
    8298    /* (non-Javadoc) 
    83      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     99     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    84100     */ 
    85101    @Override 
     
    90106 
    91107    /* (non-Javadoc) 
    92      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     108     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    93109     */ 
    94110    @Override 
     
    99115 
    100116    /* (non-Javadoc) 
    101      * @see NodeComparisonRule#compare(ITask, ITask) 
     117     * @see TaskComparisonRule#compare(ITask, ITask) 
    102118     */ 
    103119    @Override 
     
    106122    } 
    107123 
    108     /** 
    109      *  
    110      */ 
    111     private TaskEquality getEquality(ITask task1, ITask task2, TaskEquality requiredEqualityLevel) { 
    112         IEventTask eventTask1 = (IEventTask) task1; 
    113         IEventTask eventTask2 = (IEventTask) task2; 
    114          
    115         if (!eventTask1.getEventTarget().equals(eventTask2.getEventTarget())) { 
     124    /* (non-Javadoc) 
     125     * @see de.ugoe.cs.autoquest.tasktrees.taskequality.TaskComparisonRule#isApplicable(de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance, de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance) 
     126     */ 
     127    @Override 
     128    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     129        return 
     130            (instance1 instanceof IEventTaskInstance) && 
     131            (instance2 instanceof IEventTaskInstance) && 
     132            (((IEventTaskInstance) instance1).getEvent().getType() instanceof IInteraction) && 
     133            (((IEventTaskInstance) instance1).getEvent().getType() instanceof IInteraction); 
     134    } 
     135 
     136    /* (non-Javadoc) 
     137     * @see de.ugoe.cs.autoquest.tasktrees.taskequality.TaskComparisonRule#areLexicallyEqual(de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance, de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance) 
     138     */ 
     139    @Override 
     140    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     141        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.LEXICALLY_EQUAL); 
     142        return (equality != null) && (equality.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 
     143    } 
     144 
     145    /* (non-Javadoc) 
     146     * @see de.ugoe.cs.autoquest.tasktrees.taskequality.TaskComparisonRule#areSyntacticallyEqual(de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance, de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance) 
     147     */ 
     148    @Override 
     149    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     150        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SYNTACTICALLY_EQUAL); 
     151        return (equality != null) && (equality.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 
     152    } 
     153 
     154    /* (non-Javadoc) 
     155     * @see de.ugoe.cs.autoquest.tasktrees.taskequality.TaskComparisonRule#areSemanticallyEqual(de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance, de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance) 
     156     */ 
     157    @Override 
     158    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     159        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SEMANTICALLY_EQUAL); 
     160        return (equality != null) && (equality.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 
     161    } 
     162 
     163    /* (non-Javadoc) 
     164     * @see de.ugoe.cs.autoquest.tasktrees.taskequality.TaskComparisonRule#compare(de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance, de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance) 
     165     */ 
     166    @Override 
     167    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     168        return getEquality(instance1, instance2, null); 
     169    } 
     170 
     171    /** 
     172     *  
     173     */ 
     174    private TaskEquality getEquality(ITask         task1, 
     175                                     ITask         task2, 
     176                                     TaskEquality  requiredEqualityLevel) 
     177    { 
     178        Collection<ITaskInstance> taskInstances1 = task1.getInstances(); 
     179        Collection<ITaskInstance> taskInstances2 = task2.getInstances(); 
     180         
     181        TaskEquality checkedEquality = 
     182            requiredEqualityLevel != null ? requiredEqualityLevel : TaskEquality.SEMANTICALLY_EQUAL; 
     183         
     184        TaskEquality commonDenominator = TaskEquality.LEXICALLY_EQUAL; 
     185         
     186        for (ITaskInstance instance1 : taskInstances1) { 
     187            TaskEquality mostConcreteEquality = null; 
     188             
     189            for (ITaskInstance instance2 : taskInstances2) { 
     190                TaskEquality equality = getEquality(instance1, instance2, requiredEqualityLevel); 
     191                 
     192                if ((equality != null) && ((mostConcreteEquality == null) || 
     193                                           (equality.isAtLeast(mostConcreteEquality)))) 
     194                { 
     195                    mostConcreteEquality = equality; 
     196                     
     197                    if (((requiredEqualityLevel != null) && 
     198                         (mostConcreteEquality.isAtLeast(requiredEqualityLevel))) || 
     199                        (mostConcreteEquality.isAtLeast(TaskEquality.LEXICALLY_EQUAL))) 
     200                    { 
     201                        break; 
     202                    } 
     203                } 
     204            } 
     205             
     206            commonDenominator = commonDenominator.getCommonDenominator(mostConcreteEquality); 
     207             
     208            if (!commonDenominator.isAtLeast(checkedEquality)) { 
     209                return TaskEquality.UNEQUAL; 
     210            } 
     211        } 
     212         
     213        return commonDenominator; 
     214    } 
     215 
     216    /** 
     217     *  
     218     */ 
     219    private TaskEquality getEquality(ITaskInstance instance1, 
     220                                     ITaskInstance instance2, 
     221                                     TaskEquality  requiredEqualityLevel) 
     222    { 
     223        IEventTaskInstance eventTask1 = (IEventTaskInstance) instance1; 
     224        IEventTaskInstance eventTask2 = (IEventTaskInstance) instance2; 
     225         
     226        if (!eventTask1.getEvent().getTarget().equals(eventTask2.getEvent().getTarget())) { 
    116227            return TaskEquality.UNEQUAL; 
    117228        } 
    118229         
    119         IInteraction interaction1 = (IInteraction) eventTask1.getEventType(); 
    120         IInteraction interaction2 = (IInteraction) eventTask2.getEventType(); 
     230        IInteraction interaction1 = (IInteraction) eventTask1.getEvent().getType(); 
     231        IInteraction interaction2 = (IInteraction) eventTask2.getEvent().getType(); 
    121232         
    122233        return compareInteractions 
    123             (interaction1, interaction2, eventTask1.getEventTarget(), requiredEqualityLevel); 
     234            (interaction1, interaction2, eventTask1.getEvent().getTarget(), requiredEqualityLevel); 
    124235    } 
    125236 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/IterationComparisonRule.java

    r1190 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    17 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    1817import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    2120import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2222 
    2323/** 
     
    8282     
    8383    /* (non-Javadoc) 
    84      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     84     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    8585     */ 
    8686    @Override 
     
    9090 
    9191    /* (non-Javadoc) 
    92      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     92     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    9393     */ 
    9494    @Override 
    9595    public boolean areLexicallyEqual(ITask task1, ITask task2) { 
    96         ITask child1 = ((IIteration) task1).getMarkedTask(); 
    97         ITask child2 = ((IIteration) task2).getMarkedTask(); 
    98          
    99         if (child1 != null) { 
    100             if (child2 == null) { 
    101                 return false; 
    102             } 
    103             else { 
    104                 // iterations may have 3 different structures. 
    105                 // 1. they have one child, which is the iterated one 
    106                 // 2. they have a sequence of children, which is iterated 
    107                 // 3. they have a selection of different iterated variants (usually the variants 
    108                 //    are semantically equal) 
    109                 // check if the type of children match. If not, return false. If they match, 
    110                 // use the equality manager to perform further comparisons 
    111                  
    112                 if (((child1 instanceof ISelection) && (child2 instanceof ISelection)) || 
    113                     ((child1 instanceof ISequence) && (child2 instanceof ISequence)) || 
    114                     ((child1 instanceof IEventTask) && (child2 instanceof IEventTask))) 
    115                 { 
    116                     return getNodeEquality 
    117                         (child1, child2).isAtLeast(TaskEquality.LEXICALLY_EQUAL); 
    118                 } 
    119             } 
    120         } 
    121         else if (child2 == null) { 
    122             return true; 
    123         } 
    124          
    125         return false; 
    126     } 
    127  
    128     /* (non-Javadoc) 
    129      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    130      */ 
    131     @Override 
    132     public boolean areSyntacticallyEqual(ITask task1, ITask task2) { 
    13396        ITask child1 = ((IIteration) task1).getMarkedTask(); 
    13497        ITask child2 = ((IIteration) task2).getMarkedTask(); 
     
    146109                // ignore the type of the children but check them for equality. 
    147110                 
    148                 return getNodeEquality(child1, child2).isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL); 
     111                return getNodeEquality(child1, child2).isAtLeast(TaskEquality.LEXICALLY_EQUAL); 
    149112            } 
    150113        } 
     
    157120 
    158121    /* (non-Javadoc) 
    159      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     122     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     123     */ 
     124    @Override 
     125    public boolean areSyntacticallyEqual(ITask task1, ITask task2) { 
     126        return areLexicallyEqual(task1, task2); 
     127    } 
     128 
     129    /* (non-Javadoc) 
     130     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    160131     */ 
    161132    @Override 
     
    165136 
    166137    /* (non-Javadoc) 
    167      * @see NodeComparisonRule#compare(ITask, ITask) 
     138     * @see TaskComparisonRule#compare(ITask, ITask) 
    168139     */ 
    169140    @Override 
     
    203174        // all other combinations (i.e. sequence with single child and sequence with selection) 
    204175        // can not match 
     176    } 
     177 
     178    /* (non-Javadoc) 
     179     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     180     */ 
     181    @Override 
     182    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     183        return isApplicable(instance1.getTask(), instance2.getTask()); 
     184    } 
     185 
     186    /* (non-Javadoc) 
     187     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     188     */ 
     189    @Override 
     190    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     191        IIterationInstance iteration1 = (IIterationInstance) instance1; 
     192        IIterationInstance iteration2 = (IIterationInstance) instance2; 
     193 
     194        // if both sequences do not have children, they are equal although this doesn't make sense 
     195        if ((iteration1.size() == 0) && (iteration2.size() == 0)) { 
     196            return true; 
     197        } 
     198 
     199        if (iteration1.size() != iteration2.size()) { 
     200            return false; 
     201        } 
     202 
     203        for (int i = 0; i < iteration1.size(); i++) { 
     204            ITaskInstance child1 = iteration1.get(i); 
     205            ITaskInstance child2 = iteration2.get(i); 
     206 
     207            TaskEquality taskEquality = 
     208                callRuleManager(child1, child2, TaskEquality.LEXICALLY_EQUAL); 
     209 
     210            if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL)) { 
     211                return false; 
     212            } 
     213        } 
     214 
     215        return true; 
     216    } 
     217 
     218    /* (non-Javadoc) 
     219     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     220     */ 
     221    @Override 
     222    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     223        return areLexicallyEqual(instance1, instance2); 
     224    } 
     225 
     226    /* (non-Javadoc) 
     227     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     228     */ 
     229    @Override 
     230    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     231        return areLexicallyEqual(instance1, instance2); 
     232    } 
     233 
     234    /* (non-Javadoc) 
     235     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     236     */ 
     237    @Override 
     238    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     239        if (areLexicallyEqual(instance1, instance2)) { 
     240            return TaskEquality.LEXICALLY_EQUAL; 
     241        } 
     242        else { 
     243            return TaskEquality.UNEQUAL; 
     244        } 
    205245    } 
    206246 
     
    272312                  callRuleManager(task, child, commonDenominatorForAllComparisons); 
    273313 
    274             if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL)) 
    275             { 
     314            if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL)) { 
    276315                return TaskEquality.UNEQUAL; 
    277316            } 
     
    314353        } 
    315354    } 
     355     
     356    /** 
     357     * <p> 
     358     * used to to call the task equality rule manager for the comparison of the two provided 
     359     * children. If no required equality level is provided, than the most concrete equality is 
     360     * returned. Otherwise, the required equality is returned as long as the children are equal 
     361     * on that level. 
     362     * </p>  
     363     *  
     364     * @param taskInstance1         the first task instance to be compared 
     365     * @param taskInstance2         the second task instance to be compared 
     366     * @param requiredEqualityLevel the equality level to be checked for 
     367     *  
     368     * @return the determined equality 
     369     */ 
     370    private TaskEquality callRuleManager(ITaskInstance taskInstance1, 
     371                                         ITaskInstance taskInstance2, 
     372                                         TaskEquality  requiredEqualityLevel) 
     373    { 
     374        if (requiredEqualityLevel == null) { 
     375            return TaskEqualityRuleManager.getInstance().compare(taskInstance1, taskInstance2); 
     376        } 
     377        else if (TaskEqualityRuleManager.getInstance().areAtLeastEqual 
     378                     (taskInstance1, taskInstance2, requiredEqualityLevel)) 
     379        { 
     380            return requiredEqualityLevel; 
     381        } 
     382        else { 
     383            return TaskEquality.UNEQUAL; 
     384        } 
     385    } 
    316386} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SelectionComparisonRule.java

    r1190 r1294  
    1818 
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     20import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2021import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2123 
    2224/** 
     
    3941 
    4042    /* (non-Javadoc) 
    41      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     43     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    4244     */ 
    4345    @Override 
     
    4749 
    4850    /* (non-Javadoc) 
    49      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     51     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    5052     */ 
    5153    @Override 
     
    5658 
    5759    /* (non-Javadoc) 
    58      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     60     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    5961     */ 
    6062    @Override 
     
    6567 
    6668    /* (non-Javadoc) 
    67      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     69     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    6870     */ 
    6971    @Override 
     
    7476 
    7577    /* (non-Javadoc) 
    76      * @see NodeComparisonRule#compare(ITask, ITask) 
     78     * @see TaskComparisonRule#compare(ITask, ITask) 
    7779     */ 
    7880    @Override 
    7981    public TaskEquality compare(ITask task1, ITask task2) { 
    8082        return getEquality(task1, task2, null); 
     83    } 
     84 
     85    /* (non-Javadoc) 
     86     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     87     */ 
     88    @Override 
     89    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     90        return isApplicable(instance1.getTask(), instance2.getTask()); 
     91    } 
     92 
     93    /* (non-Javadoc) 
     94     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     95     */ 
     96    @Override 
     97    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     98        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.LEXICALLY_EQUAL); 
     99        return (equality != null) && (equality.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 
     100    } 
     101 
     102    /* (non-Javadoc) 
     103     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     104     */ 
     105    @Override 
     106    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     107        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SYNTACTICALLY_EQUAL); 
     108        return (equality != null) && (equality.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 
     109    } 
     110 
     111    /* (non-Javadoc) 
     112     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     113     */ 
     114    @Override 
     115    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     116        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SEMANTICALLY_EQUAL); 
     117        return (equality != null) && (equality.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 
     118    } 
     119 
     120    /* (non-Javadoc) 
     121     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     122     */ 
     123    @Override 
     124    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     125        return getEquality(instance1, instance2, null); 
    81126    } 
    82127 
     
    107152        } 
    108153 
    109         TaskEquality selectionEquality; 
    110  
    111154        if (requiredEqualityLevel == null) { 
    112155            // calculate the common equality level for all children of both selections. 
    113156            // do it in both directions to ensure commutative comparison 
    114             selectionEquality = getCommonEqualityLevel(children1, children2); 
    115             if (selectionEquality != TaskEquality.UNEQUAL) { 
    116                 return selectionEquality.getCommonDenominator 
    117                     (getCommonEqualityLevel(children2, children1)); 
    118             } 
    119             else { 
    120                 return TaskEquality.UNEQUAL; 
    121             } 
     157            return getMostConcreteEqualityLevel(children1, children2); 
    122158        } 
    123159        else { 
    124160            // we are searching for a specific equality 
    125             if (checkEqualityLevel(children1, children2, requiredEqualityLevel) && 
    126                 checkEqualityLevel(children2, children1, requiredEqualityLevel)) 
    127             { 
     161            if (checkEqualityLevel(children1, children2, requiredEqualityLevel)) { 
    128162                return requiredEqualityLevel; 
    129163            } 
     
    136170    /** 
    137171     * <p> 
    138      * determines the common equality level for all tasks in the first list compared to all 
    139      * tasks in the second list. If for one task in the first list, there is no equal task in the 
    140      * second list, the method return unequality.  
     172     * determines the most concrete equality level for all tasks in the first list compared to all 
     173     * tasks in the second list. It is sufficient, if there is one task in one list for which there 
     174     * exist an equal task in the other list. 
    141175     * </p> 
    142176     * 
     
    144178     * @param children2 the second list to be compared 
    145179     *  
    146      * @return the common task equality identified for all tasks in the first list with respect to 
    147      *         the second list 
    148      */ 
    149     private TaskEquality getCommonEqualityLevel(List<ITask> children1, List<ITask> children2) { 
    150         TaskEquality listEquality = TaskEquality.LEXICALLY_EQUAL; 
    151          
     180     * @return the most concrete task equality identified for all tasks in the first list with 
     181     *         respect to the second list 
     182     */ 
     183    private TaskEquality getMostConcreteEqualityLevel(List<ITask> children1, List<ITask> children2) 
     184    { 
    152185        TaskEquality childEquality; 
    153186        TaskEquality currentEquality; 
     
    164197                    } 
    165198                     
    166                     if (childEquality == TaskEquality.SEMANTICALLY_EQUAL) { 
    167                         // as we calculate only the common denominator, we can break up here for 
    168                         // the current child. We will not improve the denominator anymore 
    169                         break; 
     199                    if (childEquality.isAtLeast(TaskEquality.LEXICALLY_EQUAL)) { 
     200                        // as we calculate the most concrete equality, we can break up here 
     201                        return TaskEquality.LEXICALLY_EQUAL; 
    170202                    } 
    171203                } 
    172204            } 
    173              
    174             if (childEquality == null) { 
    175                 // we did not find any child in the second list, that is equal to the searched 
    176                 // child 
    177                 return TaskEquality.UNEQUAL; 
    178             } 
    179             else { 
    180                 listEquality = listEquality.getCommonDenominator(childEquality); 
    181             } 
    182         } 
    183  
    184         return listEquality; 
    185     } 
    186  
    187     /** 
    188      * <p> 
    189      * ensures for the two given lists, that for each task in the first list there is a task 
     205        } 
     206 
     207        // as the comparison should be commutative, we do not need to check, if in list 2 there is 
     208        // a child equal to one in list 1 
     209        return TaskEquality.UNEQUAL; 
     210    } 
     211 
     212    /** 
     213     * <p> 
     214     * ensures for the two given lists, that for at least one task in the first list there is a task 
    190215     * in the second list being on the given level equal to the task in the first list. 
    191216     * </p>  
     
    195220     * @param requiredEqualityLevel the equality level to be checked for 
    196221     *  
    197      * @return true if each task in the first list has an equal task in the second list when 
    198      *         considering the given equality level, false else. 
     222     * @return true if there is a task in the first list that has an equal task in the second list 
     223     *         when considering the given equality level, false else. 
    199224     */ 
    200225    private boolean checkEqualityLevel(List<ITask>  children1, 
     
    202227                                       TaskEquality requiredEqualityLevel) 
    203228    { 
    204         TaskEquality childEquality; 
    205229        TaskEquality currentEquality; 
    206230        for (ITask child1 : children1) { 
    207             childEquality = null; 
    208231            for (ITask child2 : children2) { 
    209232                currentEquality = callRuleManager(child1, child2, requiredEqualityLevel); 
     
    212235                    // we found at least one equal child with sufficient equality in the 
    213236                    // second list. So be can break up for this child. 
    214                     childEquality = currentEquality; 
    215                     break; 
     237                    return true; 
    216238                } 
    217239            } 
    218              
    219             if (childEquality == null) { 
    220                 // we did not find any child in the second list, that is equal to the searched 
    221                 // child 
    222                 return false; 
    223             } 
    224         } 
    225  
    226         // for all children, we found an equality  
    227         return true; 
     240        } 
     241 
     242        return false; 
    228243    } 
    229244 
     
    259274    } 
    260275 
     276    /** 
     277     * <p> 
     278     * compares two selection instances with each other checking for the provided required level of 
     279     * equality. If this level is ensured, the method immediately returns. The more concrete 
     280     * the required equality level, the more checks this method performs. 
     281     * </p> 
     282     *  
     283     * @param taskInstance1         the first task instance to be compared 
     284     * @param taskInstance2         the second task instance to be compared 
     285     * @param requiredEqualityLevel the equality level to be checked for 
     286     *  
     287     * @return the determined equality. 
     288     */ 
     289    private TaskEquality getEquality(ITaskInstance taskInstance1, 
     290                                     ITaskInstance taskInstance2, 
     291                                     TaskEquality  requiredEqualityLevel) 
     292    { 
     293        ITaskInstance child1 = ((ISelectionInstance) taskInstance1).getChild(); 
     294        ITaskInstance child2 = ((ISelectionInstance) taskInstance2).getChild(); 
     295 
     296        // if both selections do not have children, they are lexically equal. If only one of them 
     297        // has children, they are unequal. 
     298        if ((child1 == null) && (child2 == null)) { 
     299            return TaskEquality.LEXICALLY_EQUAL; 
     300        } 
     301        else if ((child1 == null) || (child2 == null)) { 
     302            return TaskEquality.UNEQUAL; 
     303        } 
     304 
     305        TaskEquality equality = callRuleManager(child1, child2, requiredEqualityLevel); 
     306         
     307        if (equality == TaskEquality.IDENTICAL) { 
     308            // two different selection instances can be at most lexically equal even if their 
     309            // children are identical 
     310            return TaskEquality.LEXICALLY_EQUAL; 
     311        } 
     312        else { 
     313            return equality; 
     314        } 
     315    } 
     316 
     317    /** 
     318     * <p> 
     319     * used to to call the task equality rule manager for the comparison of the two provided 
     320     * children. If no required equality level is provided, than the most concrete equality is 
     321     * returned. Otherwise, the required equality is returned as long as the children are equal 
     322     * on that level. 
     323     * </p>  
     324     *  
     325     * @param taskInstance1         the first task instance to be compared 
     326     * @param taskInstance2         the second task instance to be compared 
     327     * @param requiredEqualityLevel the equality level to be checked for 
     328     *  
     329     * @return the determined equality 
     330     */ 
     331    private TaskEquality callRuleManager(ITaskInstance taskInstance1, 
     332                                         ITaskInstance taskInstance2, 
     333                                         TaskEquality  requiredEqualityLevel) 
     334    { 
     335        if (requiredEqualityLevel == null) { 
     336            return TaskEqualityRuleManager.getInstance().compare(taskInstance1, taskInstance2); 
     337        } 
     338        else if (TaskEqualityRuleManager.getInstance().areAtLeastEqual 
     339                     (taskInstance1, taskInstance2, requiredEqualityLevel)) 
     340        { 
     341            return requiredEqualityLevel; 
     342        } 
     343        else { 
     344            return TaskEquality.UNEQUAL; 
     345        } 
     346    } 
    261347} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SequenceComparisonRule.java

    r1190 r1294  
    1818 
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     20import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    2021import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2123 
    2224/** 
     
    3436 
    3537    /* (non-Javadoc) 
    36      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     38     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    3739     */ 
    3840    @Override 
     
    4244 
    4345    /* (non-Javadoc) 
    44      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     46     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    4547     */ 
    4648    @Override 
     
    5153 
    5254    /* (non-Javadoc) 
    53      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     55     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    5456     */ 
    5557    @Override 
     
    6062 
    6163    /* (non-Javadoc) 
    62      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     64     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    6365     */ 
    6466    @Override 
     
    6971 
    7072    /* (non-Javadoc) 
    71      * @see NodeComparisonRule#compare(ITask, ITask) 
     73     * @see TaskComparisonRule#compare(ITask, ITask) 
    7274     */ 
    7375    @Override 
    7476    public TaskEquality compare(ITask task1, ITask task2) { 
    7577        return getEquality(task1, task2, null); 
     78    } 
     79 
     80    /* (non-Javadoc) 
     81     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     82     */ 
     83    @Override 
     84    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     85        return isApplicable(instance1.getTask(), instance2.getTask()); 
     86    } 
     87 
     88    /* (non-Javadoc) 
     89     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     90     */ 
     91    @Override 
     92    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     93        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.LEXICALLY_EQUAL); 
     94        return (equality != null) && (equality.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 
     95    } 
     96 
     97    /* (non-Javadoc) 
     98     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     99     */ 
     100    @Override 
     101    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     102        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SYNTACTICALLY_EQUAL); 
     103        return (equality != null) && (equality.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 
     104    } 
     105 
     106    /* (non-Javadoc) 
     107     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     108     */ 
     109    @Override 
     110    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     111        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SEMANTICALLY_EQUAL); 
     112        return (equality != null) && (equality.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 
     113    } 
     114 
     115    /* (non-Javadoc) 
     116     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     117     */ 
     118    @Override 
     119    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     120        return getEquality(instance1, instance2, null); 
    76121    } 
    77122 
     
    149194        } 
    150195    } 
     196 
     197    /** 
     198     * <p> 
     199     * compares two sequence instances with each other checking for the provided required level of 
     200     * equality. If this level is ensured, the method immediately returns. The more concrete 
     201     * the required equality level, the more checks this method performs. 
     202     * </p> 
     203     *  
     204     * @param taskInstance1         the first task instance to be compared 
     205     * @param taskInstance2         the second task instance to be compared 
     206     * @param requiredEqualityLevel the equality level to be checked for 
     207     *  
     208     * @return the determined equality. 
     209     */ 
     210    private TaskEquality getEquality(ITaskInstance taskInstance1, 
     211                                     ITaskInstance taskInstance2, 
     212                                     TaskEquality  requiredEqualityLevel) 
     213    { 
     214        ISequenceInstance sequence1 = (ISequenceInstance) taskInstance1; 
     215        ISequenceInstance sequence2 = (ISequenceInstance) taskInstance2; 
     216 
     217        // if both sequences do not have children, they are equal although this doesn't make sense 
     218        if ((sequence1.size() == 0) && (sequence2.size() == 0)) { 
     219            return TaskEquality.LEXICALLY_EQUAL; 
     220        } 
     221 
     222        if (sequence1.size() != sequence2.size()) { 
     223            return TaskEquality.UNEQUAL; 
     224        } 
     225 
     226        TaskEquality resultingEquality = TaskEquality.LEXICALLY_EQUAL; 
     227        for (int i = 0; i < sequence1.size(); i++) { 
     228            ITaskInstance child1 = sequence1.get(i); 
     229            ITaskInstance child2 = sequence2.get(i); 
     230 
     231            TaskEquality taskEquality = callRuleManager(child1, child2, requiredEqualityLevel); 
     232 
     233            if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL)) { 
     234                return TaskEquality.UNEQUAL; 
     235            } 
     236             
     237            resultingEquality = resultingEquality.getCommonDenominator(taskEquality); 
     238        } 
     239 
     240        return resultingEquality; 
     241    } 
     242     
     243    /** 
     244     * <p> 
     245     * used to to call the task equality rule manager for the comparison of the two provided 
     246     * children. If no required equality level is provided, than the most concrete equality is 
     247     * returned. Otherwise, the required equality is returned as long as the children are equal 
     248     * on that level. 
     249     * </p>  
     250     *  
     251     * @param taskInstance1         the first task instance to be compared 
     252     * @param taskInstance2         the second task instance to be compared 
     253     * @param requiredEqualityLevel the equality level to be checked for 
     254     *  
     255     * @return the determined equality 
     256     */ 
     257    private TaskEquality callRuleManager(ITaskInstance taskInstance1, 
     258                                         ITaskInstance taskInstance2, 
     259                                         TaskEquality  requiredEqualityLevel) 
     260    { 
     261        if (requiredEqualityLevel == null) { 
     262            return TaskEqualityRuleManager.getInstance().compare(taskInstance1, taskInstance2); 
     263        } 
     264        else if (TaskEqualityRuleManager.getInstance().areAtLeastEqual 
     265                     (taskInstance1, taskInstance2, requiredEqualityLevel)) 
     266        { 
     267            return requiredEqualityLevel; 
     268        } 
     269        else { 
     270            return TaskEquality.UNEQUAL; 
     271        } 
     272    } 
    151273} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRule.java

    r1190 r1294  
    1616 
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    1819import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     20import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1921 
    2022/** 
     
    3335     
    3436    /* (non-Javadoc) 
    35      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     37     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    3638     */ 
    3739    @Override 
     
    4244 
    4345    /* (non-Javadoc) 
    44      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     46     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    4547     */ 
    4648    @Override 
     
    5153 
    5254    /* (non-Javadoc) 
    53      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     55     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    5456     */ 
    5557    @Override 
     
    6062 
    6163    /* (non-Javadoc) 
    62      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     64     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    6365     */ 
    6466    @Override 
     
    6971 
    7072    /* (non-Javadoc) 
    71      * @see NodeComparisonRule#compare(ITask, ITask) 
     73     * @see TaskComparisonRule#compare(ITask, ITask) 
    7274     */ 
    7375    @Override 
    7476    public TaskEquality compare(ITask task1, ITask task2) { 
    7577        return getEquality(task1, task2, null); 
     78    } 
     79 
     80    /* (non-Javadoc) 
     81     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     82     */ 
     83    @Override 
     84    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     85        return isApplicable(instance1.getTask(), instance2.getTask()); 
     86    } 
     87 
     88    /* (non-Javadoc) 
     89     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     90     */ 
     91    @Override 
     92    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     93        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.LEXICALLY_EQUAL); 
     94        return (equality != null) && (equality.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 
     95    } 
     96 
     97    /* (non-Javadoc) 
     98     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     99     */ 
     100    @Override 
     101    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     102        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SYNTACTICALLY_EQUAL); 
     103        return (equality != null) && (equality.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 
     104    } 
     105 
     106    /* (non-Javadoc) 
     107     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     108     */ 
     109    @Override 
     110    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     111        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SEMANTICALLY_EQUAL); 
     112        return (equality != null) && (equality.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 
     113    } 
     114 
     115    /* (non-Javadoc) 
     116     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     117     */ 
     118    @Override 
     119    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     120        return getEquality(instance1, instance2, null); 
    76121    } 
    77122 
     
    167212        } 
    168213    } 
     214 
     215    /** 
     216     * <p> 
     217     * compares two task instances with each other checking for the provided required level of 
     218     * equality. One of the task instances must be a iteration, the other one not. If this is not 
     219     * the case, the method returns null. The returned equality level is at most lexical equality 
     220     * as the iteration can not be identical to something not being a iteration. 
     221     * </p> 
     222     *  
     223     * @param taskInstance1         the first task instance to be compared 
     224     * @param taskInstance2         the second task instance to be compared 
     225     * @param requiredEqualityLevel the equality level to be checked for 
     226     *  
     227     * @return the determined equality. 
     228     */ 
     229    private TaskEquality getEquality(ITaskInstance taskInstance1, 
     230                                     ITaskInstance taskInstance2, 
     231                                     TaskEquality  requiredEqualityLevel) 
     232    { 
     233        IIterationInstance iteration = null; 
     234        ITaskInstance task = null; 
     235         
     236        if (taskInstance1 instanceof IIterationInstance) { 
     237            if (taskInstance2 instanceof IIterationInstance) { 
     238                // the rule is not responsible for two iterations 
     239                return null; 
     240            } 
     241             
     242            iteration = (IIterationInstance) taskInstance1; 
     243            task = taskInstance2; 
     244        } 
     245        else if (taskInstance2 instanceof IIterationInstance) { 
     246            if (taskInstance1 instanceof IIterationInstance) { 
     247                // the rule is not responsible for two iterations 
     248                return null; 
     249            } 
     250             
     251            iteration = (IIterationInstance) taskInstance2; 
     252            task = taskInstance1; 
     253        } 
     254        else { 
     255            return null; 
     256        } 
     257 
     258        // now, that we found the iteration and the task, lets compare the children of the iteration 
     259        // with the task. 
     260         
     261        if (iteration.size() < 1) { 
     262            return null; 
     263        } 
     264 
     265        TaskEquality mostConcreteNodeEquality = null; 
     266         
     267        for (ITaskInstance child : iteration) { 
     268            TaskEquality taskEquality = callRuleManager(child, task, requiredEqualityLevel); 
     269             
     270            if (taskEquality != TaskEquality.UNEQUAL) { 
     271                if (mostConcreteNodeEquality == null) { 
     272                    mostConcreteNodeEquality = taskEquality; 
     273                } 
     274                else if (mostConcreteNodeEquality.isAtLeast(taskEquality)) { 
     275                    mostConcreteNodeEquality = taskEquality; 
     276                     
     277                } 
     278                 
     279                if ((requiredEqualityLevel != null) && 
     280                    (mostConcreteNodeEquality.isAtLeast(requiredEqualityLevel))) 
     281                { 
     282                    // if we found one child of the selection that is as equal as required, then 
     283                    // we can consider the selection to be sufficiently equal to the other task. 
     284                    // So we break up checking further children. 
     285                    break; 
     286                } 
     287            } 
     288        } 
     289         
     290        // although the subtask may be identical to the task, we can not return identical, as 
     291        // the selection is not identical to the task, but at most lexically equal 
     292        if (mostConcreteNodeEquality == TaskEquality.IDENTICAL) { 
     293            return TaskEquality.LEXICALLY_EQUAL; 
     294        } 
     295        else { 
     296            return mostConcreteNodeEquality; 
     297        } 
     298 
     299    } 
     300     
     301    /** 
     302     * <p> 
     303     * used to to call the task equality rule manager for the comparison of the two provided 
     304     * children. If no required equality level is provided, than the most concrete equality is 
     305     * returned. Otherwise, the required equality is returned as long as the children are equal 
     306     * on that level. 
     307     * </p>  
     308     *  
     309     * @param taskInstance1         the first task instance to be compared 
     310     * @param taskInstance2         the second task instance to be compared 
     311     * @param requiredEqualityLevel the equality level to be checked for 
     312     *  
     313     * @return the determined equality 
     314     */ 
     315    private TaskEquality callRuleManager(ITaskInstance taskInstance1, 
     316                                         ITaskInstance taskInstance2, 
     317                                         TaskEquality  requiredEqualityLevel) 
     318    { 
     319        if (requiredEqualityLevel == null) { 
     320            return TaskEqualityRuleManager.getInstance().compare(taskInstance1, taskInstance2); 
     321        } 
     322        else if (TaskEqualityRuleManager.getInstance().areAtLeastEqual 
     323                     (taskInstance1, taskInstance2, requiredEqualityLevel)) 
     324        { 
     325            return requiredEqualityLevel; 
     326        } 
     327        else { 
     328            return TaskEquality.UNEQUAL; 
     329        } 
     330    } 
    169331} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRule.java

    r1190 r1294  
    1818 
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     20import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2021import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2123 
    2224/** 
     
    3436     
    3537    /* (non-Javadoc) 
    36      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     38     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    3739     */ 
    3840    @Override 
     
    4345 
    4446    /* (non-Javadoc) 
    45      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     47     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    4648     */ 
    4749    @Override 
     
    5254 
    5355    /* (non-Javadoc) 
    54      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     56     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    5557     */ 
    5658    @Override 
     
    6163 
    6264    /* (non-Javadoc) 
    63      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     65     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    6466     */ 
    6567    @Override 
     
    7072 
    7173    /* (non-Javadoc) 
    72      * @see NodeComparisonRule#compare(ITask, ITask) 
     74     * @see TaskComparisonRule#compare(ITask, ITask) 
    7375     */ 
    7476    @Override 
     
    7779    } 
    7880     
     81    /* (non-Javadoc) 
     82     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     83     */ 
     84    @Override 
     85    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     86        return isApplicable(instance1.getTask(), instance2.getTask()); 
     87    } 
     88 
     89    /* (non-Javadoc) 
     90     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     91     */ 
     92    @Override 
     93    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     94        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.LEXICALLY_EQUAL); 
     95        return (equality != null) && (equality.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 
     96    } 
     97 
     98    /* (non-Javadoc) 
     99     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     100     */ 
     101    @Override 
     102    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     103        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SYNTACTICALLY_EQUAL); 
     104        return (equality != null) && (equality.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 
     105    } 
     106 
     107    /* (non-Javadoc) 
     108     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     109     */ 
     110    @Override 
     111    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     112        TaskEquality equality = getEquality(instance1, instance2, TaskEquality.SEMANTICALLY_EQUAL); 
     113        return (equality != null) && (equality.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 
     114    } 
     115 
     116    /* (non-Javadoc) 
     117     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     118     */ 
     119    @Override 
     120    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     121        return getEquality(instance1, instance2, null); 
     122    } 
     123 
    79124    /** 
    80125     * <p> 
     
    191236        } 
    192237    } 
     238 
     239    /** 
     240     * <p> 
     241     * compares two task instances with each other checking for the provided required level of 
     242     * equality. One of the task instances must be a selection, the other one not. If this is not 
     243     * the case, the method returns null. The returned equality level is at most lexical equality 
     244     * as the selection can not be identical to something not being a selection. 
     245     * </p> 
     246     *  
     247     * @param taskInstance1         the first task instance to be compared 
     248     * @param taskInstance2         the second task instance to be compared 
     249     * @param requiredEqualityLevel the equality level to be checked for 
     250     *  
     251     * @return the determined equality. 
     252     */ 
     253    private TaskEquality getEquality(ITaskInstance taskInstance1, 
     254                                     ITaskInstance taskInstance2, 
     255                                     TaskEquality  requiredEqualityLevel) 
     256    { 
     257        ISelectionInstance selection = null; 
     258        ITaskInstance task = null; 
     259         
     260        if (taskInstance1 instanceof ISelectionInstance) { 
     261            if (taskInstance2 instanceof ISelectionInstance) { 
     262                // the rule is not responsible for two selections 
     263                return null; 
     264            } 
     265             
     266            selection = (ISelectionInstance) taskInstance1; 
     267            task = taskInstance2; 
     268        } 
     269        else if (taskInstance2 instanceof ISelectionInstance) { 
     270            if (taskInstance1 instanceof ISelectionInstance) { 
     271                // the rule is not responsible for two selections 
     272                return null; 
     273            } 
     274             
     275            selection = (ISelectionInstance) taskInstance2; 
     276            task = taskInstance1; 
     277        } 
     278        else { 
     279            return null; 
     280        } 
     281 
     282        // now, that we found the selection and the task, lets compare the child of the selection 
     283        // with the task. 
     284        ITaskInstance child = selection.getChild(); 
     285         
     286        if (child == null) { 
     287            return null; 
     288        } 
     289 
     290        TaskEquality taskEquality = callRuleManager(child, task, requiredEqualityLevel); 
     291 
     292        // although the subtask may be identical to the task, we can not return identical, as 
     293        // the selection is not identical to the task, but at most lexically equal 
     294        if (taskEquality == TaskEquality.IDENTICAL) { 
     295            return TaskEquality.LEXICALLY_EQUAL; 
     296        } 
     297        else { 
     298            return taskEquality; 
     299        } 
     300 
     301    } 
     302     
     303    /** 
     304     * <p> 
     305     * used to to call the task equality rule manager for the comparison of the two provided 
     306     * children. If no required equality level is provided, than the most concrete equality is 
     307     * returned. Otherwise, the required equality is returned as long as the children are equal 
     308     * on that level. 
     309     * </p>  
     310     *  
     311     * @param taskInstance1         the first task instance to be compared 
     312     * @param taskInstance2         the second task instance to be compared 
     313     * @param requiredEqualityLevel the equality level to be checked for 
     314     *  
     315     * @return the determined equality 
     316     */ 
     317    private TaskEquality callRuleManager(ITaskInstance taskInstance1, 
     318                                         ITaskInstance taskInstance2, 
     319                                         TaskEquality  requiredEqualityLevel) 
     320    { 
     321        if (requiredEqualityLevel == null) { 
     322            return TaskEqualityRuleManager.getInstance().compare(taskInstance1, taskInstance2); 
     323        } 
     324        else if (TaskEqualityRuleManager.getInstance().areAtLeastEqual 
     325                     (taskInstance1, taskInstance2, requiredEqualityLevel)) 
     326        { 
     327            return requiredEqualityLevel; 
     328        } 
     329        else { 
     330            return TaskEquality.UNEQUAL; 
     331        } 
     332    } 
    193333} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskComparisonRule.java

    r1146 r1294  
    1616 
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1819 
    1920/** 
    2021 * <p> 
    21  * A task comparison rule is used by the {@link TaskEqualityRuleManager} to compare tasks with 
    22  * each other. It provides several methods to be called for a comparison. 
     22 * A task comparison rule is used by the {@link TaskEqualityRuleManager} to compare tasks and 
     23 * task instances with each other. It provides several methods to be called for a comparison. 
    2324 * </p> 
    2425 *  
     
    9091    public TaskEquality compare(ITask task1, ITask task2); 
    9192 
     93    /** 
     94     * <p> 
     95     * checks if the rule is applicable for comparing the two provided task instances 
     96     * </p> 
     97     *  
     98     * @param instance1 the first task instance to compare 
     99     * @param instance2 the second task instance to compare 
     100     *  
     101     * @return true, if the rule is applicable, false else 
     102     */ 
     103    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2); 
     104 
     105    /** 
     106     * <p> 
     107     * checks, if the provided task instances are lexically equal 
     108     * </p> 
     109     *  
     110     * @param instance1 the first task instance to compare 
     111     * @param instance2 the second task instance to compare 
     112     *  
     113     * @return true, if the tasks are equal, false else 
     114     */ 
     115    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2); 
     116 
     117    /** 
     118     * <p> 
     119     * checks, if the provided task instances are syntactically equal 
     120     * </p> 
     121     *  
     122     * @param instance1 the first task instance to compare 
     123     * @param instance2 the second task instance to compare 
     124     *  
     125     * @return true, if the tasks are equal, false else 
     126     */ 
     127    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2); 
     128 
     129    /** 
     130     * <p> 
     131     * checks, if the provided task instances are semantically equal 
     132     * </p> 
     133     *  
     134     * @param instance1 the first task instance to compare 
     135     * @param instance2 the second task instance to compare 
     136     *  
     137     * @return true, if the tasks are equal, false else 
     138     */ 
     139    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2); 
     140 
     141    /** 
     142     * <p> 
     143     * compares two task instances with each other. The result of the method is either a task 
     144     * instance equality or null. If it is null, it means, that the rule is not able to correctly 
     145     * compare the two given task instances 
     146     * </p> 
     147     *  
     148     * @param instance1 the first task instance to compare 
     149     * @param instance2 the second task instance to compare 
     150     *  
     151     * @return as described 
     152     */ 
     153    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2); 
     154 
    92155} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityRuleManager.java

    r1190 r1294  
    1919 
    2020import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     21import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2122 
    2223/** 
    2324 * <p> 
    24  * The task equality rule manager is capable of comparing tasks based on its internal list 
    25  * of comparison rules. These rules are asked for comparing the two provided tasks. If a rule 
    26  * returns a task equality other than null, this equality is returned. Otherwise the next rule 
    27  * is asked. 
     25 * The task equality rule manager is capable of comparing tasks and task instances based on its 
     26 * internal list of comparison rules. These rules are asked for comparing the two provided tasks or 
     27 * task instance. If a rule returns a task equality other than null, this equality is returned. 
     28 * Otherwise the next rule is asked. 
    2829 * </p> 
    2930 *  
    30  * @version $Revision: $ $Date: 19.02.2012$ 
    31  * @author 2012, last modified by $Author: patrick$ 
     31 * @author Patrick Harms 
    3232 */ 
    3333public class TaskEqualityRuleManager { 
     
    269269    } 
    270270 
     271    /** 
     272     * <p> 
     273     * this method performs a comparison of the two provided task instances. It iterates its 
     274     * internal comparison rules. If the first rule returns a task instance equality other than 
     275     * null, this equality is returned. Otherwise the next rule is tried. If no rule returns an 
     276     * equality <code>TaskEquality.UNEQUAL</code> is returned. 
     277     * </p> 
     278     *  
     279     * @param instance1 the first task instance to be compared 
     280     * @param instance2 the second task instance to be compared 
     281     *  
     282     * @return as described 
     283     *  
     284     * @throws IllegalStateException in the case, the {@link #init()} method was not called on the 
     285     *                               manager before a call to this method. 
     286     */ 
     287    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) 
     288        throws IllegalStateException 
     289    { 
     290        if (mRuleIndex == null) { 
     291            throw new IllegalStateException("not initialized"); 
     292        } 
     293         
     294        // LOG.info("checking for equality of " + instance1 + " and " + instance2); 
     295        TaskEquality instanceEquality = null; 
     296 
     297        for (TaskComparisonRule rule : mRuleIndex) { 
     298            if (rule.isApplicable(instance1, instance2)) { 
     299                instanceEquality = rule.compare(instance1, instance2); 
     300                if (instanceEquality != null) { 
     301                    // LOG.warning("used rule " + rule + " for equality check"); 
     302                    return instanceEquality; 
     303                } 
     304            } 
     305        } 
     306 
     307        // LOG.warning("no rule could be applied --> handling tasks as unequal"); 
     308 
     309        return TaskEquality.UNEQUAL; 
     310    } 
     311 
     312    /** 
     313     * <p> 
     314     * this method compares two task instances with respect to the given equality level and returns 
     315     * true, if this level is given. 
     316     * </p> 
     317     *  
     318     * @param instance1     the first task instance to be compared 
     319     * @param instance2     the second task instance to be compared 
     320     * @param equalityLevel the level of equality to be checked for 
     321     *  
     322     * @return as described 
     323     *  
     324     * @throws IllegalStateException in the case, the {@link #init()} method was not called on the 
     325     *                               manager before a call to this method. 
     326     */ 
     327    public boolean areAtLeastEqual(ITaskInstance        instance1, 
     328                                   ITaskInstance        instance2, 
     329                                   TaskEquality equalityLevel) 
     330    { 
     331        if (equalityLevel == null) { 
     332            throw new IllegalArgumentException("required equality level must not be null"); 
     333        } 
     334         
     335        switch (equalityLevel) { 
     336            case IDENTICAL: 
     337                return areIdentical(instance1, instance2); 
     338            case LEXICALLY_EQUAL: 
     339                return areLexicallyEqual(instance1, instance2); 
     340            case SYNTACTICALLY_EQUAL: 
     341                return areSyntacticallyEqual(instance1, instance2); 
     342            case SEMANTICALLY_EQUAL: 
     343                return areSemanticallyEqual(instance1, instance2); 
     344            case UNEQUAL: 
     345                return !areSemanticallyEqual(instance1, instance2); 
     346            default: 
     347                throw new IllegalArgumentException("unknown required equality: " + equalityLevel); 
     348        } 
     349    } 
     350 
     351    /** 
     352     * <p> 
     353     * this method checks if the two given task instances are identical. For this, it iterates its 
     354     * internal comparison rules. If the first rule returns true, than this method returns true 
     355     * as well. If no rule returns true, this method returns false. 
     356     * </p> 
     357     *  
     358     * @param instance1 the first task instance to be compared 
     359     * @param instance2 the second task instance to be compared 
     360     *  
     361     * @return as described 
     362     *  
     363     * @throws IllegalStateException in the case, the {@link #init()} method was not called on the 
     364     *                               manager before a call to this method. 
     365     */ 
     366    public boolean areIdentical(ITaskInstance instance1, ITaskInstance instance2) { 
     367        if (mRuleIndex == null) { 
     368            throw new IllegalStateException("not initialized"); 
     369        } 
     370         
     371        for (TaskComparisonRule rule : mRuleIndex) { 
     372            if (rule.isApplicable(instance1, instance2) && 
     373                rule.areLexicallyEqual(instance1, instance2)) 
     374            { 
     375                return true; 
     376            } 
     377        } 
     378 
     379        return false; 
     380    } 
     381 
     382    /** 
     383     * <p> 
     384     * this method checks if the two given task instances are lexically equal. For this, it 
     385     * iterates its internal comparison rules. If the first rule returns true, than this method 
     386     * returns true, as well. If no rule returns true, this method returns false. 
     387     * </p> 
     388     *  
     389     * @param instance1 the first task instance to be compared 
     390     * @param instance2 the second task instance to be compared 
     391     *  
     392     * @return as described 
     393     *  
     394     * @throws IllegalStateException in the case, the {@link #init()} method was not called on the 
     395     *                               manager before a call to this method. 
     396     */ 
     397    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     398        if (mRuleIndex == null) { 
     399            throw new IllegalStateException("not initialized"); 
     400        } 
     401         
     402        for (TaskComparisonRule rule : mRuleIndex) { 
     403            if (rule.isApplicable(instance1, instance2) && 
     404                rule.areLexicallyEqual(instance1, instance2)) 
     405            { 
     406                return true; 
     407            } 
     408        } 
     409 
     410        return false; 
     411    } 
     412 
     413    /** 
     414     * <p> 
     415     * this method checks if the two given task instances are syntactically equal. For this, it 
     416     * iterates its internal comparison rules. If the first rule returns true, than this method 
     417     * returns true, as well. If no rule returns true, this method returns false. 
     418     * </p> 
     419     *  
     420     * @param instance1 the first task instance to be compared 
     421     * @param instance2 the second task instance to be compared 
     422     *  
     423     * @return as described 
     424     *  
     425     * @throws IllegalStateException in the case, the {@link #init()} method was not called on the 
     426     *                               manager before a call to this method. 
     427     */ 
     428    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     429        if (mRuleIndex == null) { 
     430            throw new IllegalStateException("not initialized"); 
     431        } 
     432         
     433        for (TaskComparisonRule rule : mRuleIndex) { 
     434            if (rule.isApplicable(instance1, instance2) && 
     435                rule.areSyntacticallyEqual(instance1, instance2)) 
     436            { 
     437                return true; 
     438            } 
     439        } 
     440 
     441        return false; 
     442    } 
     443 
     444    /** 
     445     * <p> 
     446     * this method checks if the two given task instances are semantically equal. For this, it 
     447     * iterates its internal comparison rules. If the first rule returns true, than this method 
     448     * returns true, as well. If no rule returns true, this method returns false. 
     449     * </p> 
     450     *  
     451     * @param instance1 the first task instance to be compared 
     452     * @param instance2 the second task instance to be compared 
     453     *  
     454     * @return as described 
     455     *  
     456     * @throws IllegalStateException in the case, the {@link #init()} method was not called on the 
     457     *                               manager before a call to this method. 
     458     */ 
     459    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     460        if (mRuleIndex == null) { 
     461            throw new IllegalStateException("not initialized"); 
     462        } 
     463         
     464        for (TaskComparisonRule rule : mRuleIndex) { 
     465            if (rule.isApplicable(instance1, instance2) && 
     466                rule.areSemanticallyEqual(instance1, instance2)) 
     467            { 
     468                 return true; 
     469            } 
     470        } 
     471 
     472        return false; 
     473    } 
     474 
    271475} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskIdentityRule.java

    r1146 r1294  
    1616 
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1819 
    1920/** 
    2021 * <p> 
    2122 * This comparison rule returns <code>TaskEquality.IDENTICAL</code> if the comparison of the two 
    22  * tasks using the <code>==</code> operator or the <code>equals</code> method return true. 
    23  * Else it returns null to denote, that it can not compare the tasks. 
     23 * tasks using the <code>==</code> operator returns true. Else it returns null to denote, that 
     24 * it can not compare the tasks. 
    2425 * </p> 
    2526 *  
     
    3031 
    3132    /* (non-Javadoc) 
    32      * @see NodeComparisonRule#isApplicable(ITask, ITask) 
     33     * @see TaskComparisonRule#isApplicable(ITask, ITask) 
    3334     */ 
    3435    @Override 
     
    3839 
    3940    /* (non-Javadoc) 
    40      * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 
     41     * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask) 
    4142     */ 
    4243    @Override 
     
    4647 
    4748    /* (non-Javadoc) 
    48      * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 
     49     * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask) 
    4950     */ 
    5051    @Override 
     
    5455 
    5556    /* (non-Javadoc) 
    56      * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 
     57     * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask) 
    5758     */ 
    5859    @Override 
     
    6263 
    6364    /* (non-Javadoc) 
    64      * @see NodeComparisonRule#compare(ITask, ITask) 
     65     * @see TaskComparisonRule#compare(ITask, ITask) 
    6566     */ 
    6667    @Override 
     
    7475    } 
    7576 
     77    /* (non-Javadoc) 
     78     * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance) 
     79     */ 
     80    @Override 
     81    public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) { 
     82        return (instance1.getTask() == instance2.getTask()); 
     83    } 
     84 
     85    /* (non-Javadoc) 
     86     * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance) 
     87     */ 
     88    @Override 
     89    public boolean areLexicallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     90        return (instance1.getTask() == instance2.getTask()); 
     91    } 
     92 
     93    /* (non-Javadoc) 
     94     * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance, ITaskInstance) 
     95     */ 
     96    @Override 
     97    public boolean areSyntacticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     98        return (instance1.getTask() == instance2.getTask()); 
     99    } 
     100 
     101    /* (non-Javadoc) 
     102     * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance, ITaskInstance) 
     103     */ 
     104    @Override 
     105    public boolean areSemanticallyEqual(ITaskInstance instance1, ITaskInstance instance2) { 
     106        return (instance1.getTask() == instance2.getTask()); 
     107    } 
     108 
     109    /* (non-Javadoc) 
     110     * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance) 
     111     */ 
     112    @Override 
     113    public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) { 
     114        if (isApplicable(instance1, instance2)) { 
     115            return TaskEquality.IDENTICAL; 
     116        } 
     117        else { 
     118            return null; 
     119        } 
     120    } 
     121 
    76122} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/ITaskInstanceScopeRule.java

    r1219 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 
    1616 
    17 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 
     17import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1818 
    1919/** 
    2020 * <p> 
    21  * a task instance list scope rule is able to detected temporal relationships between a list of task 
    22  * instances provided to the {@link #apply(ITaskInstanceList)} method. A rule creates temporal 
     21 * a task instance scope rule is able to detected temporal relationships between the children of 
     22 * a task instance provided to the {@link #apply(ITaskInstance)} method. A rule creates temporal 
    2323 * relationships between the task instances, i.e. substructures in the task tree, if 
    2424 * it detects a temporal relationship and instantiates the temporal relationships accordingly. 
     
    2727 * @author Patrick Harms 
    2828 */ 
    29 interface ITaskInstanceListScopeRule extends ITemporalRelationshipRule { 
     29interface ITaskInstanceScopeRule extends ITemporalRelationshipRule { 
    3030 
    3131  /** 
    3232   * <p> 
    33    * applies the rule to the given task instance list. The returned rule application result is null, 
     33   * applies the rule to the given task instance. The returned rule application result is null, 
    3434   * if the rule can not be applied, i.e. it does not detect a temporal relationship. It returns a 
    3535   * rule application result with a status {@link RuleApplicationStatus#RULE_APPLICATION_FINISHED} 
     
    3737   * </p> 
    3838   *  
    39    * @param taskInstances the list of task instances to apply the rule on 
     39   * @param taskInstance the task instances to apply the rule on 
    4040   *                     
    4141   * @return the rule application result as described. 
    4242   */ 
    43   RuleApplicationResult apply(ITaskInstanceList taskInstances); 
     43  RuleApplicationResult apply(ITaskInstance taskInstance); 
    4444   
    4545} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/ITemporalRelationshipRule.java

    r1284 r1294  
    1919 * a temporal relationship rule is the main interface for all rules applied for generating 
    2020 * temporal relationships in a task tree. It is just a marker interface. More important are the 
    21  * sub interfaces {@link ISessionScopeRule} and {@link ITaskInstanceListScopeRule}. 
     21 * sub interfaces {@link ISessionScopeRule} and {@link ITaskInstanceScopeRule}. 
    2222 * </p> 
    2323 *  
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java

    r1281 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 
    1616 
    17 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     17import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     18import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    1819import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    1920import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     
    5556                                               int               startIndex, 
    5657                                               int               endIndex, 
    57                                                ITask             model, 
     58                                               ISequence         model, 
    5859                                               ITaskFactory      taskFactory, 
    5960                                               ITaskBuilder      taskBuilder) 
    6061    { 
    61         ITaskInstance subsequence = taskFactory.createNewTaskInstance(model); 
     62        ISequenceInstance subsequence = taskFactory.createNewTaskInstance(model); 
    6263 
    6364        for (int i = startIndex; i <= endIndex; i++) { 
     
    8384     * @return the replacement for the range 
    8485     */ 
    85     static ITaskInstance createNewSubSequenceInRange(ITaskInstanceList parent, 
    86                                                      int               startIndex, 
    87                                                      int               endIndex, 
    88                                                      ITask             model, 
    89                                                      ITaskFactory      taskFactory, 
    90                                                      ITaskBuilder      taskBuilder) 
     86    static ISequenceInstance createNewSubSequenceInRange(ITaskInstanceList parent, 
     87                                                         int               startIndex, 
     88                                                         int               endIndex, 
     89                                                         ISequence         model, 
     90                                                         ITaskFactory      taskFactory, 
     91                                                         ITaskBuilder      taskBuilder) 
    9192    { 
    92         ITaskInstance subsequence = taskFactory.createNewTaskInstance(model); 
     93        ISequenceInstance subsequence = taskFactory.createNewTaskInstance(model); 
    9394 
    9495        for (int i = startIndex; i <= endIndex; i++) { 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java

    r1287 r1294  
    2626import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2727import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2829import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2931import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3134import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    159162        SymbolMap<ITaskInstance, ITask> uniqueTasks = 
    160163            preparationTaskHandlingStrategy.createSymbolMap(); 
    161         TaskComparator comparator = preparationTaskHandlingStrategy.getTaskComparator(); 
     164        TaskInstanceComparator comparator = preparationTaskHandlingStrategy.getTaskComparator(); 
    162165         
    163166        int unifiedTasks = 0; 
     
    235238    { 
    236239        Map<ITask, IIteration> iterations = new HashMap<ITask, IIteration>(); 
    237         Map<IIteration, List<ITaskInstance>> iterationInstances = 
    238                 new HashMap<IIteration, List<ITaskInstance>>(); 
     240        Map<IIteration, List<IIterationInstance>> iterationInstances = 
     241                new HashMap<IIteration, List<IIterationInstance>>(); 
    239242             
    240243        for (ITask iteratedTask : iteratedTasks) { 
    241244            IIteration iteration = taskFactory.createNewIteration(); 
    242245            iterations.put(iteratedTask, iteration); 
    243             iterationInstances.put(iteration, new LinkedList<ITaskInstance>()); 
    244         } 
    245          
    246         ITaskInstance iterationInstance = null; 
     246            iterationInstances.put(iteration, new LinkedList<IIterationInstance>()); 
     247        } 
     248         
     249        IIterationInstance iterationInstance = null; 
    247250         
    248251        for (IUserSession session : sessions) { 
     
    275278        } 
    276279         
    277         for (Map.Entry<IIteration, List<ITaskInstance>> entry : iterationInstances.entrySet()) { 
     280        for (Map.Entry<IIteration, List<IIterationInstance>> entry : iterationInstances.entrySet()) 
     281        { 
    278282            harmonizeIterationInstancesModel(entry.getKey(), entry.getValue()); 
    279283        } 
     
    283287     * 
    284288     */ 
    285     private void harmonizeIterationInstancesModel(IIteration          iteration, 
    286                                                   List<ITaskInstance> iterationInstances) 
     289    private void harmonizeIterationInstancesModel(IIteration               iteration, 
     290                                                  List<IIterationInstance> iterationInstances) 
    287291    { 
    288292        List<ITask> iteratedTaskVariants = new LinkedList<ITask>(); 
    289         TaskComparator comparator = preparationTaskHandlingStrategy.getTaskComparator(); 
     293        TaskInstanceComparator comparator = preparationTaskHandlingStrategy.getTaskComparator(); 
    290294         
    291295        // merge the lexically different variants of iterated task to a unique list  
    292         for (ITaskInstance iterationInstance : iterationInstances) { 
     296        for (IIterationInstance iterationInstance : iterationInstances) { 
    293297            for (ITaskInstance executionVariant : iterationInstance) { 
    294298                ITask candidate = executionVariant.getTask(); 
     
    323327            taskBuilder.setMarkedTask(iteration, selection); 
    324328             
    325             for (ITaskInstance instance : iterationInstances) { 
     329            for (IIterationInstance instance : iterationInstances) { 
    326330                for (int i = 0; i < instance.size(); i++) { 
    327                     ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 
    328                     taskBuilder.addChild(selectionInstance, instance.get(i)); 
     331                    ISelectionInstance selectionInstance = 
     332                        taskFactory.createNewTaskInstance(selection); 
     333                    taskBuilder.setChild(selectionInstance, instance.get(i)); 
    329334                    taskBuilder.setTaskInstance(instance, i, selectionInstance); 
    330335                } 
     
    490495                Console.traceln(Level.FINEST, "replacing " + sequence.getId() + ": " + task); 
    491496 
    492                 List<ITaskInstance> sequenceInstances = 
     497                List<ISequenceInstance> sequenceInstances = 
    493498                    replaceTaskOccurrences(task, appData.getSessions(), sequence); 
    494499                 
     
    510515     * 
    511516     */ 
    512     private void harmonizeSequenceInstancesModel(ISequence           sequence, 
    513                                                  List<ITaskInstance> sequenceInstances, 
    514                                                  int                 sequenceLength) 
     517    private void harmonizeSequenceInstancesModel(ISequence               sequence, 
     518                                                 List<ISequenceInstance> sequenceInstances, 
     519                                                 int                     sequenceLength) 
    515520    { 
    516         TaskComparator comparator = preparationTaskHandlingStrategy.getTaskComparator(); 
     521        TaskInstanceComparator comparator = preparationTaskHandlingStrategy.getTaskComparator(); 
    517522         
    518523        // ensure for each subtask that lexically different variants are preserved 
     
    520525            List<ITask> subTaskVariants = new LinkedList<ITask>(); 
    521526             
    522             for (ITaskInstance sequenceInstance : sequenceInstances) { 
     527            for (ISequenceInstance sequenceInstance : sequenceInstances) { 
    523528                ITask candidate = sequenceInstance.get(subTaskIndex).getTask(); 
    524529                 
     
    556561                taskBuilder.addChild(sequence, selection); 
    557562                 
    558                 for (ITaskInstance instance : sequenceInstances) { 
    559                     ITaskInstance selectionInstance = 
     563                for (ISequenceInstance instance : sequenceInstances) { 
     564                    ISelectionInstance selectionInstance = 
    560565                        taskFactory.createNewTaskInstance(selection); 
    561                     taskBuilder.addChild(selectionInstance, instance.get(subTaskIndex)); 
     566                    taskBuilder.setChild(selectionInstance, instance.get(subTaskIndex)); 
    562567                    taskBuilder.setTaskInstance(instance, subTaskIndex, selectionInstance); 
    563568                } 
     
    572577     * @param tree 
    573578     */ 
    574     private List<ITaskInstance> replaceTaskOccurrences(List<ITaskInstance> task, 
    575                                                        List<IUserSession>  sessions, 
    576                                                        ISequence           temporalTaskModel) 
     579    private List<ISequenceInstance> replaceTaskOccurrences(List<ITaskInstance> task, 
     580                                                           List<IUserSession>  sessions, 
     581                                                           ISequence           temporalTaskModel) 
    577582    { 
    578         List<ITaskInstance> sequenceInstances = new LinkedList<ITaskInstance>(); 
     583        List<ISequenceInstance> sequenceInstances = new LinkedList<ISequenceInstance>(); 
    579584         
    580585        for (IUserSession session : sessions) { 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskHandlingStrategy.java

    r1285 r1294  
    4242     *  
    4343     */ 
    44     private TaskComparator comparator; 
     44    private TaskInstanceComparator comparator; 
    4545 
    4646    /** 
     
    5858        } 
    5959        else { 
    60             comparator = new TaskComparator(this.consideredEquality); 
     60            comparator = new TaskInstanceComparator(this.consideredEquality); 
    6161        } 
    6262    } 
     
    7777     * @return 
    7878     */ 
    79     public TaskComparator getTaskComparator() { 
     79    public TaskInstanceComparator getTaskComparator() { 
    8080        return comparator; 
    8181    } 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskIdentityComparator.java

    r1285 r1294  
    2121 * TODO comment 
    2222 */ 
    23 class TaskIdentityComparator extends TaskComparator { 
     23class TaskIdentityComparator extends TaskInstanceComparator { 
    2424 
    2525    /**  */ 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceComparator.java

    r1285 r1294  
    2828 * TODO comment 
    2929 */ 
    30 class TaskComparator implements SymbolComparator<ITaskInstance> { 
     30class TaskInstanceComparator implements SymbolComparator<ITaskInstance> { 
    3131     
    3232    /**  */ 
     
    5454     * 
    5555     */ 
    56     public TaskComparator(TaskEquality minimalNodeEquality) { 
     56    public TaskInstanceComparator(TaskEquality minimalNodeEquality) { 
    5757        this.minimalNodeEquality = minimalNodeEquality; 
    5858        init(); 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolBucketedMap.java

    r1285 r1294  
    2727 
    2828import de.ugoe.cs.autoquest.eventcore.IEventType; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    3433import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3534import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 
     
    8180     * </p> 
    8281     */ 
    83     private TaskComparator comparator; 
     82    private TaskInstanceComparator comparator; 
    8483 
    8584    /** 
     
    117116     * @throws IllegalArgumentException if the provided comparator is null 
    118117     */ 
    119     public TaskSymbolBucketedMap(TaskComparator comparator) { 
     118    public TaskSymbolBucketedMap(TaskInstanceComparator comparator) { 
    120119        if (comparator == null) { 
    121120            throw new IllegalArgumentException("comparator must not be null"); 
     
    400399        // other = hashCode of name of event type 
    401400         
    402         ITask task = taskInstance.getTask(); 
    403          
    404         if (task instanceof IEventTask) { 
     401        if (taskInstance instanceof IEventTaskInstance) { 
    405402            // event tasks are most likely equal to those of the event type with the same name, 
    406403            // Afterwards, they may be equal to iterations, optionals, other event tasks, 
    407404            // selections, and finally the rest. 
    408             IEventType eventType = ((IEventTask) task).getEventType(); 
     405            IEventType eventType = ((IEventTaskInstance) taskInstance).getEvent().getType(); 
    409406            return new int[] { eventType.getName().hashCode(), 2, 3, 4, 1 };                        
    410407        } 
    411         else if (task instanceof ISequence) { 
     408        else if (taskInstance instanceof ISequenceInstance) { 
    412409            return new int[] { 0, 2, 3, 1 };                        
    413410        } 
    414         else if (task instanceof ISelection) { 
     411        else if (taskInstance instanceof ISelectionInstance) { 
    415412            return new int[] { 1, 4, 2, 3 };                        
    416413        } 
    417         else if (task instanceof IIteration) { 
     414        else if (taskInstance instanceof IIterationInstance) { 
    418415            return new int[] { 2, 1, 4 };                        
    419416        } 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java

    r1189 r1294  
    2626import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    2727import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 
    2928import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    3029import de.ugoe.cs.util.console.Console; 
     
    3837 * between tasks which are not only a major sequence. I.e. through the application of the 
    3938 * rules iterations and selections of tasks are detected. Which kind of temporal relations 
    40  * between tasks are detected depends on the {@link ITaskInstanceListScopeRule}s known to 
     39 * between tasks are detected depends on the {@link ITaskInstanceScopeRule}s known to 
    4140 * this class. 
    4241 * </p> 
    43  * <p>The class holds references to the appropriate {@link ITaskInstanceListScopeRule}s and calls 
    44  * their {@link ITaskInstanceListScopeRule#apply(ITask, ITaskBuilder, ITaskFactory, boolean)} 
     42 * <p>The class holds references to the appropriate {@link ITaskInstanceScopeRule}s and calls 
     43 * their {@link ITaskInstanceScopeRule#apply(ITask, ITaskBuilder, ITaskFactory, boolean)} 
    4544 * method for each task in the task tree it is needed for. The general behavior of this class is 
    4645 * the following: 
     
    5655 *   <li> 
    5756 *     the class iterates its internal list of rules and calls their 
    58  *     {@link ITaskInstanceListScopeRule#apply(ITask, ITaskBuilder, ITaskFactory, boolean)} 
     57 *     {@link ITaskInstanceScopeRule#apply(ITask, ITaskBuilder, ITaskFactory, boolean)} 
    5958 *     method. 
    6059 *   </li> 
     
    115114     * </p> 
    116115     */ 
    117     private ITaskInstanceListScopeRule[] taskScopeRules; 
     116    private ITaskInstanceScopeRule[] taskScopeRules; 
    118117 
    119118    /** 
     
    166165        //treeScopeRules.add(new DefaultGuiElementSequenceDetectionRule(frameFilter)); 
    167166 
    168         taskScopeRules = new ITaskInstanceListScopeRule[] { 
     167        taskScopeRules = new ITaskInstanceScopeRule[] { 
    169168            //new SequenceOnGuiElementDetectionRule(taskFactory, taskTreeBuilder), 
    170169            //new EventSequenceOnSameTargetDetectionRule(taskFactory, taskTreeBuilder), 
     
    262261     *                     on the recursion depth of calling this method. 
    263262     */ 
    264     private int applyRules(ITaskInstanceListScopeRule[] rules, 
    265                            ITaskInstanceList            taskInstances, 
     263    private int applyRules(ITaskInstanceScopeRule[] rules, 
     264                           ITaskInstance                taskInstance, 
    266265                           String                       logIndent) 
    267266    { 
    268         Console.traceln(Level.FINER, logIndent + "applying rules for " + taskInstances.size() + 
    269                         " task instances"); 
     267        Console.traceln(Level.FINER, logIndent + "applying rules on " + taskInstance); 
    270268 
    271269        int noOfRuleApplications = 0; 
    272270 
    273         for (ITaskInstanceListScopeRule rule : rules) { 
     271        for (ITaskInstanceScopeRule rule : rules) { 
    274272            RuleApplicationResult result; 
    275273            do { 
    276274                Console.traceln 
    277                     (Level.FINER, logIndent + "trying rule " + rule + " on " + taskInstances); 
    278                 result = rule.apply(taskInstances); 
     275                    (Level.FINER, logIndent + "trying rule " + rule + " on " + taskInstance); 
     276                result = rule.apply(taskInstance); 
    279277 
    280278                if ((result != null) && 
     
    282280                { 
    283281                    Console.traceln 
    284                         (Level.FINE, logIndent + "applied rule " + rule + " on " + taskInstances); 
     282                        (Level.FINE, logIndent + "applied rule " + rule + " on " + taskInstance); 
    285283                    noOfRuleApplications++; 
    286284                     
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IEventTask.java

    r1180 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
    17 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    18 import de.ugoe.cs.autoquest.eventcore.IEventType; 
    19  
    2017/** 
    2118 * <p> 
    2219 * Event tasks represent single events. They have no children and are therefore the leaf nodes of 
    23  * a task model. They provide information about the event they represent. This includes the event 
    24  * type and the target. 
     20 * a task model. They provide information about the event they represent as a String description. 
     21 * They do not refer to events, as they may represented several semantically equal but lexically 
     22 * different events. Their description carries as much information as required to show the 
     23 * level of distinction. 
    2524 * </p> 
    2625 *  
     
    2928public interface IEventTask extends ITask { 
    3029     
    31     /** 
    32      * <p> 
    33      * return the type of the event represented by this task 
    34      * </p> 
    35      *  
    36      * @return as described 
    37      */ 
    38     public IEventType getEventType(); 
    39  
    40     /** 
    41      * <p> 
    42      * return the target of the event represented by this task 
    43      * </p> 
    44      *  
    45      * @return as described 
    46      */ 
    47     public IEventTarget getEventTarget(); 
    48  
    4930    /** 
    5031     * <p> 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITask.java

    r1180 r1294  
    1616 
    1717import java.io.Serializable; 
     18import java.util.Collection; 
    1819 
    1920/** 
     
    4950     */ 
    5051    public String getDescription(); 
     52 
     53    /** 
     54     * <p> 
     55     * returns a collection of all observed instances of this task 
     56     * </p> 
     57     *  
     58     * @return as described 
     59     */ 
     60    public Collection<ITaskInstance> getInstances(); 
    5161 
    5262    /** 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskBuilder.java

    r1197 r1294  
    2626    /** 
    2727     * <p> 
    28      * adds a child to a task instance. May ensure, that the child is a valid child considering 
     28     * adds a child to a sequence instance. May ensure, that the child is a valid child considering 
    2929     * the task model of the parent. In that case, an IllegalArgumentException is thrown. 
    3030     * </p> 
    3131     *  
    32      * @param taskInstance the instance of add the child to 
    33      * @param child        the child to be added 
    34      *  
    35      * @throws IllegalArgumentException as described 
    36      */ 
    37     void addChild(ITaskInstance taskInstance, ITaskInstance child) throws IllegalArgumentException; 
     32     * @param instance the instance of add the child to 
     33     * @param child    the child to be added 
     34     *  
     35     * @throws IllegalArgumentException as described 
     36     */ 
     37    void addChild(ISequenceInstance instance, ITaskInstance child) throws IllegalArgumentException; 
     38 
     39    /** 
     40     * <p> 
     41     * adds a child to an iteration instance. May ensure, that the child is a valid child 
     42     * considering the task model of the parent. In that case, an IllegalArgumentException is 
     43     * thrown. 
     44     * </p> 
     45     *  
     46     * @param instance the instance of add the child to 
     47     * @param child    the child to be added 
     48     *  
     49     * @throws IllegalArgumentException as described 
     50     */ 
     51    void addChild(IIterationInstance instance, ITaskInstance child) throws IllegalArgumentException; 
     52 
     53    /** 
     54     * <p> 
     55     * sets the child of a selection instance. May ensure, that the child is a valid child 
     56     * considering the task model of the parent. In that case, an IllegalArgumentException is 
     57     * thrown. 
     58     * </p> 
     59     *  
     60     * @param instance the instance of add the child to 
     61     * @param child    the child to be added 
     62     *  
     63     * @throws IllegalArgumentException as described 
     64     */ 
     65    void setChild(ISelectionInstance instance, ITaskInstance child) throws IllegalArgumentException; 
     66 
     67    /** 
     68     * <p> 
     69     * sets the child of an optional instance. May ensure, that the child is a valid child 
     70     * considering the task model of the parent. In that case, an IllegalArgumentException is 
     71     * thrown. 
     72     * </p> 
     73     *  
     74     * @param instance the instance of add the child to 
     75     * @param child    the child to be added 
     76     *  
     77     * @throws IllegalArgumentException as described 
     78     */ 
     79    void setChild(IOptionalInstance instance, ITaskInstance child) throws IllegalArgumentException; 
    3880 
    3981    /** 
     
    215257    void replaceChild(ISelection parent, ITask oldChild, ITask newChild); 
    216258 
    217     /** 
    218      * <p> 
    219      * sets the description of a task 
    220      * </p> 
    221      *  
    222      * @param task        the task to set the description of 
    223      * @param description the new description of the task 
    224      */ 
    225     void setDescription(ITask task, String description); 
    226  
    227259} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskFactory.java

    r1191 r1294  
    1717import java.util.List; 
    1818 
    19 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    20 import de.ugoe.cs.autoquest.eventcore.IEventType; 
     19import de.ugoe.cs.autoquest.eventcore.Event; 
    2120 
    2221/** 
     
    3130    /** 
    3231     * <p> 
    33      * creates a new event task with the given type and target 
     32     * creates a new event task with the given description 
    3433     * </p> 
    3534     *  
    36      * @param eventType   the type of the event represented by the task 
    37      * @param eventTarget the target of the event represented by the task 
     35     * @param description the description for the represented events 
    3836     *  
    3937     * @return the event task 
    4038     */ 
    41     IEventTask createNewEventTask(IEventType eventType, IEventTarget eventTarget); 
     39    IEventTask createNewEventTask(String description); 
    4240 
    4341    /** 
     
    7977    /** 
    8078     * <p> 
    81      * creates a new task instance with the given task as its model 
     79     * creates a new task instance with the given task as its model representing the provided event 
    8280     * </p> 
    8381     *  
    84      * @param task the model of the task instance to be created 
     82     * @param task  the model of the task instance to be created 
     83     * @param event the event represented by the task instance 
    8584     *  
    8685     * @return the task instance 
    8786     */ 
    88     ITaskInstance createNewTaskInstance(ITask task); 
     87    IEventTaskInstance createNewTaskInstance(IEventTask task, Event event); 
    8988 
    9089    /** 
    9190     * <p> 
    92      * creates a new empty task instance list 
     91     * creates a new task instance with the given sequence as its model 
    9392     * </p> 
    9493     *  
    95      * @return the task instance list 
     94     * @param sequence the model of the task instance to be created 
     95     *  
     96     * @return the task instance 
    9697     */ 
    97     ITaskInstanceList createNewTaskInstanceList(); 
     98    ISequenceInstance createNewTaskInstance(ISequence sequence); 
     99 
     100    /** 
     101     * <p> 
     102     * creates a new task instance with the given iteration as its model 
     103     * </p> 
     104     *  
     105     * @param iteration the model of the task instance to be created 
     106     *  
     107     * @return the task instance 
     108     */ 
     109    IIterationInstance createNewTaskInstance(IIteration iteration); 
     110 
     111    /** 
     112     * <p> 
     113     * creates a new task instance with the given optional as its model 
     114     * </p> 
     115     *  
     116     * @param optional the model of the task instance to be created 
     117     *  
     118     * @return the task instance 
     119     */ 
     120    IOptionalInstance createNewTaskInstance(IOptional optional); 
     121 
     122    /** 
     123     * <p> 
     124     * creates a new task instance with the given selection as its model 
     125     * </p> 
     126     *  
     127     * @param selection the model of the task instance to be created 
     128     *  
     129     * @return the task instance 
     130     */ 
     131    ISelectionInstance createNewTaskInstance(ISelection selection); 
    98132 
    99133    /** 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstance.java

    r1177 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
    17 import java.util.List; 
     17import java.io.Serializable; 
    1818 
    1919/** 
    2020 * <p> 
    2121 * a task instance represents the execution of a specific task within a user session. A task 
    22  * instance is always related to the task that was executed. A task instance may have children 
    23  * but only if its related task allows to have children. For example, if the represented task is 
    24  * a sequence then task instance has children and these are instances of the tasks being the 
    25  * children of the related sequence. 
    26  * </p> 
    27  * <p> 
    28  * An instance of a sequence has the same number of children as the related sequence. An instance 
    29  * of a selection has only one child which is an instance of exactly one variant contained in the 
    30  * related selection. An instance of an iteration has zero or more instances of the same task 
    31  * as children where the task is the child of the related iteration. An instance of an optional 
    32  * has zero or one child where the task related to child is the child of the optional. A task 
    33  * instance related to an event task does not have children. 
     22 * instance is always related to the task that was executed. 
    3423 * </p> 
    3524 *  
    3625 * @author Patrick Harms 
    3726 */ 
    38 public interface ITaskInstance extends ITaskInstanceList { 
    39  
    40     /** 
    41      * <p> 
    42      * returns the children of the task instance if any. See class description for how many 
    43      * children can be expected. May return null. 
    44      * </p> 
    45      *  
    46      * @return as described 
    47      */ 
    48     public List<ITaskInstance> getChildren(); 
     27public interface ITaskInstance extends Serializable, Cloneable { 
    4928 
    5029    /** 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstanceList.java

    r1177 r1294  
    1919/** 
    2020 * <p> 
    21  * represents a serializable, clonable, iterable representation of a read only list of task 
     21 * represents a serializable and iterable representation of a read only list of task 
    2222 * instances. The list is ordered. It does not provide methods for changing it. 
    2323 * </p> 
     
    2525 * @author Patrick Harms 
    2626 */ 
    27 public interface ITaskInstanceList extends Serializable, Cloneable, Iterable<ITaskInstance> { 
     27public interface ITaskInstanceList extends Serializable, Iterable<ITaskInstance> { 
    2828 
    2929    /** 
     
    4848    public int size(); 
    4949 
    50     /** 
    51      * <p> 
    52      * clones a task instance list by creating exact clones of each contained instance in their 
    53      * order 
    54      * </p> 
    55      *  
    56      * @return a clone of the task instance list 
    57      */ 
    58     public ITaskInstanceList clone(); 
    59    
    6050} 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/EventTask.java

    r1255 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.treeimpl; 
    1616 
    17 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    18 import de.ugoe.cs.autoquest.eventcore.IEventType; 
    1917import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    2018import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
     
    3937    /** 
    4038     * <p> 
    41      * the type of the represented event 
    42      * </p>  
    43      */ 
    44     private IEventType eventType; 
    45  
    46     /** 
    47      * <p> 
    48      * the target of the represented event 
    49      * </p>  
    50      */ 
    51     private IEventTarget eventTarget; 
    52  
    53     /** 
    54      * <p> 
    55      * simple constructor initializing this task with an event type and an event target 
     39     * simple constructor initializing this task with a description for the represented events 
    5640     * </p> 
    5741     *  
    58      * @param eventType   the type of the represented event 
    59      * @param eventTarget the target of the represented event 
     42     * @param description a description for the represented events 
    6043     */ 
    61     EventTask(IEventType eventType, IEventTarget eventTarget) { 
    62         super.setDescription(eventType.toString() + " \u21D2 " + eventTarget); 
    63         this.eventType = eventType; 
    64         this.eventTarget = eventTarget; 
    65     } 
    66  
    67     /* (non-Javadoc) 
    68      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask#getEventType() 
    69      */ 
    70     @Override 
    71     public IEventType getEventType() { 
    72         return eventType; 
    73     } 
    74  
    75     /* (non-Javadoc) 
    76      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask#getEventTarget() 
    77      */ 
    78     @Override 
    79     public IEventTarget getEventTarget() { 
    80         return eventTarget; 
     44    EventTask(String description) { 
     45        super.setDescription(description); 
    8146    } 
    8247 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Task.java

    r1215 r1294  
    1515package de.ugoe.cs.autoquest.tasktrees.treeimpl; 
    1616 
     17import java.util.Collection; 
     18import java.util.Collections; 
     19import java.util.HashSet; 
     20 
    1721import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1823import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
    1924 
     
    5661     */ 
    5762    private String description; 
     63     
     64    /** 
     65     * <p> 
     66     * the instances of this task 
     67     * </p> 
     68     */ 
     69    private Collection<ITaskInstance> instances = new HashSet<ITaskInstance>(); 
    5870 
    5971    /** 
     
    97109    public String getDescription() { 
    98110        return description; 
     111    } 
     112 
     113    /* (non-Javadoc) 
     114     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITask#getInstances() 
     115     */ 
     116    @Override 
     117    public Collection<ITaskInstance> getInstances() { 
     118        return Collections.unmodifiableCollection(instances); 
    99119    } 
    100120 
     
    163183    } 
    164184 
     185    /** 
     186     * <p> 
     187     * internally used to add an instance to this task 
     188     * </p> 
     189     *  
     190     * @param instance the instance belonging to this task 
     191     */ 
     192    void addInstance(ITaskInstance instance) { 
     193        this.instances.add(instance); 
     194    } 
     195     
    165196    /* (non-Javadoc) 
    166197     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITask#accept(ITaskVisitor) 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskBuilder.java

    r1216 r1294  
    1717import java.util.List; 
    1818 
    19 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    2019import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     20import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    2223import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     24import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2325import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     26import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2528import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    4144 
    4245    /* (non-Javadoc) 
    43      * @see ITaskBuilder#addChild(ITaskInstance,ITaskInstance) 
    44      */ 
    45     @Override 
    46     public void addChild(ITaskInstance parent, ITaskInstance child) throws IllegalArgumentException 
    47     { 
    48         if (!(parent instanceof TaskInstance)) { 
    49             throw new IllegalArgumentException 
    50                 ("illegal type of task instance provided: " + parent.getClass()); 
     46     * @see ITaskBuilder#addChild(ISequenceInstance, ITaskInstance) 
     47     */ 
     48    @Override 
     49    public void addChild(ISequenceInstance instance, ITaskInstance child) 
     50        throws IllegalArgumentException 
     51    { 
     52        if (!(instance instanceof SequenceInstance)) { 
     53            throw new IllegalArgumentException 
     54                ("illegal type of sequence instance provided: " + instance.getClass()); 
    5155        } 
    5256 
    5357        if (!(child instanceof TaskInstance)) { 
    5458            throw new IllegalArgumentException 
    55                 ("illegal type of task instance provided: " + parent.getClass()); 
    56         } 
    57          
    58         // check, that the correct number of children for the distinct types are added 
    59         ITask task = parent.getTask(); 
    60          
    61         if (task instanceof IEventTask) { 
    62             throw new IllegalArgumentException 
    63                 ("can not add children to a task instance of an event task"); 
    64         } 
    65         else if (task instanceof ISelection) { 
    66             if (parent.getChildren().size() > 0) { 
    67                 throw new IllegalArgumentException 
    68                     ("the instance of a selection must have at most one child"); 
     59                ("illegal type of task instance provided: " + child.getClass()); 
     60        } 
     61         
     62        /*IStructuringTemporalRelationship parentTask = 
     63            (IStructuringTemporalRelationship) parent.getTask(); 
     64         
     65        for (ITask parentTaskChild : parentTask.getChildren()) { 
     66            if (parentTaskChild.equals(child.getTask())) { 
     67                foundChildTask = true; 
     68                break; 
    6969            } 
    7070        } 
    71         else if (task instanceof IOptional) { 
    72             if (parent.getChildren().size() > 1) { 
    73                 throw new IllegalArgumentException 
    74                     ("the instance of an optional must have at most one child"); 
    75             } 
    76         } 
    77         /*else if (task instanceof IIteration) { 
    78             for (ITaskInstance childInstance : parent.getChildren()) { 
    79                 if (!childInstance.getTask().equals(child.getTask())) { 
    80                     throw new IllegalArgumentException 
    81                         ("all children of an instance of an iteration must have exactly the " + 
    82                          "same type"); 
    83                 } 
    84             } 
    85         } 
    86          
    87         boolean foundChildTask = false; 
    88         if (parent.getTask() instanceof IStructuringTemporalRelationship) { 
    89             IStructuringTemporalRelationship parentTask = 
    90                 (IStructuringTemporalRelationship) parent.getTask(); 
    91          
    92             for (ITask parentTaskChild : parentTask.getChildren()) { 
    93                 if (parentTaskChild.equals(child.getTask())) { 
    94                     foundChildTask = true; 
    95                     break; 
    96                 } 
    97             } 
    98         } 
    99         else if (parent.getTask() instanceof IMarkingTemporalRelationship) { 
    100             IMarkingTemporalRelationship parentTask = 
    101                 (IMarkingTemporalRelationship) parent.getTask(); 
    102              
    103             foundChildTask = parentTask.getMarkedTask() != null ? 
    104                 parentTask.getMarkedTask().equals(child.getTask()) : false; 
    105         } 
    106          
     71             
    10772        if (!foundChildTask) { 
    10873            throw new IllegalArgumentException 
     
    11176        }*/ 
    11277 
    113         // finally, after all checks are positive, add the child 
    114         ((TaskInstance) parent).addChild(child); 
     78        ((SequenceInstance) instance).addChild(child); 
     79    } 
     80 
     81    /* (non-Javadoc) 
     82     * @see ITaskBuilder#addChild(ISequenceInstance, int, ITaskInstance) 
     83     */ 
     84    public void addChild(ISequenceInstance instance, int index, ITaskInstance child) 
     85        throws IllegalArgumentException 
     86    { 
     87        if (!(instance instanceof SequenceInstance)) { 
     88            throw new IllegalArgumentException 
     89                ("illegal type of sequence instance provided: " + instance.getClass()); 
     90        } 
     91 
     92        if (!(child instanceof TaskInstance)) { 
     93            throw new IllegalArgumentException 
     94                ("illegal type of task instance provided: " + child.getClass()); 
     95        } 
     96         
     97        /*IStructuringTemporalRelationship parentTask = 
     98            (IStructuringTemporalRelationship) parent.getTask(); 
     99         
     100        for (ITask parentTaskChild : parentTask.getChildren()) { 
     101            if (parentTaskChild.equals(child.getTask())) { 
     102                foundChildTask = true; 
     103                break; 
     104            } 
     105        } 
     106             
     107        if (!foundChildTask) { 
     108            throw new IllegalArgumentException 
     109                ("the task of the child instance to be added does not belong to the children " + 
     110                 "of the task of the parent instance"); 
     111        }*/ 
     112 
     113        ((SequenceInstance) instance).addChild(index, child); 
     114    } 
     115 
     116    /* (non-Javadoc) 
     117     * @see ITaskBuilder#addChild(IIterationInstance, ITaskInstance) 
     118     */ 
     119    @Override 
     120    public void addChild(IIterationInstance instance, ITaskInstance child) 
     121        throws IllegalArgumentException 
     122    { 
     123        if (!(instance instanceof IterationInstance)) { 
     124            throw new IllegalArgumentException 
     125                ("illegal type of iteration instance provided: " + instance.getClass()); 
     126        } 
     127 
     128        if (!(child instanceof TaskInstance)) { 
     129            throw new IllegalArgumentException 
     130                ("illegal type of task instance provided: " + child.getClass()); 
     131        } 
     132         
     133        /*IStructuringTemporalRelationship parentTask = 
     134            (IStructuringTemporalRelationship) parent.getTask(); 
     135         
     136        IMarkingTemporalRelationship parentTask = 
     137            (IMarkingTemporalRelationship) parent.getTask(); 
     138             
     139        foundChildTask = parentTask.getMarkedTask() != null ? 
     140            parentTask.getMarkedTask().equals(child.getTask()) : false; 
     141             
     142        if (!foundChildTask) { 
     143            throw new IllegalArgumentException 
     144                ("the task of the child instance to be added does not belong to the children " + 
     145                 "of the task of the parent instance"); 
     146        }*/ 
     147 
     148        ((IterationInstance) instance).addChild(child); 
     149    } 
     150 
     151    /* (non-Javadoc) 
     152     * @see ITaskBuilder#addChild(IIterationInstance, int, ITaskInstance) 
     153     */ 
     154    public void addChild(IIterationInstance instance, int index, ITaskInstance child) 
     155        throws IllegalArgumentException 
     156    { 
     157        if (!(instance instanceof IterationInstance)) { 
     158            throw new IllegalArgumentException 
     159                ("illegal type of iteration instance provided: " + instance.getClass()); 
     160        } 
     161 
     162        if (!(child instanceof TaskInstance)) { 
     163            throw new IllegalArgumentException 
     164                ("illegal type of task instance provided: " + child.getClass()); 
     165        } 
     166         
     167        /*IStructuringTemporalRelationship parentTask = 
     168            (IStructuringTemporalRelationship) parent.getTask(); 
     169         
     170        IMarkingTemporalRelationship parentTask = 
     171            (IMarkingTemporalRelationship) parent.getTask(); 
     172             
     173        foundChildTask = parentTask.getMarkedTask() != null ? 
     174            parentTask.getMarkedTask().equals(child.getTask()) : false; 
     175             
     176        if (!foundChildTask) { 
     177            throw new IllegalArgumentException 
     178                ("the task of the child instance to be added does not belong to the children " + 
     179                 "of the task of the parent instance"); 
     180        }*/ 
     181 
     182        ((IterationInstance) instance).addChild(index, child); 
     183    } 
     184 
     185    /* (non-Javadoc) 
     186     * @see ITaskBuilder#setChild(ISelectionInstance, ITaskInstance) 
     187     */ 
     188    @Override 
     189    public void setChild(ISelectionInstance instance, ITaskInstance child) 
     190        throws IllegalArgumentException 
     191    { 
     192        if (!(instance instanceof SelectionInstance)) { 
     193            throw new IllegalArgumentException 
     194                ("illegal type of sequence instance provided: " + instance.getClass()); 
     195        } 
     196 
     197        if (!(child instanceof TaskInstance)) { 
     198            throw new IllegalArgumentException 
     199                ("illegal type of task instance provided: " + child.getClass()); 
     200        } 
     201         
     202        /*IStructuringTemporalRelationship parentTask = 
     203            (IStructuringTemporalRelationship) parent.getTask(); 
     204         
     205        for (ITask parentTaskChild : parentTask.getChildren()) { 
     206            if (parentTaskChild.equals(child.getTask())) { 
     207                foundChildTask = true; 
     208                break; 
     209            } 
     210        } 
     211             
     212        if (!foundChildTask) { 
     213            throw new IllegalArgumentException 
     214                ("the task of the child instance to be added does not belong to the children " + 
     215                 "of the task of the parent instance"); 
     216        }*/ 
     217 
     218        ((SelectionInstance) instance).setChild(child); 
     219    } 
     220 
     221    /* (non-Javadoc) 
     222     * @see ITaskBuilder#setChild(IOptionalInstance, ITaskInstance) 
     223     */ 
     224    @Override 
     225    public void setChild(IOptionalInstance instance, ITaskInstance child) 
     226        throws IllegalArgumentException 
     227    { 
     228        if (!(instance instanceof OptionalInstance)) { 
     229            throw new IllegalArgumentException 
     230                ("illegal type of optional instance provided: " + instance.getClass()); 
     231        } 
     232 
     233        if (!(child instanceof TaskInstance)) { 
     234            throw new IllegalArgumentException 
     235                ("illegal type of task instance provided: " + child.getClass()); 
     236        } 
     237         
     238        /*IStructuringTemporalRelationship parentTask = 
     239            (IStructuringTemporalRelationship) parent.getTask(); 
     240         
     241        IMarkingTemporalRelationship parentTask = 
     242            (IMarkingTemporalRelationship) parent.getTask(); 
     243             
     244        foundChildTask = parentTask.getMarkedTask() != null ? 
     245            parentTask.getMarkedTask().equals(child.getTask()) : false; 
     246             
     247        if (!foundChildTask) { 
     248            throw new IllegalArgumentException 
     249                ("the task of the child instance to be added does not belong to the children " + 
     250                 "of the task of the parent instance"); 
     251        }*/ 
     252 
     253        ((OptionalInstance) instance).setChild(child); 
    115254    } 
    116255 
     
    134273 
    135274    /* (non-Javadoc) 
     275     * @see ITaskBuilder#addExecutedTask(IUserSession, int, ITaskInstance) 
     276     */ 
     277    public void addExecutedTask(IUserSession session, int index, ITaskInstance taskInstance) { 
     278        if (!(session instanceof UserSession)) { 
     279            throw new IllegalArgumentException 
     280                ("illegal type of session provided: " + session.getClass()); 
     281        } 
     282 
     283        if (!(taskInstance instanceof TaskInstance)) { 
     284            throw new IllegalArgumentException 
     285                ("illegal type of task instance provided: " + taskInstance.getClass()); 
     286        } 
     287         
     288        ((UserSession) session).addExecutedTask(index, taskInstance); 
     289    } 
     290 
     291    /* (non-Javadoc) 
    136292     * @see ITaskBuilder#addTaskInstance(ITaskInstanceList, ITaskInstance) 
    137293     */ 
    138294    @Override 
    139295    public void addTaskInstance(ITaskInstanceList taskInstanceList, ITaskInstance taskInstance) { 
    140         if (taskInstanceList instanceof TaskInstance) { 
    141             ((TaskInstance) taskInstanceList).addChild(taskInstance); 
     296        if (taskInstanceList instanceof SequenceInstance) { 
     297            addChild((SequenceInstance) taskInstanceList, taskInstance); 
     298        } 
     299        else if (taskInstanceList instanceof IterationInstance) { 
     300            addChild((IterationInstance) taskInstanceList, taskInstance); 
    142301        } 
    143302        else if (taskInstanceList instanceof UserSession) { 
    144             ((UserSession) taskInstanceList).addExecutedTask(taskInstance); 
     303            addExecutedTask((UserSession) taskInstanceList, taskInstance); 
    145304        } 
    146305        else { 
     
    158317                                ITaskInstance     taskInstance) 
    159318    { 
    160         if (taskInstanceList instanceof TaskInstance) { 
    161             ((TaskInstance) taskInstanceList).addChild(index, taskInstance); 
     319        if (taskInstanceList instanceof SequenceInstance) { 
     320            addChild((SequenceInstance) taskInstanceList, index, taskInstance); 
     321        } 
     322        else if (taskInstanceList instanceof IterationInstance) { 
     323            addChild((IterationInstance) taskInstanceList, index, taskInstance); 
    162324        } 
    163325        else if (taskInstanceList instanceof UserSession) { 
    164             ((UserSession) taskInstanceList).addExecutedTask(index, taskInstance); 
     326            addExecutedTask((UserSession) taskInstanceList, index, taskInstance); 
    165327        } 
    166328        else { 
     
    178340                                ITaskInstance     taskInstance) 
    179341    { 
    180         if (taskInstanceList instanceof TaskInstance) { 
    181             ((TaskInstance) taskInstanceList).removeChild(index); 
    182             ((TaskInstance) taskInstanceList).addChild(index, taskInstance); 
    183         } 
    184         else if (taskInstanceList instanceof UserSession) { 
    185             ((UserSession) taskInstanceList).removeExecutedTask(index); 
    186             ((UserSession) taskInstanceList).addExecutedTask(index, taskInstance); 
    187         } 
    188         else { 
    189             throw new IllegalArgumentException 
    190                 ("illegal type of task instance list provided: " + taskInstanceList.getClass()); 
    191         } 
     342        removeTaskInstance(taskInstanceList, index); 
     343        addTaskInstance(taskInstanceList, index, taskInstance); 
    192344    } 
    193345 
     
    334486    @Override 
    335487    public void removeTaskInstance(ITaskInstanceList taskInstanceList, int index) { 
    336         if (taskInstanceList instanceof TaskInstance) { 
    337             ((TaskInstance) taskInstanceList).removeChild(index); 
     488        if (taskInstanceList instanceof SequenceInstance) { 
     489            ((SequenceInstance) taskInstanceList).removeChild(index); 
     490        } 
     491        else if (taskInstanceList instanceof IterationInstance) { 
     492            ((IterationInstance) taskInstanceList).removeChild(index); 
    338493        } 
    339494        else if (taskInstanceList instanceof UserSession) { 
     
    369524    } 
    370525 
    371     /* (non-Javadoc) 
    372      * @see ITaskBuilder#setDescription(ITask, java.lang.String) 
    373      */ 
    374     @Override 
    375     public void setDescription(ITask parent, String description) { 
    376         if (!(parent instanceof Task)) { 
    377             throw new IllegalArgumentException 
    378                 ("illegal type of task provided: " + parent.getClass()); 
    379         } 
    380  
    381         ((Task) parent).setDescription(description); 
    382     } 
    383  
    384526    /** 
    385527     * <p> 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskFactory.java

    r1216 r1294  
    1717import java.util.List; 
    1818 
    19 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    20 import de.ugoe.cs.autoquest.eventcore.IEventType; 
     19import de.ugoe.cs.autoquest.eventcore.Event; 
    2120import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     21import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     23import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2324import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     25import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    2426import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     27import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2528import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    2930import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    3031import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     
    4344 
    4445    /* (non-Javadoc) 
    45      * @see ITaskFactory#createNewEventTask(IEventType, IEventTarget) 
     46     * @see ITaskFactory#createNewEventTask(String) 
    4647     */ 
    4748    @Override 
    48     public IEventTask createNewEventTask(IEventType eventType, IEventTarget eventTarget) { 
    49         return new EventTask(eventType, eventTarget); 
     49    public IEventTask createNewEventTask(String description) { 
     50        return new EventTask(description); 
    5051    } 
    5152 
     
    8384 
    8485    /* (non-Javadoc) 
    85      * @see ITaskFactory#createNewTaskInstance(ITask) 
     86     * @see ITaskFactory#createNewTaskInstance(IEventTask, Event) 
    8687     */ 
    8788    @Override 
    88     public ITaskInstance createNewTaskInstance(ITask task) { 
    89         return new TaskInstance(task); 
     89    public IEventTaskInstance createNewTaskInstance(IEventTask task, Event event) { 
     90        if (!(task instanceof EventTask)) { 
     91            throw new IllegalArgumentException 
     92                ("illegal type of event task provided: " + task.getClass()); 
     93        } 
     94         
     95        EventTaskInstance instance = new EventTaskInstance(task, event); 
     96        ((EventTask) task).addInstance(instance); 
     97         
     98        return instance; 
    9099    } 
    91100 
    92101    /* (non-Javadoc) 
    93      * @see ITaskFactory#createNewTaskInstanceList() 
     102     * @see ITaskFactory#createNewTaskInstance(ISequence) 
    94103     */ 
    95104    @Override 
    96     public ITaskInstanceList createNewTaskInstanceList() { 
    97         return new TaskInstance(new Sequence()); 
     105    public ISequenceInstance createNewTaskInstance(ISequence sequence) { 
     106        if (!(sequence instanceof Sequence)) { 
     107            throw new IllegalArgumentException 
     108                ("illegal type of sequence provided: " + sequence.getClass()); 
     109        } 
     110         
     111        SequenceInstance instance = new SequenceInstance(sequence); 
     112        ((Sequence) sequence).addInstance(instance); 
     113         
     114        return instance; 
     115    } 
     116 
     117    /* (non-Javadoc) 
     118     * @see ITaskFactory#createNewTaskInstance(IIteration) 
     119     */ 
     120    @Override 
     121    public IIterationInstance createNewTaskInstance(IIteration iteration) { 
     122        if (!(iteration instanceof Iteration)) { 
     123            throw new IllegalArgumentException 
     124                ("illegal type of iteration provided: " + iteration.getClass()); 
     125        } 
     126         
     127        IterationInstance instance = new IterationInstance(iteration); 
     128        ((Iteration) iteration).addInstance(instance); 
     129         
     130        return instance; 
     131    } 
     132 
     133    /* (non-Javadoc) 
     134     * @see ITaskFactory#createNewTaskInstance(IOptional) 
     135     */ 
     136    @Override 
     137    public IOptionalInstance createNewTaskInstance(IOptional optional) { 
     138        if (!(optional instanceof Optional)) { 
     139            throw new IllegalArgumentException 
     140                ("illegal type of optional provided: " + optional.getClass()); 
     141        } 
     142         
     143        OptionalInstance instance = new OptionalInstance(optional); 
     144        ((Optional) optional).addInstance(instance); 
     145         
     146        return instance; 
     147    } 
     148 
     149    /* (non-Javadoc) 
     150     * @see ITaskFactory#createNewTaskInstance(ISelection) 
     151     */ 
     152    @Override 
     153    public ISelectionInstance createNewTaskInstance(ISelection selection) { 
     154        if (!(selection instanceof Selection)) { 
     155            throw new IllegalArgumentException 
     156                ("illegal type of optional provided: " + selection.getClass()); 
     157        } 
     158         
     159        SelectionInstance instance = new SelectionInstance(selection); 
     160        ((Selection) selection).addInstance(instance); 
     161         
     162        return instance; 
    98163    } 
    99164 
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInstance.java

    r1255 r1294  
    1414 
    1515package de.ugoe.cs.autoquest.tasktrees.treeimpl; 
    16  
    17 import java.util.Collections; 
    18 import java.util.Iterator; 
    19 import java.util.LinkedList; 
    20 import java.util.List; 
    2116 
    2217import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    6459    /** 
    6560     * <p> 
    66      * the children of this task instance which are task instances, as well 
    67      * </p> 
    68      */ 
    69     private List<ITaskInstance> children; 
    70  
    71     /** 
    72      * <p> 
    7361     * instantiated the task instance with the task that is instantiated by the instance. It also 
    7462     * assigns a unique id to the instance using {@link #getNewId()}. 
     
    10290    public ITask getTask() { 
    10391        return task; 
    104     } 
    105  
    106     /* (non-Javadoc) 
    107      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance#getChildren() 
    108      */ 
    109     public synchronized List<ITaskInstance> getChildren() { 
    110         if (children == null) { 
    111             children = new LinkedList<ITaskInstance>(); 
    112         } 
    113  
    114         return Collections.unmodifiableList(children); 
    115     } 
    116  
    117     /* (non-Javadoc) 
    118      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList#get(int) 
    119      */ 
    120     @Override 
    121     public ITaskInstance get(int index) { 
    122         if (children == null) { 
    123             throw new IndexOutOfBoundsException(Integer.toString(index)); 
    124         } 
    125         else { 
    126             return children.get(index); 
    127         } 
    128     } 
    129  
    130     /* (non-Javadoc) 
    131      * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList#size() 
    132      */ 
    133     @Override 
    134     public int size() { 
    135         if (children == null) { 
    136             return 0; 
    137         } 
    138         else { 
    139             return children.size(); 
    140         } 
    141     } 
    142  
    143     /* (non-Javadoc) 
    144      * @see java.lang.Iterable#iterator() 
    145      */ 
    146     @Override 
    147     public Iterator<ITaskInstance> iterator() { 
    148         return getChildren().iterator(); 
    14992    } 
    15093 
     
    203146        try { 
    204147            clone = (TaskInstance) super.clone(); 
    205  
    206             if (children != null) { 
    207                 clone.children = new LinkedList<ITaskInstance>(); 
    208  
    209                 for (ITaskInstance child : children) { 
    210                     clone.children.add(child.clone()); 
    211                 } 
    212             } 
    213  
    214148        } 
    215149        catch (CloneNotSupportedException e) { 
     
    219153 
    220154        return clone; 
    221     } 
    222  
    223     /** 
    224      * <p> 
    225      * used to add a child to this task instance 
    226      * </p> 
    227      *  
    228      * @param child the new child of this instance 
    229      */ 
    230     synchronized void addChild(ITaskInstance child) { 
    231         if (children == null) { 
    232             children = new LinkedList<ITaskInstance>(); 
    233         } 
    234  
    235         children.add(child); 
    236     } 
    237  
    238     /** 
    239      * <p> 
    240      * used to add a child to this task instance at a specific position 
    241      * </p> 
    242      *  
    243      * @param index the position of the new child in the list of children 
    244      * @param child the new child of this instance 
    245      */ 
    246     synchronized void addChild(int index, ITaskInstance child) { 
    247         if (children == null) { 
    248             children = new LinkedList<ITaskInstance>(); 
    249         } 
    250  
    251         children.add(index, child); 
    252     } 
    253  
    254     /** 
    255      * <p> 
    256      * removes a child from this task instance at a specific position 
    257      * </p> 
    258      *  
    259      * @param index the position of the child to be removed 
    260      *  
    261      * @return the child remove from the children of this instance 
    262      */ 
    263     synchronized ITaskInstance removeChild(int index) { 
    264         if (children != null) { 
    265             return children.remove(index); 
    266         } 
    267         else { 
    268             throw new IllegalArgumentException 
    269                 ("this task instance does not have children that can be removed"); 
    270         } 
    271155    } 
    272156 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeChecker.java

    r1146 r1294  
    2020import java.util.HashMap; 
    2121import java.util.Iterator; 
     22import java.util.LinkedList; 
    2223import java.util.List; 
    2324import java.util.Map; 
     
    2728import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    2829import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2931import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3135import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    3236import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    7074     * 
    7175     */ 
    72     public void assertTaskInstanceList(String userSessionSpec, ITaskInstanceList taskInstances) { 
     76    public void assertUserSession(String userSessionSpec, IUserSession session) { 
    7377        if (doTrace) { 
    74             new TaskTreeEncoder().encode(taskInstances, System.err); 
     78            new TaskTreeEncoder().encode(session, System.err); 
    7579        } 
    7680 
     
    8690             
    8791            if (taskInstanceSpec != null) { 
    88                 assertTaskInstanceList(taskInstanceSpec, taskInstances, tasks); 
     92                assertUserSession(taskInstanceSpec, session, tasks); 
     93            } 
     94        } 
     95    } 
     96 
     97    /** 
     98     * 
     99     */ 
     100    public void assertTaskInstance(String userSessionSpec, ITaskInstance taskInstance) { 
     101        if (doTrace) { 
     102            new TaskTreeEncoder().encode(taskInstance, System.err); 
     103        } 
     104 
     105        TaskSpec taskInstanceSpec = null; 
     106 
     107        Matcher taskMatcher = taskPattern.matcher(userSessionSpec); 
     108         
     109        Map<String, ITask> tasks = new HashMap<String, ITask>(); 
     110 
     111        while (taskMatcher.find()) { 
     112 
     113            taskInstanceSpec = parseTaskInstance(taskMatcher); 
     114             
     115            if (taskInstanceSpec != null) { 
     116                assertTaskInstance(taskInstanceSpec, taskInstance, tasks); 
    89117            } 
    90118        } 
     
    154182            } 
    155183             
    156             List<ITaskInstance> expectedChildren = expected.getChildren(); 
    157             List<ITaskInstance> checkedChildren = checked.getChildren(); 
     184            List<ITaskInstance> expectedChildren = getChildren(expected); 
     185            List<ITaskInstance> checkedChildren = getChildren(checked); 
    158186             
    159187            if ((expectedChildren != null) && (expectedChildren.size() > 0)) { 
     
    241269     * @param taskMapCopy 
    242270     */ 
    243     private void assertTaskInstanceList(TaskSpec           taskSpec, 
    244                                         ITaskInstanceList  taskInstances, 
    245                                         Map<String, ITask> tasks) 
     271    private void assertUserSession(TaskSpec           taskSpec, 
     272                                   IUserSession       session, 
     273                                   Map<String, ITask> tasks) 
    246274    { 
    247275        if (doTrace) { 
    248             System.err.println("\ncomparing " + taskSpec.type + " with " + taskInstances + "\n"); 
    249         } 
    250  
    251         if ((taskInstances instanceof IUserSession) && (!"UserSession".equals(taskSpec.type))) { 
     276            System.err.println("\ncomparing " + taskSpec.type + " with " + session + "\n"); 
     277        } 
     278 
     279        if (!"UserSession".equals(taskSpec.type)) { 
    252280            fail("can not compare a task instance with a user session"); 
    253281        } 
    254         else if ((!(taskInstances instanceof IUserSession)) && 
    255                  (!"TaskInstances".equals(taskSpec.type))) 
    256         { 
     282         
     283        List<ITaskInstance> children = session.getExecutedTasks(); 
     284         
     285        if (taskSpec.children.length != children.size()) { 
     286            fail("number of task instances in task instance list does not match"); 
     287        } 
     288         
     289        for (int i = 0; i < children.size(); i++) { 
     290            TaskSpec childSpec = taskSpec.children[i]; 
     291            assertTrue(taskSpecEqualsTaskInstance(childSpec, children.get(i), tasks)); 
     292        } 
     293    } 
     294 
     295    /** 
     296     * @param task 
     297     * @param taskMapCopy 
     298     */ 
     299    private void assertTaskInstance(TaskSpec           taskSpec, 
     300                                    ITaskInstance      taskInstance, 
     301                                    Map<String, ITask> tasks) 
     302    { 
     303        if (doTrace) { 
     304            System.err.println("\ncomparing " + taskSpec.type + " with " + taskInstance + "\n"); 
     305        } 
     306 
     307        if (!"TaskInstances".equals(taskSpec.type)) { 
    257308            fail("can not compare a task instance with a task instance list"); 
    258309        } 
    259310         
    260         if (taskSpec.children.length != taskInstances.size()) { 
     311        List<ITaskInstance> children = getChildren(taskInstance); 
     312         
     313        if (taskSpec.children.length != children.size()) { 
    261314            fail("number of task instances in task instance list does not match"); 
    262315        } 
    263316         
    264         for (int i = 0; i < taskInstances.size(); i++) { 
     317        for (int i = 0; i < children.size(); i++) { 
    265318            TaskSpec childSpec = taskSpec.children[i]; 
    266             assertTrue(taskSpecEqualsTaskInstance(childSpec, taskInstances.get(i), tasks)); 
     319            assertTrue(taskSpecEqualsTaskInstance(childSpec, children.get(i), tasks)); 
    267320        } 
    268321    } 
     
    284337        if (("Event".equals(taskSpec.type) && (!(task instanceof IEventTask))) || 
    285338            ("TextInputEvent".equals(taskSpec.type) && 
    286              ((!(task instanceof IEventTask)) || 
    287               (!(((IEventTask) task).getEventType() instanceof TextInput)))) || 
     339             ((!(taskInstance instanceof IEventTaskInstance)) || 
     340              (!(((IEventTaskInstance) taskInstance).getEvent().getType() instanceof TextInput)))) || 
    288341            ("Sequence".equals(taskSpec.type) && (!(task instanceof ISequence))) || 
    289342            ("Selection".equals(taskSpec.type) && (!(task instanceof ISelection))) || 
     
    306359 
    307360        if ("TextInputEvent".equals(taskSpec.type)) { 
    308             TextInput eventType = (TextInput) ((IEventTask) task).getEventType(); 
     361            TextInput eventType = (TextInput) 
     362                ((IEventTaskInstance) taskInstance).getEvent().getType(); 
     363             
    309364            if ((taskSpec.additionalInfo != null) && 
    310365                !"".equals(taskSpec.additionalInfo) && 
     
    319374            } 
    320375        } 
    321         else if ((task instanceof IEventTask) && (((IEventTask) task).getEventType() != null) && 
    322                  (!taskSpec.name.equals(((IEventTask) task).getEventType().getName()))) 
     376        else if ((task instanceof IEventTask) && 
     377                 (((IEventTaskInstance) taskInstance).getEvent().getType() != null) && 
     378                 (!taskSpec.name.equals(((IEventTaskInstance) taskInstance).getEvent().getType().getName()))) 
    323379        { 
    324380            // simple event names do not match. But what about the event name in 
     
    328384                    (!"".equals(taskSpec.additionalInfo) ? " " + taskSpec.additionalInfo : ""); 
    329385 
    330             if (!complexName.equals(((IEventTask) task).getEventType().getName())) { 
     386            if (!complexName.equals(((IEventTaskInstance) taskInstance).getEvent().getType().getName())) { 
    331387                if (doTrace) { 
    332                     System.err.println("event names do not match: " + taskSpec.name + " != " + 
    333                                        ((IEventTask) task).getEventType().getName() + "\n"); 
     388                    System.err.println 
     389                        ("event names do not match: " + taskSpec.name + " != " + 
     390                         ((IEventTaskInstance) taskInstance).getEvent().getType().getName() + "\n"); 
    334391                } 
    335392                return false; 
     
    358415        } 
    359416 
    360         if (((taskSpec.children == null) && (taskInstance.getChildren().size() > 0)) || 
     417        List<ITaskInstance> children = getChildren(taskInstance); 
     418         
     419        if (((taskSpec.children == null) && (children.size() > 0)) || 
    361420            ((taskSpec.children != null) && 
    362              (taskSpec.children.length != taskInstance.getChildren().size()))) 
     421             (taskSpec.children.length != children.size()))) 
    363422        { 
    364423            if (doTrace) { 
     
    366425                    ("numbers of children do not match: " + 
    367426                     (taskSpec.children == null ? "0" : taskSpec.children.length) + " != " + 
    368                      (taskInstance.getChildren() == null ? "0" : 
    369                           taskInstance.getChildren().size()) + "\n"); 
     427                     (children == null ? "0" : children.size()) + "\n"); 
    370428            } 
    371429            return false; 
    372430        } 
    373431 
    374         Iterator<ITaskInstance> children = taskInstance.getChildren().iterator(); 
     432        Iterator<ITaskInstance> childrenIterator = children.iterator(); 
    375433        if (taskSpec.children != null) { 
    376434            for (TaskSpec child : taskSpec.children) { 
    377                 if (!taskSpecEqualsTaskInstance(child, children.next(), tasks)) { 
     435                if (!taskSpecEqualsTaskInstance(child, childrenIterator.next(), tasks)) { 
    378436                    if (doTrace) { 
    379437                        System.err.println("one of the children does not match\n"); 
     
    384442        } 
    385443 
    386         if (!children.hasNext()) { 
     444        if (!childrenIterator.hasNext()) { 
    387445            if (doTrace) { 
    388446                System.err.println("nodes match\n"); 
     
    398456    } 
    399457     
     458    /** 
     459     * <p> 
     460     * TODO: comment 
     461     * </p> 
     462     * 
     463     * @param taskInstance 
     464     * @return 
     465     */ 
     466    private List<ITaskInstance> getChildren(ITaskInstance taskInstance) { 
     467        List<ITaskInstance> result = new LinkedList<ITaskInstance>(); 
     468         
     469        if (taskInstance instanceof ITaskInstanceList) { 
     470            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     471                result.add(child); 
     472            } 
     473        } 
     474        else if (taskInstance instanceof ISelectionInstance) { 
     475            result.add(((ISelectionInstance) taskInstance).getChild()); 
     476        } 
     477        else if (taskInstance instanceof IOptionalInstance) { 
     478            result.add(((IOptionalInstance) taskInstance).getChild()); 
     479        } 
     480         
     481        return result; 
     482    } 
     483 
    400484    /** 
    401485     * 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoder.java

    r1212 r1294  
    2626import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2727import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2830import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2932import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     33import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3034import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     35import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3136import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     37import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    3238import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3339import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    173179            } 
    174180            else { 
    175                 task = createUserInteractionTask(matcher); 
     181                task = createUserInteractionTaskInstance(matcher).getTask(); 
    176182            }   
    177183            tasks.put(id, task); 
    178184        } 
    179185         
    180         if ((matcher.group(5) != null) && (!"".equals(matcher.group(5).trim()))) { 
    181             taskBuilder.setDescription(task, matcher.group(5).trim()); 
    182         } 
    183  
    184         ITaskInstance instance = taskFactory.createNewTaskInstance(task); 
     186        ITaskInstance instance; 
     187         
     188        if (task instanceof ISequence) { 
     189            instance = taskFactory.createNewTaskInstance((ISequence) task); 
     190        } 
     191        else if (task instanceof ISelection) { 
     192            instance = taskFactory.createNewTaskInstance((ISelection) task); 
     193        } 
     194        else if (task instanceof IIteration) { 
     195            instance = taskFactory.createNewTaskInstance((IIteration) task); 
     196        } 
     197        else if (task instanceof IOptional) { 
     198            instance = taskFactory.createNewTaskInstance((IOptional) task); 
     199        } 
     200        else { 
     201            instance = taskFactory.createNewTaskInstance 
     202                 ((IEventTask) task, 
     203                  ((IEventTaskInstance) task.getInstances().iterator().next()).getEvent()); 
     204        }   
    185205         
    186206        while (taskMatcher.find() && !"}".equals(taskMatcher.group(0))) { 
     
    216236            } 
    217237             
    218             taskBuilder.addChild(instance, childInstance); 
     238            if (instance instanceof ISequenceInstance) { 
     239                taskBuilder.addChild((ISequenceInstance) instance, childInstance); 
     240            } 
     241            else if (instance instanceof ISelectionInstance) { 
     242                taskBuilder.setChild((ISelectionInstance) instance, childInstance); 
     243            } 
     244            else if (instance instanceof IIterationInstance) { 
     245                taskBuilder.addChild((IIterationInstance) instance, childInstance); 
     246            } 
     247            else if (instance instanceof IOptionalInstance) { 
     248                taskBuilder.setChild((IOptionalInstance) instance, childInstance); 
     249            } 
    219250        } 
    220251 
     
    229260     * @return 
    230261     */ 
    231     private ITask createUserInteractionTask(Matcher matcher) { 
     262    private ITaskInstance createUserInteractionTaskInstance(Matcher matcher) { 
    232263        String evenType = matcher.group(1); 
    233264        String id = matcher.group(2); 
    234         IEventTarget evenTarget = targets.get(id); 
    235         if (evenTarget == null) { 
    236             evenTarget = determineTarget(evenType, id, matcher.group(4)); 
    237             targets.put(id, evenTarget); 
     265        IEventTarget eventTarget = targets.get(id); 
     266        if (eventTarget == null) { 
     267            eventTarget = determineTarget(evenType, id, matcher.group(4)); 
     268            targets.put(id, eventTarget); 
    238269        } 
    239270        IEventType eventType = determineType(evenType, matcher.group(4)); 
    240         return taskFactory.createNewEventTask(eventType, evenTarget); 
     271        IEventTask task = taskFactory.createNewEventTask(eventType + " --> " + eventTarget); 
     272         
     273        return taskFactory.createNewTaskInstance(task, new Event(eventType, eventTarget)); 
    241274    } 
    242275 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeEncoder.java

    r1146 r1294  
    2424import java.util.Map; 
    2525 
     26import de.ugoe.cs.autoquest.eventcore.Event; 
    2627import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    2728import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2830import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2931import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3135import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    3236import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    141145        else if (task instanceof IEventTask) { 
    142146            out.print(indent); 
    143             out.print(((IEventTask) task).getEventType()); 
    144             out.print(" "); 
    145             out.print(((IEventTask) task).getEventTarget().getStringIdentifier()); 
    146 //            if (((IEventTask) node).getEventTarget() instanceof IGUIElement) { 
    147 //              out.print(" "); 
    148 //              out.print(((IGUIElement) ((IEventTask) node).getEventTarget()).getSpecification()); 
    149 //            } 
     147            out.print(task); 
    150148        } 
    151149        else { 
     
    154152 
    155153        int i = 0; 
    156         for (ITaskInstance child : taskInstance.getChildren()) { 
    157             encode(child, out, indent + "  ", i++); 
     154         
     155        if (taskInstance instanceof ITaskInstanceList) { 
     156            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     157                encode(child, out, indent + "  ", i++); 
     158            } 
     159        } 
     160        else if (taskInstance instanceof ISelectionInstance) { 
     161            encode(((ISelectionInstance) taskInstance).getChild(), out, indent + "  ", i++); 
     162        } 
     163        else if (taskInstance instanceof IOptionalInstance) { 
     164            encode(((IOptionalInstance) taskInstance).getChild(), out, indent + "  ", i++); 
    158165        } 
    159166 
     
    221228        } 
    222229        else if (task instanceof IEventTask) { 
    223             if (((IEventTask) task).getEventType() instanceof TextInput) { 
     230            Event event = ((IEventTaskInstance) taskInstance).getEvent(); 
     231            if (event.getType() instanceof TextInput) { 
    224232                if (id == null) { 
    225233                    id = "textInput" + typeCounters[3]++; 
     
    229237                System.out.print(id); 
    230238                System.out.print(" \""); 
    231                 System.out.print(((TextInput) ((IEventTask) task).getEventType()).getEnteredText()); 
     239                System.out.print(((TextInput) event.getType()).getEnteredText()); 
    232240                System.out.print("\""); 
    233241            } 
     
    240248                System.out.print(id); 
    241249                System.out.print(' '); 
    242                 System.out.print(((IEventTask) task).getEventType().getName()); 
     250                System.out.print(event.getType().getName()); 
    243251            } 
    244252            System.out.print(" {}\" +"); 
     
    250258        taskIds.put(task, id); 
    251259         
    252         for (ITaskInstance child : taskInstance.getChildren()) { 
    253             dumpTaskInstanceAsCheckString(child, typeCounters, taskIds, indent + "  "); 
     260        if (taskInstance instanceof ITaskInstanceList) { 
     261            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     262                dumpTaskInstanceAsCheckString(child, typeCounters, taskIds, indent + "  "); 
     263            } 
     264        } 
     265        else if (taskInstance instanceof ISelectionInstance) { 
     266            dumpTaskInstanceAsCheckString 
     267                (((ISelectionInstance) taskInstance).getChild(), typeCounters, taskIds, indent + "  "); 
     268        } 
     269        else if (taskInstance instanceof IOptionalInstance) { 
     270            dumpTaskInstanceAsCheckString 
     271                (((IOptionalInstance) taskInstance).getChild(), typeCounters, taskIds, indent + "  "); 
    254272        } 
    255273 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeValidator.java

    r1146 r1294  
    2020 
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2223import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     24import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2325import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     26import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2529import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    2631import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2732import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     
    6671             
    6772            assertEquals("number of children of sequence instance must match sequence model", 
    68                          taskInstance.size(), task.getChildren().size()); 
     73                         ((ISequenceInstance) taskInstance).size(), task.getChildren().size()); 
    6974             
    70             for (int i = 0; i < taskInstance.size(); i++) { 
    71                 assertNotNull("sequence instance child " + i + " was null", taskInstance.get(i)); 
    72                 ITask childTask = taskInstance.get(i).getTask(); 
     75            for (int i = 0; i < ((ISequenceInstance) taskInstance).size(); i++) { 
     76                assertNotNull("sequence instance child " + i + " was null", 
     77                              ((ISequenceInstance) taskInstance).get(i)); 
     78                ITask childTask = ((ISequenceInstance) taskInstance).get(i).getTask(); 
    7379                assertSame("task of sequence child " + i + " does not match sequence model", 
    7480                           childTask, task.getChildren().get(i)); 
     
    7884            ISelection task = (ISelection) taskInstance.getTask(); 
    7985             
    80             assertEquals 
    81                 ("number of children of selection instance must be 1", 1, taskInstance.size()); 
     86            assertNotNull("number of children of selection instance must be 1", 
     87                          ((ISelectionInstance) taskInstance).getChild()); 
    8288            assertTrue 
    8389                ("number of children of selection must be larger 0", task.getChildren().size() > 0); 
     
    9096                assertFalse("child of selection model must not be an optional", 
    9197                            childTask instanceof IOptional); 
    92                 if (childTask.equals(taskInstance.get(0).getTask())) { 
     98                if (childTask.equals(((ISelectionInstance) taskInstance).getChild().getTask())) { 
    9399                    found = true; 
    94100                    break; 
     
    107113                        childTask instanceof IOptional); 
    108114             
    109             for (int i = 0; i < taskInstance.size(); i++) { 
    110                 assertNotNull("iteration instance child " + i + " was null", taskInstance.get(i)); 
     115            for (int i = 0; i < ((IIterationInstance) taskInstance).size(); i++) { 
     116                assertNotNull("iteration instance child " + i + " was null", 
     117                              ((IIterationInstance) taskInstance).get(i)); 
    111118                assertSame("task of iteration child " + i + " does not match iteration model", 
    112                            childTask, taskInstance.get(i).getTask()); 
     119                           childTask, ((IIterationInstance) taskInstance).get(i).getTask()); 
    113120            } 
    114121        } 
     
    119126                        childTask instanceof IOptional); 
    120127             
    121             assertEquals 
    122                 ("number of children of optional instance must be 1", 1, taskInstance.size()); 
     128            assertNotNull("number of children of optional instance must be 1", 
     129                          ((IOptionalInstance) taskInstance).getChild()); 
    123130             
    124131            assertEquals("task of optional child does not match optional model", 
    125                          childTask, taskInstance.get(0).getTask()); 
     132                         childTask, ((IOptionalInstance) taskInstance).getChild().getTask()); 
    126133        } 
    127134        else if (taskInstance.getTask() instanceof IEventTask) { 
    128135            IEventTask task = (IEventTask) taskInstance.getTask(); 
    129136            assertNotNull("event task model must not be null", task); 
    130             assertNotNull("event type of event task model must not be null", task.getEventType()); 
    131             assertNotNull 
    132                 ("event target of event task model must not be null", task.getEventTarget()); 
    133  
    134             assertEquals("event task instance must not have children", 0, taskInstance.size()); 
     137            assertNotNull("event of event task instance must not be null", 
     138                          ((IEventTaskInstance) taskInstance).getEvent()); 
    135139        } 
    136140        else { 
     
    138142        } 
    139143         
    140         for (ITaskInstance child : taskInstance) { 
    141             validate(child); 
     144        if (taskInstance instanceof ITaskInstanceList) { 
     145            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     146                validate(child); 
     147            } 
     148        } 
     149        else if (taskInstance instanceof ISelectionInstance) { 
     150            validate(((ISelectionInstance) taskInstance).getChild()); 
     151        } 
     152        else if (taskInstance instanceof IOptionalInstance) { 
     153            validate(((IOptionalInstance) taskInstance).getChild()); 
    142154        } 
    143155    } 
  • trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/ShowTaskTreeDialog.java

    r1275 r1294  
    1818import java.util.Collections; 
    1919import java.util.Comparator; 
    20 import java.util.HashSet; 
    2120import java.util.LinkedList; 
    2221import java.util.List; 
    23 import java.util.Set; 
    2422 
    2523import org.eclipse.swt.SWT; 
     
    3937 
    4038import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; 
     39import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
     40import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    4141import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship; 
    4242import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    173173     * convenience method for creating the display of the instances 
    174174     */ 
    175     private void buildInstanceTree(TreeItem currentParent, ITaskInstanceList taskInstanceList) { 
     175    private void buildInstanceTree(TreeItem currentParent, IUserSession session) { 
    176176        TreeItem child = new TreeItem(currentParent, SWT.NULL); 
    177         child.setText(taskInstanceList.toString()); 
    178         child.setData(taskInstanceList); 
    179          
    180         for (ITaskInstanceList childTask : taskInstanceList) { 
    181             buildInstanceTree(child, childTask); 
     177        child.setText(session.toString()); 
     178        child.setData(session); 
     179         
     180        for (ITaskInstance childInstance : session) { 
     181            buildInstanceTree(child, childInstance); 
     182        } 
     183    } 
     184 
     185    /** 
     186     * convenience method for creating the display of the instances 
     187     */ 
     188    private void buildInstanceTree(TreeItem currentParent, ITaskInstance taskInstance) { 
     189        TreeItem child = new TreeItem(currentParent, SWT.NULL); 
     190        child.setText(taskInstance.toString()); 
     191        child.setData(taskInstance); 
     192         
     193        if (taskInstance instanceof ITaskInstanceList) { 
     194            for (ITaskInstance childInstance : (ITaskInstanceList) taskInstance) { 
     195                buildInstanceTree(child, childInstance); 
     196            } 
     197        } 
     198        else if (taskInstance instanceof ISelectionInstance) { 
     199            buildInstanceTree(child, ((ISelectionInstance) taskInstance).getChild()); 
     200        } 
     201        else if (taskInstance instanceof IOptionalInstance) { 
     202            buildInstanceTree(child, ((IOptionalInstance) taskInstance).getChild()); 
    182203        } 
    183204    } 
     
    229250 
    230251    /** 
    231      * reduces the list of tasks in a model so that it only contains root nodes and that it is  
    232      * sorted starting with the most complex task first  
     252     * sort the list of tasks so that it contain those occurring most often first 
    233253     */ 
    234254    private List<ITask> createSortedTaskList(Collection<ITask> tasks) { 
    235         Set<ITask> resultSet = new HashSet<ITask>(tasks); 
     255        /*Set<ITask> resultSet = new HashSet<ITask>(tasks); 
    236256         
    237257        for (ITask task : tasks) { 
    238258            removeChildren(task, resultSet); 
    239         } 
    240          
    241         List<ITask> result = new LinkedList<ITask>(resultSet); 
     259        }*/ 
     260         
     261        List<ITask> result = new LinkedList<ITask>(tasks); 
    242262         
    243263        Collections.sort(result, new Comparator<ITask>() { 
    244264            @Override 
    245265            public int compare(ITask task1, ITask task2) { 
    246                 return depth(task2) - depth(task1); 
    247             } 
    248  
    249             private int depth(ITask task) { 
     266                return taskModel.getTaskInfo(task2).getCount() - 
     267                    taskModel.getTaskInfo(task1).getCount(); 
     268            } 
     269 
     270            /*private int depth(ITask task) { 
    250271                int maxChildDepth = 0; 
    251272                if (task instanceof IStructuringTemporalRelationship) { 
     
    259280                } 
    260281                return maxChildDepth + 1; 
    261             } 
     282            }*/ 
    262283        }); 
    263284         
     
    268289     * convenience method for removed all non root tasks of the provided list 
    269290     */ 
    270     private void removeChildren(ITask task, Set<ITask> result) { 
     291    /*private void removeChildren(ITask task, Set<ITask> result) { 
    271292        if (task instanceof IStructuringTemporalRelationship) { 
    272293            for (ITask child : ((IStructuringTemporalRelationship) task).getChildren()) { 
     
    277298            result.remove(((IMarkingTemporalRelationship) task).getMarkedTask()); 
    278299        } 
    279     } 
     300    }*/ 
    280301 
    281302    /** 
     
    338359    private void createTreeItemFor(ITask task, TreeItem parent) { 
    339360        TreeItem item = new TreeItem(parent, SWT.NULL); 
    340         item.setText(task.toString()); 
     361        item.setText(task.toString() + " (" + taskModel.getTaskInfo(task).getCount() + ")"); 
    341362        item.setData(task); 
    342363         
Note: See TracChangeset for help on using the changeset viewer.