Index: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java
===================================================================
--- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java	(revision 1287)
+++ trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java	(revision 1294)
@@ -26,6 +26,9 @@
 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
@@ -159,5 +162,5 @@
         SymbolMap<ITaskInstance, ITask> uniqueTasks =
             preparationTaskHandlingStrategy.createSymbolMap();
-        TaskComparator comparator = preparationTaskHandlingStrategy.getTaskComparator();
+        TaskInstanceComparator comparator = preparationTaskHandlingStrategy.getTaskComparator();
         
         int unifiedTasks = 0;
@@ -235,14 +238,14 @@
     {
         Map<ITask, IIteration> iterations = new HashMap<ITask, IIteration>();
-        Map<IIteration, List<ITaskInstance>> iterationInstances =
-                new HashMap<IIteration, List<ITaskInstance>>();
+        Map<IIteration, List<IIterationInstance>> iterationInstances =
+                new HashMap<IIteration, List<IIterationInstance>>();
             
         for (ITask iteratedTask : iteratedTasks) {
             IIteration iteration = taskFactory.createNewIteration();
             iterations.put(iteratedTask, iteration);
-            iterationInstances.put(iteration, new LinkedList<ITaskInstance>());
-        }
-        
-        ITaskInstance iterationInstance = null;
+            iterationInstances.put(iteration, new LinkedList<IIterationInstance>());
+        }
+        
+        IIterationInstance iterationInstance = null;
         
         for (IUserSession session : sessions) {
@@ -275,5 +278,6 @@
         }
         
-        for (Map.Entry<IIteration, List<ITaskInstance>> entry : iterationInstances.entrySet()) {
+        for (Map.Entry<IIteration, List<IIterationInstance>> entry : iterationInstances.entrySet())
+        {
             harmonizeIterationInstancesModel(entry.getKey(), entry.getValue());
         }
@@ -283,12 +287,12 @@
      *
      */
-    private void harmonizeIterationInstancesModel(IIteration          iteration,
-                                                  List<ITaskInstance> iterationInstances)
+    private void harmonizeIterationInstancesModel(IIteration               iteration,
+                                                  List<IIterationInstance> iterationInstances)
     {
         List<ITask> iteratedTaskVariants = new LinkedList<ITask>();
-        TaskComparator comparator = preparationTaskHandlingStrategy.getTaskComparator();
+        TaskInstanceComparator comparator = preparationTaskHandlingStrategy.getTaskComparator();
         
         // merge the lexically different variants of iterated task to a unique list 
-        for (ITaskInstance iterationInstance : iterationInstances) {
+        for (IIterationInstance iterationInstance : iterationInstances) {
             for (ITaskInstance executionVariant : iterationInstance) {
                 ITask candidate = executionVariant.getTask();
@@ -323,8 +327,9 @@
             taskBuilder.setMarkedTask(iteration, selection);
             
-            for (ITaskInstance instance : iterationInstances) {
+            for (IIterationInstance instance : iterationInstances) {
                 for (int i = 0; i < instance.size(); i++) {
-                    ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection);
-                    taskBuilder.addChild(selectionInstance, instance.get(i));
+                    ISelectionInstance selectionInstance =
+                        taskFactory.createNewTaskInstance(selection);
+                    taskBuilder.setChild(selectionInstance, instance.get(i));
                     taskBuilder.setTaskInstance(instance, i, selectionInstance);
                 }
@@ -490,5 +495,5 @@
                 Console.traceln(Level.FINEST, "replacing " + sequence.getId() + ": " + task);
 
-                List<ITaskInstance> sequenceInstances =
+                List<ISequenceInstance> sequenceInstances =
                     replaceTaskOccurrences(task, appData.getSessions(), sequence);
                 
@@ -510,9 +515,9 @@
      *
      */
-    private void harmonizeSequenceInstancesModel(ISequence           sequence,
-                                                 List<ITaskInstance> sequenceInstances,
-                                                 int                 sequenceLength)
+    private void harmonizeSequenceInstancesModel(ISequence               sequence,
+                                                 List<ISequenceInstance> sequenceInstances,
+                                                 int                     sequenceLength)
     {
-        TaskComparator comparator = preparationTaskHandlingStrategy.getTaskComparator();
+        TaskInstanceComparator comparator = preparationTaskHandlingStrategy.getTaskComparator();
         
         // ensure for each subtask that lexically different variants are preserved
@@ -520,5 +525,5 @@
             List<ITask> subTaskVariants = new LinkedList<ITask>();
             
-            for (ITaskInstance sequenceInstance : sequenceInstances) {
+            for (ISequenceInstance sequenceInstance : sequenceInstances) {
                 ITask candidate = sequenceInstance.get(subTaskIndex).getTask();
                 
@@ -556,8 +561,8 @@
                 taskBuilder.addChild(sequence, selection);
                 
-                for (ITaskInstance instance : sequenceInstances) {
-                    ITaskInstance selectionInstance =
+                for (ISequenceInstance instance : sequenceInstances) {
+                    ISelectionInstance selectionInstance =
                         taskFactory.createNewTaskInstance(selection);
-                    taskBuilder.addChild(selectionInstance, instance.get(subTaskIndex));
+                    taskBuilder.setChild(selectionInstance, instance.get(subTaskIndex));
                     taskBuilder.setTaskInstance(instance, subTaskIndex, selectionInstance);
                 }
@@ -572,9 +577,9 @@
      * @param tree
      */
-    private List<ITaskInstance> replaceTaskOccurrences(List<ITaskInstance> task,
-                                                       List<IUserSession>  sessions,
-                                                       ISequence           temporalTaskModel)
+    private List<ISequenceInstance> replaceTaskOccurrences(List<ITaskInstance> task,
+                                                           List<IUserSession>  sessions,
+                                                           ISequence           temporalTaskModel)
     {
-        List<ITaskInstance> sequenceInstances = new LinkedList<ITaskInstance>();
+        List<ISequenceInstance> sequenceInstances = new LinkedList<ISequenceInstance>();
         
         for (IUserSession session : sessions) {
