Index: trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRuleTest.java
===================================================================
--- trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRuleTest.java	(revision 1146)
+++ trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRuleTest.java	(revision 1294)
@@ -25,6 +25,4 @@
 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
-import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory;
-import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory;
 import de.ugoe.cs.autoquest.test.DummyGUIElement;
 
@@ -32,5 +30,5 @@
  * @author Patrick Harms
  */
-public class EventTaskComparisonRuleTest {
+public class EventTaskComparisonRuleTest extends AbstractComparisonRuleTest {
 
     /**
@@ -39,11 +37,9 @@
     @Test
     public void test_isApplicable_01() {
-        ITaskFactory taskFactory = new TaskFactory();
-
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
 
         assertTrue(rule.isApplicable(task1, task1));
@@ -55,15 +51,13 @@
     @Test
     public void test_isApplicable_02() {
-        ITaskFactory taskFactory = new TaskFactory();
-
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
 
         IEventType eventType2 = new StringEventType("eventType2");
         IEventTarget eventTarget2 = new DummyGUIElement("elem2");
-        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2);
+        ITask task2 = createNewEventTask(eventType2, eventTarget2);
 
         assertTrue(rule.isApplicable(task1, task2));
@@ -76,13 +70,11 @@
     @Test
     public void test_isApplicable_03() {
-        ITaskFactory taskFactory = new TaskFactory();
-
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
        
-        ITask selection = taskFactory.createNewSelection();
+        ITask selection = createNewSelection();
 
         assertFalse(rule.isApplicable(task1, selection));
@@ -95,13 +87,11 @@
     @Test
     public void test_isApplicable_04() {
-        ITaskFactory taskFactory = new TaskFactory();
-
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
-
-        ITask sequence = taskFactory.createNewSequence();
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask sequence = createNewSequence();
 
         assertFalse(rule.isApplicable(task1, sequence));
@@ -114,13 +104,11 @@
     @Test
     public void test_isApplicable_05() {
-        ITaskFactory taskFactory = new TaskFactory();
-
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
-
-        ITask iteration = taskFactory.createNewIteration();
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask iteration = createNewIteration();
 
         assertFalse(rule.isApplicable(task1, iteration));
@@ -133,13 +121,11 @@
     @Test
     public void test_isApplicable_06() {
-        ITaskFactory taskFactory = new TaskFactory();
-
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
-
-        ITask optional = taskFactory.createNewOptional();
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask optional = createNewOptional();
 
         assertFalse(rule.isApplicable(task1, optional));
@@ -151,12 +137,122 @@
      */
     @Test
+    public void test_isApplicable_07() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(),
+                                     task1.getInstances().iterator().next()));
+    }
+   
+    /**
+     *
+     */
+    @Test
+    public void test_isApplicable_08() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        IEventType eventType2 = new StringEventType("eventType2");
+        IEventTarget eventTarget2 = new DummyGUIElement("elem2");
+        ITask task2 = createNewEventTask(eventType2, eventTarget2);
+
+        assertTrue(rule.isApplicable(task1.getInstances().iterator().next(),
+                                     task2.getInstances().iterator().next()));
+        assertTrue(rule.isApplicable(task2.getInstances().iterator().next(),
+                                     task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test_isApplicable_09() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask selection = createNewSelection();
+
+        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(),
+                                      selection.getInstances().iterator().next()));
+        assertFalse(rule.isApplicable(selection.getInstances().iterator().next(),
+                                      task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test_isApplicable_10() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask sequence = createNewSequence();
+
+        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(),
+                                      sequence.getInstances().iterator().next()));
+        assertFalse(rule.isApplicable(sequence.getInstances().iterator().next(),
+                                      task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test_isApplicable_11() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask iteration = createNewIteration();
+
+        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(),
+                                      iteration.getInstances().iterator().next()));
+        assertFalse(rule.isApplicable(iteration.getInstances().iterator().next(),
+                                      task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test_isApplicable_12() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+
+        ITask optional = createNewOptional();
+
+        assertFalse(rule.isApplicable(task1.getInstances().iterator().next(),
+                                      optional.getInstances().iterator().next()));
+        assertFalse(rule.isApplicable(optional.getInstances().iterator().next(),
+                                      task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
     public void test_compare_01() {
-        ITaskFactory taskFactory = new TaskFactory();
-        
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-        
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
         
         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task1));
@@ -171,13 +267,11 @@
     @Test
     public void test_compare_02() {
-        ITaskFactory taskFactory = new TaskFactory();
-        
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-        
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
-        
-        ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+        
+        ITask task2 = createNewEventTask(eventType1, eventTarget1);
         
         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task2));
@@ -197,14 +291,12 @@
     @Test
     public void test_compare_03() {
-        ITaskFactory taskFactory = new TaskFactory();
-        
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-        
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
         
         IEventType eventType2 = new StringEventType("eventType2");
-        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1);
+        ITask task2 = createNewEventTask(eventType2, eventTarget1);
 
         assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2));
