Index: /trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/CondenseSimilarTasksRule.java
===================================================================
--- /trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/CondenseSimilarTasksRule.java	(revision 1853)
+++ /trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/CondenseSimilarTasksRule.java	(revision 1854)
@@ -15,5 +15,4 @@
 package de.ugoe.cs.autoquest.tasktrees.temporalrelation;
 
-import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -23,5 +22,4 @@
 import java.util.List;
 import java.util.Map;
-import java.util.logging.Level;
 
 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality;
@@ -38,5 +36,4 @@
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance;
-import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
@@ -192,7 +189,27 @@
         
         do {
-            //System.out.println("recreating task model");
             appData.setTaskModel(taskFactory.createTaskModel(sessions));
             appData.setMostSimilarTasks(null);
+            
+            // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+            // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>
+            // for (ITask task : appData.getTaskModel().getTasks()) {
+            //     if (task.getInstances().size() <= 0) {
+            //         throw new RuntimeException("task " + task + " has no instances anymore");
+            //     }
+            //     
+            //     try {
+            //         new TaskTreeValidator().validate(task);
+            //     }
+            //     catch (Exception e) {
+            //         new TaskTreeEncoder().encode(task, System.err);
+            //     }
+            // }
+            // 
+            // new TaskTreeValidator().validate(sessions);
+            
+            // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+            // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<
+
 
             Console.println("condensing " + appData.getTaskModel().getTasks().size() + " tasks");
@@ -201,8 +218,4 @@
 
             if (appData.getMostSimilarTasks() != null) {
-                /*System.out.println("*************************************************************");
-                System.out.println("handling " + appData.getMostSimilarTasks().size() +
-                                   " most similar tasks");
-                System.out.println("*************************************************************");*/
                 for (SimilarTasks mostSimilarTask : appData.getMostSimilarTasks()) {
                     handleSimilarTasks(mostSimilarTask, appData);
@@ -212,5 +225,4 @@
             }
             
-            harmonizeEqualMarkingTemporalRelationships(appData);
         }
         while (appData.getMostSimilarTasks() != null);
@@ -266,10 +278,11 @@
         Iterator<ITask> taskIterator = allTasks.iterator();
         List<ITask> taskList = new ArrayList<ITask>(allTasks.size());
+        
         while (taskIterator.hasNext()) {
             ITask task = taskIterator.next();
             
-            if ((task instanceof IStructuringTemporalRelationship)/* &&
-                (!appData.isSelfCreatedTask(task))*/)
-            {
+            // only Sequences need to be compared with each other. Iterations differ only in their
+            // child, i.e., in the child sequences.
+            if (task instanceof ISequence) {
                 taskList.add(task);
             }
@@ -295,5 +308,5 @@
         // discarding tasks in preceding merges.
         
-        //similarTasks.dump(System.out);
+        // similarTasks.dump(System.out);
         
         if ((similarTasks.getLeftHandSide().getInstances().size() <= 0) ||
@@ -313,12 +326,17 @@
             (similarTasks, identTaskHandlStrat.getTaskComparator());
         
-        //similarTasks.dump(System.out);
+        if (similarTasks == null) {
+            // this may happen, if no mergable level of similarity can be found
+            return;
+        }
+        
+        // similarTasks.dump(System.out);
 
         List<FlattenInstruction> flattenInstructions =
             getFlattenInstructions(similarTasks, appData);
         
-        for (FlattenInstruction instruction : flattenInstructions) {
-            instruction.dump(System.out);
-        }
+        // for (FlattenInstruction instruction : flattenInstructions) {
+        //     instruction.dump(System.out);
+        // }
         
         int noOfFlattenedInstances = similarTasks.getLeftHandSide().getInstances().size() +
@@ -330,5 +348,5 @@
         
         for (FlattenInstruction instruction : flattenInstructions) {
-            System.out.println("exclude " + instruction.path);
+            //System.out.println("exclude " + instruction.path);
             excludes.add(instruction.path);
         }
@@ -343,7 +361,17 @@
             (similarTasks.getRightHandSide(), flattenInstructions, flattenedSessions, excludes);
 
+        // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+        // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         /*for (IUserSession session : flattenedSessions.values()) {
-            new TaskTreeEncoder().encode(session, System.out);
+            System.out.println("user session {");
+            
+            for (ITaskInstance instance : session) {
+                System.out.println(instance);
+            }
+            
+            System.out.println("}");
         }*/
+        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+        // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         
         List<IUserSession> flattenedSessionList =
@@ -354,24 +382,36 @@
         
         Map<ITaskInstance, ITaskInstance> replacements = new HashMap<ITaskInstance, ITaskInstance>();
+        ITask replacementTask = null;
+        
         for (Map.Entry<ITaskInstance, IUserSession> entry : flattenedSessions.entrySet()) {
-            
-            
             // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
             // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
             // the user sessions were sufficiently equal to have now only one common task as child
+            
             if (entry.getValue().size() != 1) {
                 //new TaskTreeEncoder().encode(entry.getValue(), System.out, excludes);
                 throw new RuntimeException("flattened sessions were not combined as expected");
             }
+            
+            if (replacementTask == null) {
+                replacementTask = entry.getValue().get(0).getTask();
+            }
+            else if (replacementTask != entry.getValue().get(0).getTask()) {
+                throw new RuntimeException("two separate replacement tasks were calculated as " +
+                                           "replacement, one for both tasks to be merged");
+            }
+            
             // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
             // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
             
-            
             replacements.put(entry.getKey(), entry.getValue().get(0));
         }
-        
         
         // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+        // ((Task) replacementTask).setDescription
+        //     (replacementTask + " calculated as full replacement for " +
+        //      similarTasks.getLeftHandSide() + " and " + similarTasks.getRightHandSide());
+    
         int allInstances = similarTasks.getLeftHandSide().getInstances().size() +
             similarTasks.getRightHandSide().getInstances().size();
@@ -390,7 +430,19 @@
         // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
+        // create also replacements for potential parent iterations or optionals
+        IIteration harmonizedIteration = taskFactory.createNewIteration();
+        taskBuilder.setMarkedTask(harmonizedIteration, replacementTask);
+        
+        IOptional harmonizedOptional = taskFactory.createNewOptional();
+        taskBuilder.setMarkedTask(harmonizedOptional, replacementTask);
         
         for (IUserSession session : appData.getSessions()) {
-            replaceTaskInstances(session, replacements, similarTasks);
+            replaceTaskInstances(session, replacements, similarTasks,
+                                 harmonizedIteration, harmonizedOptional);
+            
+            // several subsequent instances, which had formerly different tasks, may now have the
+            // same. Hence, they need to be merged. But as everything else would be way too complex,
+            // we only perform the merge, if they occur next to each other on the same level
+            mergeSubsequentIdenticalMarkingTemporalRelationships(session);
         }
         
@@ -420,5 +472,5 @@
         
         List<FlattenInstruction> result = new LinkedList<FlattenInstruction>();
-        TaskInstanceComparator comp = identTaskHandlStrat.getTaskComparator();
+        TaskComparator comp = identTaskHandlStrat.getTaskComparator();
         
         // first create instructions for the deltas
@@ -427,4 +479,5 @@
                 (delta.getType() == Delta.TYPE.DELETE))
             {
+                // System.out.println("handling " + delta.getType());
                 Chunk chunk;
                 TaskPath insertAfterPath = null;
@@ -434,4 +487,6 @@
                     chunk = delta.getRevised();
                     int pos = delta.getOriginal().getPosition();
+                    // System.out.println(" position " + pos);
+                    
                     if (pos > 0) {
                         insertAfterPath = leftHandSideTraversal.getTraversalPaths()[pos - 1];
@@ -457,4 +512,6 @@
                     optional = taskFactory.createNewOptional();
                     taskBuilder.setMarkedTask(optional, child);
+                    // ((Task) optional).setDescription(optional.getDescription() +
+                    //                                  " created for " + delta.getType());
                     optional = (IOptional) appData.ensureUnique(optional);
                     createReplacementInstructions(chunk, optional, null, result);
@@ -553,4 +610,6 @@
                         // of the children as variants
                         selection = taskFactory.createNewSelection();
+                        // ((Task) selection).setDescription(selection.getDescription() +
+                        //                                   " created for " + delta.getType());
                         taskBuilder.addChild(selection, child1);
                         taskBuilder.addChild(selection, child2);
@@ -668,5 +727,7 @@
         else {
             ISequence task = taskFactory.createNewSequence();
-            
+            // ((Task) task).setDescription(task.getDescription() +
+            //                              " created to represent a chunk");
+
             for (Object pathObj : chunk.getLines()) {
                 TaskPath path = (TaskPath) pathObj;
@@ -736,5 +797,5 @@
         boolean instructionApplied = false;
         
-        TaskInstanceComparator comp = identTaskHandlStrat.getTaskComparator();
+        TaskComparator comp = identTaskHandlStrat.getTaskComparator();
         
         //System.out.println("applying instructions on " + taskPath);
@@ -743,5 +804,5 @@
             if (instruction.matches(taskPath)) {
                 //System.out.print("found instruction ");
-                instruction.dump(System.out);
+                //instruction.dump(System.out);
                 
                 switch (instruction.getInstruction()) {
@@ -998,5 +1059,7 @@
     private void replaceTaskInstances(ITaskInstanceList                 taskInstanceList,
                                       Map<ITaskInstance, ITaskInstance> replacements,
-                                      SimilarTasks                      similarTasks)
+                                      SimilarTasks                      similarTasks,
+                                      IIteration                        harmonizedIteration,
+                                      IOptional                         harmonizedOptional)
     {
         for (int i = 0; i < taskInstanceList.size(); i++) {
@@ -1006,13 +1069,8 @@
             if (replacement != null) {
                 
-                // update the model
+                // update the model for sequences (others are updated in the calling method)
                 if (taskInstanceList instanceof ISequenceInstance) {
                     ISequence task = ((ISequenceInstance) taskInstanceList).getSequence();
                     taskBuilder.setChild(task, i, replacement.getTask());
-                }
-                else if (taskInstanceList instanceof IIterationInstance) {
-                    taskBuilder.setMarkedTask
-                        (((IIterationInstance) taskInstanceList).getIteration(),
-                         replacement.getTask());
                 }
                 
@@ -1023,12 +1081,14 @@
                 discardTaskInstancesNotBelongingToTraversals(childInstance, path, similarTasks);
             }
-            else if (childInstance instanceof ITaskInstanceList) {
-                replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks);
-            }
-            else if (childInstance instanceof IOptionalInstance) {
-                replaceTaskInstances((IOptionalInstance) childInstance, replacements, similarTasks);
-            }
-            else if (childInstance instanceof ISelectionInstance) {
-                replaceTaskInstances((ISelectionInstance) childInstance, replacements, similarTasks);
+            else {
+                ITask modelUpdate = replaceTaskInstances(childInstance, replacements, similarTasks,
+                                                         harmonizedIteration, harmonizedOptional);
+                
+                if (modelUpdate != null) {
+                    if (taskInstanceList instanceof ISequenceInstance) {
+                        taskBuilder.setChild
+                            (((ISequenceInstance) taskInstanceList).getSequence(), i, modelUpdate);
+                    }
+                }
             }
         }
@@ -1040,5 +1100,7 @@
     private void replaceTaskInstances(IOptionalInstance                 optionalInstance,
                                       Map<ITaskInstance, ITaskInstance> replacements,
-                                      SimilarTasks                      similarTasks)
+                                      SimilarTasks                      similarTasks,
+                                      IIteration                        harmonizedIteration,
+                                      IOptional                         harmonizedOptional)
     {
         ITaskInstance childInstance = optionalInstance.getChild();
@@ -1048,7 +1110,5 @@
             
             if (replacement != null) {
-                
-                // update the model
-                taskBuilder.setMarkedTask(optionalInstance.getOptional(), replacement.getTask());
+                // do not update the model --> is updated in the calling method
                 
                 // perform the actual replacement and throw away the instance
@@ -1058,13 +1118,11 @@
                 discardTaskInstancesNotBelongingToTraversals(childInstance, path, similarTasks);
             }
-            else if (childInstance instanceof ITaskInstanceList) {
-                replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks);
-            }
-            else if (childInstance instanceof ISelectionInstance) {
-                replaceTaskInstances((ISelectionInstance) childInstance, replacements, similarTasks);
-            }
-            else if (childInstance instanceof IOptionalInstance) {
-                throw new IllegalArgumentException
-                    ("optional must not have an optional as its child");
+            else {
+                ITask modelUpdate = replaceTaskInstances(childInstance, replacements, similarTasks,
+                                                         harmonizedIteration, harmonizedOptional);
+                
+                if (modelUpdate != null) {
+                    taskBuilder.setMarkedTask(optionalInstance.getOptional(), modelUpdate);
+                }
             }
         }
@@ -1076,7 +1134,9 @@
     private void replaceTaskInstances(ISelectionInstance                selectionInstance,
                                       Map<ITaskInstance, ITaskInstance> replacements,
-                                      SimilarTasks                      similarTasks)
+                                      SimilarTasks                      similarTasks,
+                                      IIteration                        harmonizedIteration,
+                                      IOptional                         harmonizedOptional)
     {
-        TaskInstanceComparator comparator = identTaskHandlStrat.getTaskComparator();
+        TaskComparator comparator = identTaskHandlStrat.getTaskComparator();
         
         ITaskInstance childInstance = selectionInstance.getChild();
@@ -1116,15 +1176,75 @@
                 discardTaskInstancesNotBelongingToTraversals(childInstance, path, similarTasks);
             }
-            else if (childInstance instanceof ITaskInstanceList) {
-                replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks);
-            }
-            else if (childInstance instanceof IOptionalInstance) {
-                replaceTaskInstances((IOptionalInstance) childInstance, replacements, similarTasks);
-            }
-            else if (childInstance instanceof ISelectionInstance) {
-                throw new IllegalArgumentException
-                    ("selection must not have a selection as its child");
-            }
-        }
+            else {
+                ITask modelUpdate = replaceTaskInstances(childInstance, replacements, similarTasks,
+                                                         harmonizedIteration, harmonizedOptional);
+                
+                if (modelUpdate != null) {
+                    taskBuilder.removeChild
+                        (selectionInstance.getSelection(), childInstance.getTask());
+
+                    boolean found = false;
+                    for (ITask child : selectionInstance.getSelection().getChildren()) {
+                        if (comparator.equals(child, modelUpdate)) {
+                            found = true;
+                            break;
+                        }
+                    }
+                    
+                    if (!found) {
+                        taskBuilder.addChild(selectionInstance.getSelection(), modelUpdate);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    private ITask replaceTaskInstances(ITaskInstance                     childInstance,
+                                       Map<ITaskInstance, ITaskInstance> replacements,
+                                       SimilarTasks                      similarTasks,
+                                       IIteration                        harmonizedIteration,
+                                       IOptional                         harmonizedOptional)
+    {
+        ITask modelUpdate = null;
+        
+        if (childInstance instanceof IIterationInstance) {
+            ITask markedTask = ((IIterationInstance) childInstance).getIteration().getMarkedTask();
+            
+            if ((markedTask == similarTasks.getLeftHandSide()) ||
+                (markedTask == similarTasks.getRightHandSide()))
+            {
+                taskBuilder.setTask(childInstance, harmonizedIteration);
+                modelUpdate = harmonizedIteration;
+            }
+
+            replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks,
+                                 harmonizedIteration, harmonizedOptional);
+        }
+        else if (childInstance instanceof IOptionalInstance) {
+            ITask markedTask = ((IOptionalInstance) childInstance).getOptional().getMarkedTask();
+            
+            if ((markedTask == similarTasks.getLeftHandSide()) ||
+                (markedTask == similarTasks.getRightHandSide()))
+            {
+                taskBuilder.setTask(childInstance, harmonizedOptional);
+                modelUpdate = harmonizedOptional;
+            }
+            
+            replaceTaskInstances((IOptionalInstance) childInstance, replacements, similarTasks,
+                                 harmonizedIteration, harmonizedOptional);
+        }
+        else if (childInstance instanceof ISelectionInstance) {
+            replaceTaskInstances((ISelectionInstance) childInstance, replacements, similarTasks,
+                                 harmonizedIteration, harmonizedOptional);
+        }
+        else if (childInstance instanceof ISequenceInstance) {
+            replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks,
+                                 harmonizedIteration, harmonizedOptional);
+        }
+        
+        return modelUpdate;
     }
 
@@ -1198,100 +1318,4 @@
         }
     }
-
-    /**
-     *
-     */
-    private void harmonizeEqualMarkingTemporalRelationships(RuleApplicationData appData) {
-        Console.println("harmonizing marking temporal relationships");
-        
-        TaskInstanceComparator comparator = identTaskHandlStrat.getTaskComparator();
-        ITaskModel model = taskFactory.createTaskModel(appData.getSessions());
-        
-        // determine a list of equal marking temporal relationship lists
-        List<List<IMarkingTemporalRelationship>> equalTasks =
-            new LinkedList<List<IMarkingTemporalRelationship>>();
-        
-        for (ITask task1 : model.getTasks()) {
-            if (task1 instanceof IMarkingTemporalRelationship) {
-                IMarkingTemporalRelationship parent1 = (IMarkingTemporalRelationship) task1;
-                for (ITask task2 : model.getTasks()) {
-                    if (task2 instanceof IMarkingTemporalRelationship) {
-                        IMarkingTemporalRelationship parent2 = (IMarkingTemporalRelationship) task2;
-                        
-                        // check if the parents are of the same type, but distinct and if the
-                        // children are identical
-                        if (!comparator.equals(parent1, parent2) &&
-                            (parent1.getClass().isAssignableFrom(parent2.getClass()) ||
-                             parent2.getClass().isAssignableFrom(parent1.getClass())) &&
-                            comparator.equals(parent1.getMarkedTask(), parent2.getMarkedTask()))
-                        {
-                            List<IMarkingTemporalRelationship> equalTaskList = null;
-                            
-                            GET_EQUAL_TASK_LIST:
-                            for (List<IMarkingTemporalRelationship> candidate : equalTasks) {
-                                for (IMarkingTemporalRelationship task : candidate) {
-                                    if (comparator.equals(task, parent1) ||
-                                        comparator.equals(task, parent2))
-                                    {
-                                        equalTaskList = candidate;
-                                        break GET_EQUAL_TASK_LIST;
-                                    }
-                                }
-                            }
-                            
-                            if (equalTaskList == null) {
-                                equalTaskList = new LinkedList<IMarkingTemporalRelationship>();
-                                equalTasks.add(equalTaskList);
-                            }
-                            
-                            boolean found1 = false;
-                            boolean found2 = false;
-                            
-                            for (IMarkingTemporalRelationship task : equalTaskList) {
-                                if (comparator.equals(task, parent1)) {
-                                    found1 = true;
-                                }
-                                else if (comparator.equals(task, parent2)) {
-                                    found2 = true;
-                                }
-                            }
-                            
-                            if (!found1) {
-                                equalTaskList.add(parent1);
-                            }
-                            
-                            if (!found2) {
-                                equalTaskList.add(parent2);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        
-        Console.traceln(Level.FINER, "found " + equalTasks.size() +
-                        " groups of equal marking temporal relationships");
-        
-        // set the same task for all instances
-        List<ITaskInstance> instanceBuffer = new ArrayList<ITaskInstance>();
-        for (List<IMarkingTemporalRelationship> equalTaskList : equalTasks) {
-            for (int i = 1; i < equalTaskList.size(); i++) {
-                // to prevent a concurrent modification, first copy the list of instances
-                instanceBuffer.clear();
-                instanceBuffer.addAll(equalTaskList.get(i).getInstances());
-                for (ITaskInstance instance : instanceBuffer) {
-                    taskBuilder.setTask(instance, equalTaskList.get(0));
-                }
-            }
-        }
-        
-        // several subsequent instances, which had formerly different tasks, may now have the same.
-        // Hence, they need to be merged. But as everything else would be way too complex, we only
-        // perform the merge, if they occur next to each other on the same level
-        for (IUserSession session : appData.getSessions()) {
-            mergeSubsequentIdenticalMarkingTemporalRelationships(session);
-        }
-        
-    }
     
     /**
@@ -1300,5 +1324,5 @@
     private void mergeSubsequentIdenticalMarkingTemporalRelationships(ITaskInstanceList list) {
         int index = 0;
-        TaskInstanceComparator comparator = identTaskHandlStrat.getTaskComparator();
+        TaskComparator comparator = identTaskHandlStrat.getTaskComparator();
         
         while (index < (list.size() - 1)) {
@@ -1445,5 +1469,5 @@
          * 
          */
-        RuleApplicationData(List<IUserSession> sessions) {
+        private RuleApplicationData(List<IUserSession> sessions) {
             this.sessions = sessions;
         }
@@ -1465,5 +1489,5 @@
          * @return the mostSimilarTasksDeterminer
          */
-        MostSimilarTaskDeterminer getMostSimilarTasksDeterminer() {
+        private MostSimilarTaskDeterminer getMostSimilarTasksDeterminer() {
             return mostSimilarTasksDeterminer;
         }
@@ -1472,5 +1496,5 @@
          *
          */
-        void markAsAlreadyCondensed(ITask task1, ITask task2) {
+        private void markAsAlreadyCondensed(ITask task1, ITask task2) {
             mostSimilarTasksDeterminer.addComparisonToSkip(task1, task2);
         }
@@ -1550,5 +1574,5 @@
                         ITask child2 = ((IOptional) newTask).getMarkedTask();
                         if (createdChildEquals(child1, child2)) {
-                            System.out.println("reusing optional " + newTask + " for " + task);
+                            // System.out.println("reusing optional " + newTask + " for " + task);
                             return newTask;
                         }
@@ -1562,7 +1586,7 @@
                         List<ITask> children2 = ((ISelection) newTask).getChildren();
                         if (createdSelectionChildrenEqual(children1, children2)) {
-                            System.out.println("reusing selection " + newTask + " for " + task);
+                            /*System.out.println("reusing selection " + newTask + " for " + task);
                             
-                            /*System.out.println("---------------------------- existing task");
+                            System.out.println("---------------------------- existing task");
                             new TaskTreeEncoder().encode(newTask, System.out);
                             
@@ -1606,5 +1630,5 @@
 
                     if (equal) {
-                        System.out.println("reusing sequence " + candidate + " for " + task);
+                        // System.out.println("reusing sequence " + candidate + " for " + task);
                         return candidate;
                     }
@@ -1788,21 +1812,21 @@
         
 
-        /**
-         *
-         */
-        void dump(PrintStream out) {
-            for (int i = 0; i < path.size(); i++) {
-                out.print("-->");
-                out.print(path.getTask(i).getId());
-                out.print('(');
-                out.print(path.get(i).getIndex());
-                out.print(')');
-            }
-            
-            out.print("  ");
-            out.print(instruction);
-           
-            out.println();
-        }
+//        /**
+//         *
+//         */
+//        void dump(PrintStream out) {
+//            for (int i = 0; i < path.size(); i++) {
+//                out.print("-->");
+//                out.print(path.getTask(i).getId());
+//                out.print('(');
+//                out.print(path.get(i).getIndex());
+//                out.print(')');
+//            }
+//            
+//            out.print("  ");
+//            out.print(instruction);
+//           
+//            out.println();
+//        }
         
     }