@@ -224,14 +316,12 @@
     @Test
     public void test_compare_04() {
-        ITaskFactory taskFactory = new TaskFactory();
-        
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-        
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
         
         IEventTarget eventTarget2 = new DummyGUIElement("elem2");
-        ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget2);
+        ITask task2 = createNewEventTask(eventType1, eventTarget2);
         
         assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2));
@@ -252,15 +342,13 @@
     @Test
     public void test_compare_05() {
-        ITaskFactory taskFactory = new TaskFactory();
-        
-        EventTaskComparisonRule rule = new EventTaskComparisonRule();
-        
-        IEventType eventType1 = new StringEventType("eventType1");
-        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
-        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
         
         IEventType eventType2 = new StringEventType("eventType2");
         IEventTarget eventTarget2 = new DummyGUIElement("elem2");
-        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2);
+        ITask task2 = createNewEventTask(eventType2, eventTarget2);
         
         assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2));
@@ -275,3 +363,167 @@
     }
 
+
+    /**
+     *
+     */
+    @Test
+    public void test_compare_06() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+        
+        assertEquals(TaskEquality.LEXICALLY_EQUAL,
+                     rule.compare(task1.getInstances().iterator().next(),
+                                  task1.getInstances().iterator().next()));
+        assertTrue(rule.areLexicallyEqual(task1.getInstances().iterator().next(),
+                                          task1.getInstances().iterator().next()));
+        assertTrue(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(),
+                                              task1.getInstances().iterator().next()));
+        assertTrue(rule.areSemanticallyEqual(task1.getInstances().iterator().next(),
+                                             task1.getInstances().iterator().next()));
+    }
+    
+    /**
+     *
+     */
+    @Test
+    public void test_compare_07() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+        
+        ITask task2 = createNewEventTask(eventType1, eventTarget1);
+        
+        assertEquals(TaskEquality.LEXICALLY_EQUAL,
+                     rule.compare(task1.getInstances().iterator().next(),
+                                  task2.getInstances().iterator().next()));
+        assertTrue(rule.areLexicallyEqual(task1.getInstances().iterator().next(),
+                                          task2.getInstances().iterator().next()));
+        assertTrue(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(),
+                                              task2.getInstances().iterator().next()));
+        assertTrue(rule.areSemanticallyEqual(task1.getInstances().iterator().next(),
+                                             task2.getInstances().iterator().next()));
+
+        assertEquals(TaskEquality.LEXICALLY_EQUAL,
+                     rule.compare(task2.getInstances().iterator().next(),
+                                  task1.getInstances().iterator().next()));
+        assertTrue(rule.areLexicallyEqual(task2.getInstances().iterator().next(),
+                                          task1.getInstances().iterator().next()));
+        assertTrue(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(),
+                                              task1.getInstances().iterator().next()));
+        assertTrue(rule.areSemanticallyEqual(task2.getInstances().iterator().next(),
+                                             task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test_compare_08() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+        
+        IEventType eventType2 = new StringEventType("eventType2");
+        ITask task2 = createNewEventTask(eventType2, eventTarget1);
+        
+        assertEquals(TaskEquality.UNEQUAL,
+                     rule.compare(task1.getInstances().iterator().next(),
+                                  task2.getInstances().iterator().next()));
+        assertFalse(rule.areLexicallyEqual(task1.getInstances().iterator().next(),
+                                           task2.getInstances().iterator().next()));
+        assertFalse(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(),
+                                               task2.getInstances().iterator().next()));
+        assertFalse(rule.areSemanticallyEqual(task1.getInstances().iterator().next(),
+                                              task2.getInstances().iterator().next()));
+
+        assertEquals(TaskEquality.UNEQUAL,
+                     rule.compare(task2.getInstances().iterator().next(),
+                                  task1.getInstances().iterator().next()));
+        assertFalse(rule.areLexicallyEqual(task2.getInstances().iterator().next(),
+                                           task1.getInstances().iterator().next()));
+        assertFalse(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(),
+                                               task1.getInstances().iterator().next()));
+        assertFalse(rule.areSemanticallyEqual(task2.getInstances().iterator().next(),
+                                              task1.getInstances().iterator().next()));
+    }
+
+    /**
+     *
+     */
+    @Test
+    public void test_compare_09() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+        
+        IEventTarget eventTarget2 = new DummyGUIElement("elem2");
+        ITask task2 = createNewEventTask(eventType1, eventTarget2);
+        
+        assertEquals(TaskEquality.UNEQUAL,
+                     rule.compare(task1.getInstances().iterator().next(),
+                                  task2.getInstances().iterator().next()));
+        assertFalse(rule.areLexicallyEqual(task1.getInstances().iterator().next(),
+                                           task2.getInstances().iterator().next()));
+        assertFalse(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(),
+                                               task2.getInstances().iterator().next()));
+        assertFalse(rule.areSemanticallyEqual(task1.getInstances().iterator().next(),
+                                              task2.getInstances().iterator().next()));
+
+        assertEquals(TaskEquality.UNEQUAL,
+                     rule.compare(task2.getInstances().iterator().next(),
+                                  task1.getInstances().iterator().next()));
+        assertFalse(rule.areLexicallyEqual(task2.getInstances().iterator().next(),
+                                           task1.getInstances().iterator().next()));
+        assertFalse(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(),
+                                               task1.getInstances().iterator().next()));
+        assertFalse(rule.areSemanticallyEqual(task2.getInstances().iterator().next(),
+                                              task1.getInstances().iterator().next()));
+    }
+
+
+    /**
+     *
+     */
+    @Test
+    public void test_compare_10() {
+        EventTaskComparisonRule rule = new EventTaskComparisonRule();
+        
+        IEventType eventType1 = new StringEventType("eventType1");
+        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
+        ITask task1 = createNewEventTask(eventType1, eventTarget1);
+        
+        IEventType eventType2 = new StringEventType("eventType2");
+        IEventTarget eventTarget2 = new DummyGUIElement("elem2");
+        ITask task2 = createNewEventTask(eventType2, eventTarget2);
+        
+        assertEquals(TaskEquality.UNEQUAL,
+                     rule.compare(task1.getInstances().iterator().next(),
+                                  task2.getInstances().iterator().next()));
+        assertFalse(rule.areLexicallyEqual(task1.getInstances().iterator().next(),
+                                           task2.getInstances().iterator().next()));
+        assertFalse(rule.areSyntacticallyEqual(task1.getInstances().iterator().next(),
+                                               task2.getInstances().iterator().next()));
+        assertFalse(rule.areSemanticallyEqual(task1.getInstances().iterator().next(),
+                                              task2.getInstances().iterator().next()));
+
+        assertEquals(TaskEquality.UNEQUAL,
+                     rule.compare(task2.getInstances().iterator().next(),
+                                  task1.getInstances().iterator().next()));
+        assertFalse(rule.areLexicallyEqual(task2.getInstances().iterator().next(),
+                                           task1.getInstances().iterator().next()));
+        assertFalse(rule.areSyntacticallyEqual(task2.getInstances().iterator().next(),
+                                               task1.getInstances().iterator().next()));
+        assertFalse(rule.areSemanticallyEqual(task2.getInstances().iterator().next(),
+                                              task1.getInstances().iterator().next()));
+    }
+
 }
