Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/manager/TaskTreeManagerTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/manager/TaskTreeManagerTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/manager/TaskTreeManagerTest.java	(revision 445)
@@ -0,0 +1,578 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TaskTreeManagerTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: Patrick $  $Date: 08.11.2011 21:32:36 $
+// Project   : TaskTreePerformanceTest
+// Creation  : 2011 by Patrick
+// Copyright : Patrick Harms, 2011
+//-------------------------------------------------------------------------------------------------
+
+package de.ugoe.cs.quest.tasktrees.manager;
+
+import java.util.logging.Logger;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.manager.ComponentManager;
+import de.ugoe.cs.quest.tasktrees.manager.TaskTreeManager;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
+import de.ugoe.cs.quest.tasktrees.testutils.SimpleLogFormatter;
+import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.userinteraction.Interaction;
+import de.ugoe.cs.tasktree.userinteraction.InteractionEvent;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ *
+ * @version $Revision: $ $Date: $
+ * @author  2011, last modified by $Author: $
+ */
+//-------------------------------------------------------------------------------------------------
+
+public class TaskTreeManagerTest
+{
+  /** */
+  TaskTreeManager mManager;
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Before
+  public void setUp()
+  {
+    Logger.getLogger("").getHandlers()[0].setFormatter(new SimpleLogFormatter());
+    
+    mManager = new TaskTreeManager();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @After
+  public void tearDown()
+  {
+    mManager = null;
+    ComponentManager.clearInstance();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testOneInteractionOnOneElement()
+  {
+    simulateInteraction(new DummyGUIElement("elem1"), new DummyInteraction("bla", 1));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence {" +
+       "  Interaction bla {}" +
+       "}", mManager.getTaskTree().getTaskMap());
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testManyInteractionsOnOneElement()
+  {
+    GUIElement element = new DummyGUIElement("elem1");
+    simulateInteraction(element, new DummyInteraction("bla", 1));
+    simulateInteraction(element, new DummyInteraction("bli", 1));
+    simulateInteraction(element, new DummyInteraction("blo", 1));
+    simulateInteraction(element, new DummyInteraction("blu", 1));
+    simulateInteraction(element, new DummyInteraction("bla", 1));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence {" +
+       "  Interaction bla {}" +
+       "  Interaction bli {}" +
+       "  Interaction blo {}" +
+       "  Interaction blu {}" +
+       "  Interaction bla {}" +
+       "}", mManager.getTaskTree().getTaskMap());
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testOneInteractionOnManyElements()
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem2");
+    GUIElement element3 = new DummyGUIElement("elem3");
+    GUIElement element4 = new DummyGUIElement("elem4");
+    GUIElement element5 = new DummyGUIElement("elem5");
+    GUIElement element6 = new DummyGUIElement("elem6");
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element2, new DummyInteraction("bli", 1));
+    simulateInteraction(element3, new DummyInteraction("bla", 1));
+    simulateInteraction(element4, new DummyInteraction("bli", 1));
+    simulateInteraction(element5, new DummyInteraction("blo", 1));
+    simulateInteraction(element6, new DummyInteraction("bla", 1));
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bli {}" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    Interaction bli {}" +
+       "  }" +
+       "  Sequence sequence5 {" +
+       "    Interaction blo {}" +
+       "  }" +
+       "  Sequence sequence6 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testManyInteractionsOnManyElements()
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem2");
+    GUIElement element3 = new DummyGUIElement("elem3");
+    GUIElement element4 = new DummyGUIElement("elem4");
+    GUIElement element5 = new DummyGUIElement("elem5");
+    GUIElement element6 = new DummyGUIElement("elem6");
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element1, new DummyInteraction("bli", 1));
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element2, new DummyInteraction("bli", 1));
+    simulateInteraction(element2, new DummyInteraction("blo", 1));
+    simulateInteraction(element3, new DummyInteraction("bla", 1));
+    simulateInteraction(element4, new DummyInteraction("bli", 1));
+    simulateInteraction(element4, new DummyInteraction("bla", 1));
+    simulateInteraction(element4, new DummyInteraction("bli", 1));
+    simulateInteraction(element4, new DummyInteraction("blo", 1));
+    simulateInteraction(element5, new DummyInteraction("bla", 1));
+    simulateInteraction(element6, new DummyInteraction("bli", 1));
+    simulateInteraction(element6, new DummyInteraction("bla", 1));
+    simulateInteraction(element6, new DummyInteraction("bli", 1));
+    simulateInteraction(element6, new DummyInteraction("blo", 1));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bli {}" +
+       "    Interaction blo {}" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    Interaction bli {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction blo {}" +
+       "  }" +
+       "  Sequence sequence5 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence6 {" +
+       "    Interaction bli {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction blo {}" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testInteractionIterationDetection() throws Exception
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    Interaction interaction1 = new DummyInteraction("bla", 1);
+    simulateInteraction(element1, interaction1);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Interaction bla {}" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+    
+    // now test with preceding and trailing other interactions
+    Interaction interaction2 = new DummyInteraction("bli", 1);
+    Interaction interaction3 = new DummyInteraction("blup", 1);
+
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+    }
+    simulateInteraction(element1, interaction3);
+    simulateInteraction(element1, interaction2);
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction bli {}" +
+       "  Interaction blup {}" +
+       "  Iteration iteration2 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction blup {}" +
+       "  Interaction bli {}" +
+       "}", mManager.getTaskTree().getTaskMap());    
+  
+    // now test with iterations of iterations
+
+    for (int i = 0; i < 10; i++)
+    {
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction1);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction2);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction3);
+      }
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Iteration iteration0 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction bli {}" +
+       "  Interaction blup {}" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction blup {}" +
+       "  Interaction bli {}" +
+       "  Iteration iteration2 {" +
+       "    Sequence sequence1 {" +
+       "      Iteration iteration3 {" +
+       "        Interaction bla {}" +
+       "      }" +
+       "      Iteration iteration4 {" +
+       "        Interaction bli {}" +
+       "      }" +
+       "      Iteration iteration5 {" +
+       "        Interaction blup {}" +
+       "      }" +
+       "    }" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+  
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testSequenceIterationDetection() throws Exception
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    Interaction interaction1 = new DummyInteraction("bla", 1);
+    Interaction interaction2 = new DummyInteraction("bli", 1);
+    Interaction interaction3 = new DummyInteraction("blup", 1);
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Interaction bla {}" +
+       "  Interaction bli {}" +
+       "  Interaction blup {}" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+      simulateInteraction(element1, interaction2);
+      simulateInteraction(element1, interaction3);
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+    
+    // now test with preceding and trailing other interactions
+    Interaction interaction4 = new DummyInteraction("ble", 1);
+    Interaction interaction5 = new DummyInteraction("blo", 1);
+    Interaction interaction6 = new DummyInteraction("blu", 1);
+    simulateInteraction(element1, interaction4);
+    simulateInteraction(element1, interaction5);
+    simulateInteraction(element1, interaction6);
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+      simulateInteraction(element1, interaction2);
+      simulateInteraction(element1, interaction3);
+    }
+    simulateInteraction(element1, interaction6);
+    simulateInteraction(element1, interaction5);
+    simulateInteraction(element1, interaction4);
+    
+    new TaskTreeChecker().assertTaskMap
+    ("Sequence sequence1 {" +
+     "  Iteration iteration1 {" +
+     "    Sequence sequence2 {" +
+     "      Interaction bla {}" +
+     "      Interaction bli {}" +
+     "      Interaction blup {}" +
+     "    }" +
+     "  }" +
+     "  Interaction ble {}" +
+     "  Interaction blo {}" +
+     "  Interaction blu {}" +
+     "  Iteration iteration2 {" +
+     "    Sequence sequence3 {" +
+     "      Interaction bla {}" +
+     "      Interaction bli {}" +
+     "      Interaction blup {}" +
+     "    }" +
+     "  }" +
+     "  Interaction blu {}" +
+     "  Interaction blo {}" +
+     "  Interaction ble {}" +
+     "}", mManager.getTaskTree().getTaskMap());    
+  
+    // now test with iterations of iterations
+    for (int i = 0; i < 10; i++)
+    {
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction1);
+        simulateInteraction(element1, interaction2);
+        simulateInteraction(element1, interaction3);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction2);
+        simulateInteraction(element1, interaction1);
+        simulateInteraction(element1, interaction3);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction1);
+        simulateInteraction(element1, interaction2);
+        simulateInteraction(element1, interaction3);
+      }
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "  Interaction ble {}" +
+       "  Interaction blo {}" +
+       "  Interaction blu {}" +
+       "  Iteration iteration2 {" +
+       "    Sequence sequence3 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "  Interaction blu {}" +
+       "  Interaction blo {}" +
+       "  Interaction ble {}" +
+       "  Iteration iteration3 {" +
+       "    Sequence sequence4 {" +
+       "      Iteration iteration4 {" +
+       "        Sequence sequence4 {" +
+       "          Interaction bla {}" +
+       "          Interaction bli {}" +
+       "          Interaction blup {}" +
+       "        }" +
+       "      }" +
+       "      Iteration iteration5 {" +
+       "        Sequence sequence5 {" +
+       "          Interaction bli {}" +
+       "          Interaction bla {}" +
+       "          Interaction blup {}" +
+       "        }" +
+       "      }" +
+       "      Iteration iteration6 {" +
+       "        Sequence sequence6 {" +
+       "          Interaction bla {}" +
+       "          Interaction bli {}" +
+       "          Interaction blup {}" +
+       "        }" +
+       "      }" +
+       "    }" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testGUIElementHierarchyChanges() throws Exception
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem2");
+    GUIElement element3 = new DummyGUIElement("elem3");
+    GUIElement parent1 = new DummyGUIElement("parent1");
+    GUIElement parent2 = new DummyGUIElement("parent2");
+    GUIElement parent3 = new DummyGUIElement("parent3");
+    
+    element1.setParent(parent1);
+    element2.setParent(parent2);
+    element3.setParent(parent3);
+    
+    parent1.setParent(parent2);
+    parent2.setParent(parent3);
+    
+    Interaction interaction1 = new DummyInteraction("bla", 1);
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element2, interaction1);
+    simulateInteraction(element3, interaction1);
+    simulateInteraction(element2, interaction1);
+    simulateInteraction(element3, interaction1);
+    simulateInteraction(element2, interaction1);
+    simulateInteraction(element1, interaction1);
+   
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Iteration iteration0 {" +
+       "    Sequence sequence3 {" +
+       "      Sequence sequence4 {" +
+       "        Interaction bla {}" +
+       "      }" +
+       "      Sequence sequence5 {" +
+       "        Interaction bla {}" +
+       "      }" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence6 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", mManager.getTaskTree().getTaskMap());    
+
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @param interactionsDoNotOverwriteElement
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void simulateInteraction(GUIElement GUIElement, Interaction interaction)
+  {
+    mManager.handleNewInteractionEvent(new InteractionEvent(GUIElement, interaction));
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java	(revision 445)
@@ -0,0 +1,101 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: AbstractTemporalRelationshipTC.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 28.04.2012 $
+// Project   : TaskTreeTemporalRelationship
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.temporalrelation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.junit.Before;
+
+import de.ugoe.cs.quest.tasktrees.nodeequality.NodeEqualityRuleManager;
+import de.ugoe.cs.quest.tasktrees.temporalrelation.TemporalRelationshipRuleManager;
+import de.ugoe.cs.quest.tasktrees.testutils.SimpleLogFormatter;
+import de.ugoe.cs.quest.tasktrees.testutils.Utilities;
+import de.ugoe.cs.quest.tasktrees.treeifc.InteractionTask;
+import de.ugoe.cs.quest.tasktrees.treeifc.Sequence;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTree;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeBuilder;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNodeFactory;
+import de.ugoe.cs.quest.tasktrees.treeimpl.TaskTreeBuilderImpl;
+import de.ugoe.cs.quest.tasktrees.treeimpl.TaskTreeNodeFactoryImpl;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.userinteraction.Interaction;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 28.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class AbstractTemporalRelationshipTC
+{
+
+  /** */
+  private List<InteractionTask> mInteractions;
+  
+  /** */
+  private TaskTreeBuilder mTaskTreeBuilder = new TaskTreeBuilderImpl();
+
+  /** */
+  private TaskTreeNodeFactory mTaskTreeNodeFactory = new TaskTreeNodeFactoryImpl();
+  
+  /** */
+  private NodeEqualityRuleManager mNodeEqualityRuleManager =
+    Utilities.getNodeEqualityRuleManagerForTests();
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Before
+  public void setUp()
+  {
+    Logger.getLogger("").getHandlers()[0].setFormatter(new SimpleLogFormatter());
+    mInteractions = new ArrayList<InteractionTask>();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @param interactionsDoNotOverwriteElement
+   */
+  //-----------------------------------------------------------------------------------------------
+  protected void simulateInteraction(GUIElement GUIElement, Interaction interaction)
+  {
+    mInteractions.add
+      (mTaskTreeNodeFactory.createNewInteractionTask(GUIElement, interaction));
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @param interactionsDoNotOverwriteElement
+   * @return 
+   */
+  //-----------------------------------------------------------------------------------------------
+  protected TaskTree getTaskTree()
+  {
+    Sequence sequence = mTaskTreeNodeFactory.createNewSequence();
+    
+    for (InteractionTask task : mInteractions)
+    {
+      mTaskTreeBuilder.addChild(sequence, task);
+    }
+    
+    TemporalRelationshipRuleManager ruleManager =
+      new TemporalRelationshipRuleManager(mNodeEqualityRuleManager);
+    
+    ruleManager.init();
+    ruleManager.applyRules(sequence, mTaskTreeBuilder, mTaskTreeNodeFactory, true);
+    
+    return mTaskTreeNodeFactory.createTaskTree(sequence);
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultGUIElementSequenceDetectionRuleTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultGUIElementSequenceDetectionRuleTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultGUIElementSequenceDetectionRuleTest.java	(revision 445)
@@ -0,0 +1,232 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TaskTreeManagerTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: Patrick $  $Date: 08.11.2011 21:32:36 $
+// Project   : TaskTreePerformanceTest
+// Creation  : 2011 by Patrick
+// Copyright : Patrick Harms, 2011
+//-------------------------------------------------------------------------------------------------
+
+package de.ugoe.cs.quest.tasktrees.temporalrelation;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
+import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.userinteraction.Interaction;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ *
+ * @version $Revision: $ $Date: $
+ * @author  2011, last modified by $Author: $
+ */
+//-------------------------------------------------------------------------------------------------
+public class DefaultGUIElementSequenceDetectionRuleTest extends AbstractTemporalRelationshipTC
+{
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testOneInteractionOnOneElement()
+  {
+    simulateInteraction(new DummyGUIElement("elem1"), new DummyInteraction("bla", 1));
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence {" +
+       "  Interaction bla {}" +
+       "}", getTaskTree().getTaskMap());
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testManyInteractionsOnOneElement()
+  {
+    GUIElement element = new DummyGUIElement("elem1");
+    simulateInteraction(element, new DummyInteraction("bla", 1));
+    simulateInteraction(element, new DummyInteraction("bli", 1));
+    simulateInteraction(element, new DummyInteraction("blo", 1));
+    simulateInteraction(element, new DummyInteraction("blu", 1));
+    simulateInteraction(element, new DummyInteraction("bla", 1));
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence {" +
+       "  Interaction bla {}" +
+       "  Interaction bli {}" +
+       "  Interaction blo {}" +
+       "  Interaction blu {}" +
+       "  Interaction bla {}" +
+       "}", getTaskTree().getTaskMap());
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testOneInteractionOnManyElements()
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem2");
+    GUIElement element3 = new DummyGUIElement("elem3");
+    GUIElement element4 = new DummyGUIElement("elem4");
+    GUIElement element5 = new DummyGUIElement("elem5");
+    GUIElement element6 = new DummyGUIElement("elem6");
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element2, new DummyInteraction("bli", 1));
+    simulateInteraction(element3, new DummyInteraction("bla", 1));
+    simulateInteraction(element4, new DummyInteraction("bli", 1));
+    simulateInteraction(element5, new DummyInteraction("blo", 1));
+    simulateInteraction(element6, new DummyInteraction("bla", 1));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bli {}" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    Interaction bli {}" +
+       "  }" +
+       "  Sequence sequence5 {" +
+       "    Interaction blo {}" +
+       "  }" +
+       "  Sequence sequence6 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testManyInteractionsOnManyElements()
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem2");
+    GUIElement element3 = new DummyGUIElement("elem3");
+    GUIElement element4 = new DummyGUIElement("elem4");
+    GUIElement element5 = new DummyGUIElement("elem5");
+    GUIElement element6 = new DummyGUIElement("elem6");
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element1, new DummyInteraction("bli", 1));
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element2, new DummyInteraction("bli", 1));
+    simulateInteraction(element2, new DummyInteraction("blo", 1));
+    simulateInteraction(element3, new DummyInteraction("bla", 1));
+    simulateInteraction(element4, new DummyInteraction("bli", 1));
+    simulateInteraction(element4, new DummyInteraction("bla", 1));
+    simulateInteraction(element4, new DummyInteraction("bli", 1));
+    simulateInteraction(element4, new DummyInteraction("blo", 1));
+    simulateInteraction(element5, new DummyInteraction("bla", 1));
+    simulateInteraction(element6, new DummyInteraction("bli", 1));
+    simulateInteraction(element6, new DummyInteraction("bla", 1));
+    simulateInteraction(element6, new DummyInteraction("bli", 1));
+    simulateInteraction(element6, new DummyInteraction("blo", 1));
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bli {}" +
+       "    Interaction blo {}" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    Interaction bli {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction blo {}" +
+       "  }" +
+       "  Sequence sequence5 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence6 {" +
+       "    Interaction bli {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction blo {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testGUIElementHierarchyChanges() throws Exception
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem2");
+    GUIElement element3 = new DummyGUIElement("elem3");
+    GUIElement parent1 = new DummyGUIElement("parent1");
+    GUIElement parent2 = new DummyGUIElement("parent2");
+    GUIElement parent3 = new DummyGUIElement("parent3");
+    
+    element1.setParent(parent1);
+    element2.setParent(parent2);
+    element3.setParent(parent3);
+    
+    parent1.setParent(parent2);
+    parent2.setParent(parent3);
+    
+    Interaction interaction1 = new DummyInteraction("bla", 1);
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element2, interaction1);
+    simulateInteraction(element3, interaction1);
+    simulateInteraction(element2, interaction1);
+    simulateInteraction(element3, interaction1);
+    simulateInteraction(element2, interaction1);
+    simulateInteraction(element1, interaction1);
+   
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Iteration iteration0 {" +
+       "    Sequence sequence3 {" +
+       "      Sequence sequence4 {" +
+       "        Interaction bla {}" +
+       "      }" +
+       "      Sequence sequence5 {" +
+       "        Interaction bla {}" +
+       "      }" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence6 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+  }
+  
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultIterationDetectionRuleTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultIterationDetectionRuleTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultIterationDetectionRuleTest.java	(revision 445)
@@ -0,0 +1,329 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: DefaultIterationDetectionRuleTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 28.04.2012 $
+// Project   : TaskTreeTemporalRelationship
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.temporalrelation;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
+import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.userinteraction.Interaction;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 28.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class DefaultIterationDetectionRuleTest extends AbstractTemporalRelationshipTC
+{
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testInteractionIterationDetection() throws Exception
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    Interaction interaction1 = new DummyInteraction("bla", 1);
+    simulateInteraction(element1, interaction1);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Interaction bla {}" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+    
+    // now test with preceding and trailing other interactions
+    Interaction interaction2 = new DummyInteraction("bli", 1);
+    Interaction interaction3 = new DummyInteraction("blup", 1);
+
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+    }
+    simulateInteraction(element1, interaction3);
+    simulateInteraction(element1, interaction2);
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction bli {}" +
+       "  Interaction blup {}" +
+       "  Iteration iteration2 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction blup {}" +
+       "  Interaction bli {}" +
+       "}", getTaskTree().getTaskMap());    
+  
+    // now test with iterations of iterations
+
+    for (int i = 0; i < 10; i++)
+    {
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction1);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction2);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction3);
+      }
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction bli {}" +
+       "  Interaction blup {}" +
+       "  Iteration iteration2 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "  Interaction blup {}" +
+       "  Interaction bli {}" +
+       "  Iteration iteration3 {" +
+       "    Sequence sequence2 {" +
+       "      Iteration iteration4 {" +
+       "        Interaction bla {}" +
+       "      }" +
+       "      Iteration iteration5 {" +
+       "        Interaction bli {}" +
+       "      }" +
+       "      Iteration iteration6 {" +
+       "        Interaction blup {}" +
+       "      }" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+  
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testSequenceIterationDetection() throws Exception
+  {
+    GUIElement element1 = new DummyGUIElement("elem1");
+    Interaction interaction1 = new DummyInteraction("bla", 1);
+    Interaction interaction2 = new DummyInteraction("bli", 1);
+    Interaction interaction3 = new DummyInteraction("blup", 1);
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Interaction bla {}" +
+       "  Interaction bli {}" +
+       "  Interaction blup {}" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, interaction1);
+    simulateInteraction(element1, interaction2);
+    simulateInteraction(element1, interaction3);
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+      simulateInteraction(element1, interaction2);
+      simulateInteraction(element1, interaction3);
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+    
+    // now test with preceding and trailing other interactions
+    Interaction interaction4 = new DummyInteraction("ble", 1);
+    Interaction interaction5 = new DummyInteraction("blo", 1);
+    Interaction interaction6 = new DummyInteraction("blu", 1);
+    simulateInteraction(element1, interaction4);
+    simulateInteraction(element1, interaction5);
+    simulateInteraction(element1, interaction6);
+    for (int i = 0; i < 10; i++)
+    {
+      simulateInteraction(element1, interaction1);
+      simulateInteraction(element1, interaction2);
+      simulateInteraction(element1, interaction3);
+    }
+    simulateInteraction(element1, interaction6);
+    simulateInteraction(element1, interaction5);
+    simulateInteraction(element1, interaction4);
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "  Interaction ble {}" +
+       "  Interaction blo {}" +
+       "  Interaction blu {}" +
+       "  Iteration iteration2 {" +
+       "    Sequence sequence3 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "  Interaction blu {}" +
+       "  Interaction blo {}" +
+       "  Interaction ble {}" +
+       "}", getTaskTree().getTaskMap());    
+  
+    // now test with iterations of iterations
+    for (int i = 0; i < 10; i++)
+    {
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction1);
+        simulateInteraction(element1, interaction2);
+        simulateInteraction(element1, interaction3);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction2);
+        simulateInteraction(element1, interaction1);
+        simulateInteraction(element1, interaction3);
+      }
+      for (int j = 0; j < 5; j++)
+      {
+        simulateInteraction(element1, interaction1);
+        simulateInteraction(element1, interaction2);
+        simulateInteraction(element1, interaction3);
+      }
+    }
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration iteration1 {" +
+       "    Sequence sequence2 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "  Interaction ble {}" +
+       "  Interaction blo {}" +
+       "  Interaction blu {}" +
+       "  Iteration iteration2 {" +
+       "    Sequence sequence3 {" +
+       "      Interaction bla {}" +
+       "      Interaction bli {}" +
+       "      Interaction blup {}" +
+       "    }" +
+       "  }" +
+       "  Interaction blu {}" +
+       "  Interaction blo {}" +
+       "  Interaction ble {}" +
+       "  Iteration iteration3 {" +
+       "    Sequence sequence4 {" +
+       "      Iteration iteration4 {" +
+       "        Sequence sequence4 {" +
+       "          Interaction bla {}" +
+       "          Interaction bli {}" +
+       "          Interaction blup {}" +
+       "        }" +
+       "      }" +
+       "      Iteration iteration5 {" +
+       "        Sequence sequence5 {" +
+       "          Interaction bli {}" +
+       "          Interaction bla {}" +
+       "          Interaction blup {}" +
+       "        }" +
+       "      }" +
+       "      Iteration iteration6 {" +
+       "        Sequence sequence6 {" +
+       "          Interaction bla {}" +
+       "          Interaction bli {}" +
+       "          Interaction blup {}" +
+       "        }" +
+       "      }" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+  }
+  
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultMouseClickReductionRuleTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultMouseClickReductionRuleTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultMouseClickReductionRuleTest.java	(revision 445)
@@ -0,0 +1,174 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TaskTreeManagerTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: Patrick $  $Date: 08.11.2011 21:32:36 $
+// Project   : TaskTreePerformanceTest
+// Creation  : 2011 by Patrick
+// Copyright : Patrick Harms, 2011
+//-------------------------------------------------------------------------------------------------
+
+package de.ugoe.cs.quest.tasktrees.temporalrelation;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
+import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.userinteraction.MouseButtonDown;
+import de.ugoe.cs.tasktree.userinteraction.MouseButtonInteraction;
+import de.ugoe.cs.tasktree.userinteraction.MouseButtonUp;
+import de.ugoe.cs.tasktree.userinteraction.MouseClick;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ *
+ * @version $Revision: $ $Date: $
+ * @author  2011, last modified by $Author: $
+ */
+//-------------------------------------------------------------------------------------------------
+public class DefaultMouseClickReductionRuleTest extends AbstractTemporalRelationshipTC
+{
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testMouseClickInOneSequenceElement()
+  {
+    MouseButtonInteraction.Button leftBtn = MouseButtonInteraction.Button.LEFT;
+    MouseButtonInteraction.Button middleBtn = MouseButtonInteraction.Button.MIDDLE;
+    MouseButtonInteraction.Button rightBtn = MouseButtonInteraction.Button.RIGHT;
+    
+    GUIElement element1 = new DummyGUIElement("elem1");
+    GUIElement element2 = new DummyGUIElement("elem1");
+    
+    simulateInteraction(element1, new MouseButtonDown(leftBtn));
+    simulateInteraction(element1, new MouseButtonUp(leftBtn));
+    simulateInteraction(element1, new MouseClick(leftBtn));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence {" +
+       "  Interaction LeftMouseClick {}" +
+       "}", getTaskTree().getTaskMap());
+    
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element1, new DummyInteraction("bli", 1));
+    simulateInteraction(element1, new MouseButtonDown(middleBtn));
+    simulateInteraction(element1, new MouseButtonUp(middleBtn));
+    simulateInteraction(element1, new MouseClick(middleBtn));
+    simulateInteraction(element1, new DummyInteraction("blo", 1));
+    simulateInteraction(element1, new DummyInteraction("blu", 1));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence {" +
+       "  Interaction LeftMouseClick {}" +
+       "  Interaction bla {}" +
+       "  Interaction bli {}" +
+       "  Interaction MiddleMouseClick {}" +
+       "  Interaction blo {}" +
+       "  Interaction blu {}" +
+       "}", getTaskTree().getTaskMap());
+
+    simulateInteraction(element2, new DummyInteraction("bla", 1));
+    simulateInteraction(element2, new DummyInteraction("bli", 1));
+    simulateInteraction(element2, new MouseButtonDown(rightBtn));
+    simulateInteraction(element2, new MouseButtonUp(rightBtn));
+    simulateInteraction(element2, new MouseClick(rightBtn));
+    simulateInteraction(element2, new DummyInteraction("blo", 1));
+    simulateInteraction(element2, new DummyInteraction("blu", 1));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction LeftMouseClick {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction MiddleMouseClick {}" +
+       "    Interaction blo {}" +
+       "    Interaction blu {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction RightMouseClick {}" +
+       "    Interaction blo {}" +
+       "    Interaction blu {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());
+
+    simulateInteraction(element1, new MouseButtonDown(leftBtn));
+    simulateInteraction(element1, new MouseButtonUp(leftBtn));
+    simulateInteraction(element2, new MouseClick(leftBtn));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction LeftMouseClick {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction MiddleMouseClick {}" +
+       "    Interaction blo {}" +
+       "    Interaction blu {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction RightMouseClick {}" +
+       "    Interaction blo {}" +
+       "    Interaction blu {}" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    Interaction LeftMouseButtonDown {}" +
+       "    Interaction LeftMouseButtonUp {}" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    Interaction LeftMouseClick {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());
+
+    simulateInteraction(element1, new MouseButtonDown(middleBtn));
+    simulateInteraction(element1, new MouseButtonUp(middleBtn));
+    simulateInteraction(element1, new MouseClick(rightBtn));
+    simulateInteraction(element2, new DummyInteraction("bla", 1));
+
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    Interaction LeftMouseClick {}" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction MiddleMouseClick {}" +
+       "    Interaction blo {}" +
+       "    Interaction blu {}" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    Interaction bla {}" +
+       "    Interaction bli {}" +
+       "    Interaction RightMouseClick {}" +
+       "    Interaction blo {}" +
+       "    Interaction blu {}" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    Interaction LeftMouseButtonDown {}" +
+       "    Interaction LeftMouseButtonUp {}" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    Interaction LeftMouseClick {}" +
+       "  }" +
+       "  Sequence sequence5 {" +
+       "    Sequence sequence6 {" +
+       "      Interaction MiddleMouseButtonDown {}" +
+       "      Interaction MiddleMouseButtonUp {}" +
+       "    }" +
+       "    Interaction RightMouseClick {}" +
+       "  }" +
+       "  Sequence sequence7 {" +
+       "    Interaction bla {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());
+
+  }
+  
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultTextInputReductionRuleTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultTextInputReductionRuleTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/DefaultTextInputReductionRuleTest.java	(revision 445)
@@ -0,0 +1,411 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: DefaultIterationDetectionRuleTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 28.04.2012 $
+// Project   : TaskTreeTemporalRelationship
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.temporalrelation;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.guimodel.TextField;
+import de.ugoe.cs.tasktree.keyboardmaps.VirtualKey;
+import de.ugoe.cs.tasktree.userinteraction.KeyPressed;
+import de.ugoe.cs.tasktree.userinteraction.KeyReleased;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 28.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class DefaultTextInputReductionRuleTest extends AbstractTemporalRelationshipTC
+{
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testSimpleTextEntry()
+  {
+    GUIElement element1 = new DummyTextField("elem1");
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_A));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_A));
+    new TaskTreeChecker(true).assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput a {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_B));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_B));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput ab {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "    Interaction KeyPressed LETTER_B {}" +
+       "    Interaction KeyReleased LETTER_B {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_C));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_C));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput abC {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "    Interaction KeyPressed LETTER_B {}" +
+       "    Interaction KeyReleased LETTER_B {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed LETTER_C {}" +
+       "    Interaction KeyReleased LETTER_C {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_D));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_D));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_E));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_E));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_F));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_F));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput abCDEF {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "    Interaction KeyPressed LETTER_B {}" +
+       "    Interaction KeyReleased LETTER_B {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed LETTER_C {}" +
+       "    Interaction KeyReleased LETTER_C {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed LETTER_D {}" +
+       "    Interaction KeyReleased LETTER_D {}" +
+       "    Interaction KeyPressed LETTER_E {}" +
+       "    Interaction KeyReleased LETTER_E {}" +
+       "    Interaction KeyPressed LETTER_F {}" +
+       "    Interaction KeyReleased LETTER_F {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_G));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_G));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput abCDEFg {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "    Interaction KeyPressed LETTER_B {}" +
+       "    Interaction KeyReleased LETTER_B {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed LETTER_C {}" +
+       "    Interaction KeyReleased LETTER_C {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed LETTER_D {}" +
+       "    Interaction KeyReleased LETTER_D {}" +
+       "    Interaction KeyPressed LETTER_E {}" +
+       "    Interaction KeyReleased LETTER_E {}" +
+       "    Interaction KeyPressed LETTER_F {}" +
+       "    Interaction KeyReleased LETTER_F {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed SHIFT {}" +
+       "    Interaction KeyPressed LETTER_G {}" +
+       "    Interaction KeyReleased LETTER_G {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "    Interaction KeyReleased SHIFT {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testTextEntryOnDifferentGuiElements()
+  {
+    GUIElement element1 = new DummyTextField("elem1");
+    GUIElement element2 = new DummyTextField("elem2");
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_A));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_A));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput a {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element2, new KeyPressed(VirtualKey.LETTER_B));
+    simulateInteraction(element2, new KeyReleased(VirtualKey.LETTER_B));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    TextInputInteraction TextInput a {" +
+       "      Interaction KeyPressed LETTER_A {}" +
+       "      Interaction KeyReleased LETTER_A {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    TextInputInteraction TextInput b {" +
+       "      Interaction KeyPressed LETTER_B {}" +
+       "      Interaction KeyReleased LETTER_B {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_C));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_C));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    TextInputInteraction TextInput a {" +
+       "      Interaction KeyPressed LETTER_A {}" +
+       "      Interaction KeyReleased LETTER_A {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    TextInputInteraction TextInput b {" +
+       "      Interaction KeyPressed LETTER_B {}" +
+       "      Interaction KeyReleased LETTER_B {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    TextInputInteraction TextInput C {" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed LETTER_C {}" +
+       "      Interaction KeyReleased LETTER_C {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element2, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element2, new KeyPressed(VirtualKey.LETTER_D));
+    simulateInteraction(element2, new KeyReleased(VirtualKey.LETTER_D));
+    simulateInteraction(element2, new KeyPressed(VirtualKey.LETTER_E));
+    simulateInteraction(element2, new KeyReleased(VirtualKey.LETTER_E));
+    simulateInteraction(element2, new KeyPressed(VirtualKey.LETTER_F));
+    simulateInteraction(element2, new KeyReleased(VirtualKey.LETTER_F));
+    simulateInteraction(element2, new KeyReleased(VirtualKey.SHIFT));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    TextInputInteraction TextInput a {" +
+       "      Interaction KeyPressed LETTER_A {}" +
+       "      Interaction KeyReleased LETTER_A {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    TextInputInteraction TextInput b {" +
+       "      Interaction KeyPressed LETTER_B {}" +
+       "      Interaction KeyReleased LETTER_B {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    TextInputInteraction TextInput C {" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed LETTER_C {}" +
+       "      Interaction KeyReleased LETTER_C {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    TextInputInteraction TextInput DEF {" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed LETTER_D {}" +
+       "      Interaction KeyReleased LETTER_D {}" +
+       "      Interaction KeyPressed LETTER_E {}" +
+       "      Interaction KeyReleased LETTER_E {}" +
+       "      Interaction KeyPressed LETTER_F {}" +
+       "      Interaction KeyReleased LETTER_F {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_G));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_G));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.SHIFT));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  Sequence sequence1 {" +
+       "    TextInputInteraction TextInput a {" +
+       "      Interaction KeyPressed LETTER_A {}" +
+       "      Interaction KeyReleased LETTER_A {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence2 {" +
+       "    TextInputInteraction TextInput b {" +
+       "      Interaction KeyPressed LETTER_B {}" +
+       "      Interaction KeyReleased LETTER_B {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence3 {" +
+       "    TextInputInteraction TextInput C {" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed LETTER_C {}" +
+       "      Interaction KeyReleased LETTER_C {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence4 {" +
+       "    TextInputInteraction TextInput DEF {" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed LETTER_D {}" +
+       "      Interaction KeyReleased LETTER_D {}" +
+       "      Interaction KeyPressed LETTER_E {}" +
+       "      Interaction KeyReleased LETTER_E {}" +
+       "      Interaction KeyPressed LETTER_F {}" +
+       "      Interaction KeyReleased LETTER_F {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "    }" +
+       "  }" +
+       "  Sequence sequence5 {" +
+       "    TextInputInteraction TextInput g {" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed SHIFT {}" +
+       "      Interaction KeyPressed LETTER_G {}" +
+       "      Interaction KeyReleased LETTER_G {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "      Interaction KeyReleased SHIFT {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testUsageOfBackspace()
+  {
+    GUIElement element1 = new DummyTextField("elem1");
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_A));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_A));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_B));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_B));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_C));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_C));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_D));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_D));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_E));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_E));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.LETTER_F));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.LETTER_F));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput abcef {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "    Interaction KeyPressed LETTER_B {}" +
+       "    Interaction KeyReleased LETTER_B {}" +
+       "    Interaction KeyPressed LETTER_C {}" +
+       "    Interaction KeyReleased LETTER_C {}" +
+       "    Interaction KeyPressed LETTER_D {}" +
+       "    Interaction KeyReleased LETTER_D {}" +
+       "    Interaction KeyPressed BACK_SPACE {}" +
+       "    Interaction KeyReleased BACK_SPACE {}" +
+       "    Interaction KeyPressed LETTER_E {}" +
+       "    Interaction KeyReleased LETTER_E {}" +
+       "    Interaction KeyPressed LETTER_F {}" +
+       "    Interaction KeyReleased LETTER_F {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new KeyPressed(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyPressed(VirtualKey.BACK_SPACE));
+    simulateInteraction(element1, new KeyReleased(VirtualKey.BACK_SPACE));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence0 {" +
+       "  TextInputInteraction TextInput ab {" +
+       "    Interaction KeyPressed LETTER_A {}" +
+       "    Interaction KeyReleased LETTER_A {}" +
+       "    Interaction KeyPressed LETTER_B {}" +
+       "    Interaction KeyReleased LETTER_B {}" +
+       "    Interaction KeyPressed LETTER_C {}" +
+       "    Interaction KeyReleased LETTER_C {}" +
+       "    Interaction KeyPressed LETTER_D {}" +
+       "    Interaction KeyReleased LETTER_D {}" +
+       "    Interaction KeyPressed BACK_SPACE {}" +
+       "    Interaction KeyReleased BACK_SPACE {}" +
+       "    Interaction KeyPressed LETTER_E {}" +
+       "    Interaction KeyReleased LETTER_E {}" +
+       "    Interaction KeyPressed LETTER_F {}" +
+       "    Interaction KeyReleased LETTER_F {}" +
+       "    Interaction KeyPressed BACK_SPACE {}" +
+       "    Interaction KeyReleased BACK_SPACE {}" +
+       "    Interaction KeyPressed BACK_SPACE {}" +
+       "    Interaction KeyReleased BACK_SPACE {}" +
+       "    Interaction KeyPressed BACK_SPACE {}" +
+       "    Interaction KeyReleased BACK_SPACE {}" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  private static class DummyTextField extends DummyGUIElement implements TextField
+  {
+
+    //---------------------------------------------------------------------------------------------
+    /**
+     * TODO: comment
+     *
+     * @param name
+     */
+    //---------------------------------------------------------------------------------------------
+    public DummyTextField(String name)
+    {
+      super(name);
+    }
+
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/TrackBarSelectionDetectionRuleTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/TrackBarSelectionDetectionRuleTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/TrackBarSelectionDetectionRuleTest.java	(revision 445)
@@ -0,0 +1,180 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: DefaultIterationDetectionRuleTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 28.04.2012 $
+// Project   : TaskTreeTemporalRelationship
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.temporalrelation;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
+import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+import de.ugoe.cs.tasktree.guimodel.TrackBar;
+import de.ugoe.cs.tasktree.userinteraction.ValueSelection;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 28.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class TrackBarSelectionDetectionRuleTest extends AbstractTemporalRelationshipTC
+{
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testSimpleDetection() throws Exception
+  {
+    GUIElement element1 = new DummyTrackBar();
+    simulateInteraction(element1, new ValueSelection<Integer>(1));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration interation1 {" +
+       "    Selection selection1 {" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new ValueSelection<Integer>(2));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration interation1 {" +
+       "    Selection selection1 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new ValueSelection<Integer>(3));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration interation1 {" +
+       "    Selection selection1 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new ValueSelection<Integer>(2));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration interation1 {" +
+       "    Selection selection1 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+
+    simulateInteraction(element1, new ValueSelection<Integer>(3));
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration interation1 {" +
+       "    Selection selection1 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());
+
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testComplexDetection() throws Exception
+  {
+    GUIElement element1 = new DummyTrackBar();
+    simulateInteraction(element1, new ValueSelection<Integer>(1));
+    simulateInteraction(element1, new ValueSelection<Integer>(2));
+    simulateInteraction(element1, new ValueSelection<Integer>(3));
+    simulateInteraction(element1, new ValueSelection<Integer>(1));
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element1, new DummyInteraction("bla", 2));
+    simulateInteraction(element1, new ValueSelection<Integer>(2));
+    simulateInteraction(element1, new ValueSelection<Integer>(1));
+    simulateInteraction(element1, new DummyInteraction("bla", 3));
+    simulateInteraction(element1, new ValueSelection<Integer>(3));
+    simulateInteraction(element1, new ValueSelection<Integer>(2));
+    simulateInteraction(element1, new ValueSelection<Integer>(3));
+    simulateInteraction(element1, new DummyInteraction("bla", 1));
+    simulateInteraction(element1, new DummyInteraction("bla", 2));
+    simulateInteraction(element1, new ValueSelection<Integer>(1));
+    simulateInteraction(element1, new ValueSelection<Integer>(1));
+    
+    new TaskTreeChecker().assertTaskMap
+      ("Sequence sequence1 {" +
+       "  Iteration interation1 {" +
+       "    Selection selection1 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "  Interaction bla {}" +
+       "  Interaction bla {}" +
+       "  Iteration interation2 {" +
+       "    Selection selection2 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "  Interaction bla {}" +
+       "  Iteration interation3 {" +
+       "    Selection selection3 {" +
+       "      Interaction ValueSelection {}" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "  Interaction bla {}" +
+       "  Interaction bla {}" +
+       "  Iteration interation4 {" +
+       "    Selection selection4 {" +
+       "      Interaction ValueSelection {}" +
+       "    }" +
+       "  }" +
+       "}", getTaskTree().getTaskMap());    
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO comment
+   * 
+   * @version $Revision: $ $Date: 28.04.2012$
+   * @author 2012, last modified by $Author: patrick$
+   */
+  //-----------------------------------------------------------------------------------------------
+  public class DummyTrackBar extends DummyGUIElement implements TrackBar
+  {
+
+    //---------------------------------------------------------------------------------------------
+    /**
+     *
+     */
+    //---------------------------------------------------------------------------------------------
+    public DummyTrackBar()
+    {
+      super("DummyTrackBar");
+    }
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyGUIElement.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyGUIElement.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyGUIElement.java	(revision 445)
@@ -0,0 +1,59 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: DummyGUIElement.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 02.04.2012 $
+// Project   : TaskTreeTestUtils
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.testutils;
+
+import de.ugoe.cs.tasktree.guimodel.AbstractDefaultGUIElement;
+import de.ugoe.cs.tasktree.guimodel.GUIElement;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 02.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class DummyGUIElement extends AbstractDefaultGUIElement
+  implements GUIElement
+{
+  /** */
+  private String mName;
+
+  //---------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //---------------------------------------------------------------------------------------------
+  public DummyGUIElement(String name)
+  {
+    super();
+    mName = name;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /* (non-Javadoc)
+   * @see java.lang.Object#toString()
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Override
+  public String toString()
+  {
+    return mName;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /* (non-Javadoc)
+   * @see de.harms.attef.userinteraction.GUIElement#equals(GUIElement)
+   */
+  //-----------------------------------------------------------------------------------------------
+  public boolean equals(GUIElement other)
+  {
+    return this == other;
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyInteraction.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyInteraction.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyInteraction.java	(revision 445)
@@ -0,0 +1,102 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: DummyInteraction.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 02.04.2012 $
+// Project   : TaskTreeTestUtils
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.testutils;
+
+import de.ugoe.cs.tasktree.userinteraction.Interaction;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 02.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class DummyInteraction implements Interaction
+{
+  /** */
+  private int mInteractionNumber;
+  
+  /** */
+  private String mInteractionType;
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @param interactionNumber
+   * @param interactionType
+   */
+  //-----------------------------------------------------------------------------------------------
+  public DummyInteraction(String interactionType, int interactionNumber)
+  {
+    super();
+    mInteractionNumber = interactionNumber;
+    mInteractionType = interactionType;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /* (non-Javadoc)
+   * @see de.harms.attef.userinteraction.Interaction#getName()
+   */
+  //-----------------------------------------------------------------------------------------------
+  public String getName()
+  {
+    return mInteractionType;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /* (non-Javadoc)
+   * @see java.lang.Object#toString()
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Override
+  public String toString()
+  {
+    return mInteractionType;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /* (non-Javadoc)
+   * @see de.harms.attef.userinteraction.Interaction#startsLogicalSequence()
+   */
+  //-----------------------------------------------------------------------------------------------
+  public boolean startsLogicalSequence()
+  {
+    return false;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /* (non-Javadoc)
+   * @see de.harms.attef.userinteraction.Interaction#finishesLogicalSequence()
+   */
+  //-----------------------------------------------------------------------------------------------
+  public boolean finishesLogicalSequence()
+  {
+    return false;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @return the interactionType
+   */
+  //-----------------------------------------------------------------------------------------------
+  public String getInteractionType()
+  {
+    return mInteractionType;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @return the interactionNumber
+   */
+  //-----------------------------------------------------------------------------------------------
+  public int getInteractionNumber()
+  {
+    return mInteractionNumber;
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyTextField.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyTextField.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/DummyTextField.java	(revision 445)
@@ -0,0 +1,34 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: DummyGUIElement.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 02.04.2012 $
+// Project   : TaskTreeTestUtils
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.testutils;
+
+import de.ugoe.cs.tasktree.guimodel.TextField;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 02.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class DummyTextField extends DummyGUIElement
+  implements TextField
+{
+
+  //---------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //---------------------------------------------------------------------------------------------
+  public DummyTextField(String name)
+  {
+    super("text field \"" + name + "\"");
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/SimpleLogFormatter.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/SimpleLogFormatter.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/SimpleLogFormatter.java	(revision 445)
@@ -0,0 +1,89 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TestLogger.java,v $
+// Version   : $Revision: 0.0 $  $Author: Patrick $  $Date: 26.11.2011 15:26:38 $
+// Project   : TaskTreePerformanceTest
+// Creation  : 2011 by Patrick
+// Copyright : Patrick Harms, 2011
+//-------------------------------------------------------------------------------------------------
+
+package de.ugoe.cs.quest.tasktrees.testutils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.text.SimpleDateFormat;
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ *
+ * @version $Revision: $ $Date: $
+ * @author  2011, last modified by $Author: $
+ */
+//-------------------------------------------------------------------------------------------------
+
+public class SimpleLogFormatter extends Formatter
+{
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Override
+  public String format(LogRecord record)
+  {
+    StringBuffer result = new StringBuffer();
+    result.append(record.getLevel().getName().charAt(0));
+    result.append(" | ");
+    result.append(new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss,SSS").format(record.getMillis()));
+    result.append(" | ");
+    tailValue("" + record.getThreadID(), 6, result);
+    result.append(" | ");
+    tailValue(record.getLoggerName(), 30, result);
+    result.append(" | ");
+    result.append(record.getMessage());
+    
+    if (record.getThrown() != null)
+    {
+      ByteArrayOutputStream out = new ByteArrayOutputStream();
+      record.getThrown().printStackTrace(new PrintStream(out));
+      result.append("\n");
+      result.append(out.toString());
+      try
+      {
+        out.close();
+      }
+      catch (IOException e)
+      {
+        // ignore
+      }
+    }
+    
+    result.append("\n");
+    
+    return result.toString();
+  }
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void tailValue(String value, int length, StringBuffer output)
+  {
+    for (int i = value.length() - length - 1; i < value.length(); i++)
+    {
+      if (i < 0)
+      {
+        output.append(" ");
+      }
+      else
+      {
+        output.append(value.charAt(i));
+      }
+    }
+  }
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/TaskTreeChecker.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/TaskTreeChecker.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/TaskTreeChecker.java	(revision 445)
@@ -0,0 +1,573 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TaskTreeChecker.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 01.04.2012 $
+// Project   : TestUtils
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.testutils;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import de.ugoe.cs.quest.tasktrees.treeifc.InteractionTask;
+import de.ugoe.cs.quest.tasktrees.treeifc.Iteration;
+import de.ugoe.cs.quest.tasktrees.treeifc.NodeInfo;
+import de.ugoe.cs.quest.tasktrees.treeifc.Selection;
+import de.ugoe.cs.quest.tasktrees.treeifc.Sequence;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTree;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNode;
+import de.ugoe.cs.quest.tasktrees.treeifc.TextInputInteractionTask;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 01.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class TaskTreeChecker
+{
+  /** */
+  private boolean mDoTrace;
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  public TaskTreeChecker()
+  {
+    this(false);
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  public TaskTreeChecker(boolean doTrace)
+  {
+    mDoTrace = doTrace;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  public void assertTaskMap(String taskTreeSpec, Map<TaskTreeNode, NodeInfo> taskMap)
+  {
+    Map<TaskTreeNode, Integer> taskMapCopy = new HashMap<TaskTreeNode, Integer>();
+    
+    for (Map.Entry<TaskTreeNode, NodeInfo> entry : taskMap.entrySet())
+    {
+      if (entry.getValue().getNoOfOccurencesInTree() > 0)
+      {
+        taskMapCopy.put(entry.getKey(), entry.getValue().getNoOfOccurencesInTree());
+      }
+      else
+      {
+        taskMapCopy.put(entry.getKey(), 1);
+      }
+    }
+    
+    if (mDoTrace)
+    {
+      dumpTaskMap(taskMapCopy);
+    }
+
+    TaskSpec task = null;
+
+    Matcher matcher =
+      Pattern.compile("(\\s*(\\w+)\\s+(\\w+)\\s+((\\w*\\s)*)(\\{))|((\\}))").matcher(taskTreeSpec);
+    
+    do
+    {
+      if (!matcher.find())
+      {
+        if (!matcher.hitEnd())
+        {
+          throw new IllegalArgumentException("could not parse task specification");
+        }
+        else
+        {
+          break;
+        }
+      }
+      
+      task = parseTask(matcher);
+      if (task != null)
+      {
+        assertTaskAndChildrenInMapAndRemove(task, taskMapCopy);
+      }
+    }
+    while (task != null);
+    
+    assertTrue("more tasks in map, than expected", taskMapCopy.isEmpty());
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param taskTree
+   */
+  //-----------------------------------------------------------------------------------------------
+  public void dumpAsCheckString(TaskTree taskTree)
+  {
+    dumpNodeAsCheckString(taskTree.getRoot(), new int[4], "");
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param root
+   * @param string
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void dumpNodeAsCheckString(TaskTreeNode node,
+                                     int[]        typeCounters,
+                                     String       indent)
+  {
+    System.err.print("       \"");
+    System.err.print(indent);
+    
+    if (node instanceof Sequence)
+    {
+      System.err.print("Sequence sequence");
+      System.err.print(typeCounters[0]++);
+      System.err.println(" {\" +");
+    }
+    else if (node instanceof Iteration)
+    {
+      System.err.print("Iteration iteration");
+      System.err.print(typeCounters[1]++);
+      System.err.println(" {\" +");
+    }
+    else if (node instanceof Selection)
+    {
+      System.err.print("Selection selection");
+      System.err.print(typeCounters[2]++);
+      System.err.println(" {\" +");
+    }
+    else if (node instanceof TextInputInteractionTask)
+    {
+      System.err.print("TextInputInteraction textInput");
+      System.err.print(typeCounters[3]++);
+      System.err.print(" ");
+      System.err.print(((TextInputInteractionTask) node).getEnteredText());
+      System.err.println(" {\" +");
+    }
+    else if (node instanceof InteractionTask)
+    {
+      System.err.print("Interaction ");
+      System.err.print(((InteractionTask) node).getInteraction().getName());
+      System.err.print(" {}\" +");
+    }
+    else
+    {
+      fail("unknown type of node in task tree " + node);
+    }
+    
+    for (TaskTreeNode child : node.getChildren())
+    {
+      dumpNodeAsCheckString(child, typeCounters, indent + "  ");
+    }
+    
+    if (!(node instanceof InteractionTask) ||
+        (node instanceof TextInputInteractionTask))
+    {
+      System.err.print("       \"");
+      System.err.print(indent);
+      System.err.print("}\" +");
+    }
+    
+    System.err.println();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param taskTree
+   */
+  //-----------------------------------------------------------------------------------------------
+  public void dumpFullTaskTree(TaskTree taskTree) throws FileNotFoundException
+  {
+    PrintWriter out = null;
+    try
+    {
+      out = new PrintWriter(new FileOutputStream("taskTree.txt"));
+      dumpFullNode(taskTree.getRoot(), out, "");
+    }
+    finally
+    {
+      if (out != null)
+      {
+        out.close();
+      }
+    }
+    
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void dumpFullNode(TaskTreeNode node, PrintWriter out, String indent)
+  {
+    out.print(indent);
+    if (node instanceof Sequence)
+    {
+      out.println("Sequence");
+      out.print(indent);
+      out.println("{");
+    }
+    else if (node instanceof Iteration)
+    {
+      out.println("Iteration");
+      out.print(indent);
+      out.println("{");
+    }
+    else if (node instanceof Selection)
+    {
+      out.println("Selection");
+      out.print(indent);
+      out.println("{");
+    }
+    else if (node instanceof TextInputInteractionTask)
+    {
+      out.print("TextInputInteraction");
+      out.print(" ");
+      out.println(((TextInputInteractionTask) node).getEnteredText());
+      out.print(indent);
+      out.println("{");
+    }
+    else if (node instanceof InteractionTask)
+    {
+      out.print(((InteractionTask) node).getInteraction().getName());
+      out.print(" ");
+      out.print(((InteractionTask) node).getGUIElement());
+      out.print(" ");
+      out.print(((InteractionTask) node).getGUIElement().getOriginalTypeInfo());
+    }
+    else
+    {
+      fail("unknown type of node in task tree " + node);
+    }
+    
+    for (TaskTreeNode child : node.getChildren())
+    {
+      dumpFullNode(child, out, indent + "  ");
+    }
+    
+    if (!(node instanceof InteractionTask) ||
+        (node instanceof TextInputInteractionTask))
+    {
+      out.print(indent);
+      out.print("}");
+    }
+    
+    out.println();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * 
+   */
+  //-----------------------------------------------------------------------------------------------
+  private TaskSpec parseTask(Matcher tokenMatcher)
+  {
+    String firstToken = tokenMatcher.group();
+    
+    if ("}".equals(firstToken))
+    {
+      throw new IllegalArgumentException("found a closing bracket at an unexpected place");
+    }
+    
+    TaskSpec task = new TaskSpec();
+    task.type = tokenMatcher.group(2);
+    task.interactionName = tokenMatcher.group(3);
+    task.additionalInfo = tokenMatcher.group(4).trim();
+    
+    if ("".equals(task.interactionName))
+    {
+      task.interactionName = null;
+    }
+    
+    if (!tokenMatcher.find())
+    {
+      throw new IllegalArgumentException("could not parse task specification");
+    }
+    
+    firstToken = tokenMatcher.group();
+    
+    if (!"}".equals(firstToken))
+    {
+      ArrayList<TaskSpec> children = new ArrayList<TaskSpec>();
+    
+      TaskSpec child = null;
+    
+      do
+      {
+        child = parseTask(tokenMatcher);
+        
+        if (child != null)
+        {
+          children.add(child);
+          
+          if (!tokenMatcher.find())
+          {
+            throw new IllegalArgumentException("could not parse task specification");
+          }
+          
+          firstToken = tokenMatcher.group();
+          
+          if ("}".equals(firstToken))
+          {
+            break;
+          }
+        }
+        
+      }
+      while (child != null);
+      
+      task.children = children.toArray(new TaskSpec[children.size()]);
+    }
+    
+    return task;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @param task
+   * @param taskMapCopy
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void assertTaskAndChildrenInMapAndRemove(TaskSpec                   task,
+                                                   Map<TaskTreeNode, Integer> taskMap)
+  {
+    for (Map.Entry<TaskTreeNode, Integer> entry : taskMap.entrySet())
+    {
+      if (taskSpecEqualsTask(task, entry.getKey()))
+      {
+        if (task.children != null)
+        {
+          for (TaskSpec child : task.children)
+          {
+            assertTaskAndChildrenInMapAndRemove(child, taskMap);
+          }
+        }
+        
+        int count = taskMap.get(entry.getKey());
+        if (count == 1)
+        {
+          taskMap.remove(entry.getKey());
+        }
+        else
+        {
+          taskMap.put(entry.getKey(), count - 1);
+        }
+        return;
+      }
+    }
+    
+    fail("expected task " + task.type + " " + task.interactionName + " not included in task map");
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  private boolean taskSpecEqualsTask(TaskSpec taskSpec, TaskTreeNode task)
+  {
+    if (mDoTrace)
+    {
+      System.err.println("comparing " + taskSpec.interactionName + " with");
+      dumpTask(task, 0, "");
+    }
+    
+    if (("Interaction".equals(taskSpec.type) && (!(task instanceof InteractionTask))) ||
+        ("TextInputInteraction".equals(taskSpec.type) &&
+            (!(task instanceof TextInputInteractionTask))) ||
+        ("Sequence".equals(taskSpec.type) && (!(task instanceof Sequence))) ||
+        ("Selection".equals(taskSpec.type) && (!(task instanceof Selection))) ||
+        ("Iteration".equals(taskSpec.type) && (!(task instanceof Iteration))))
+    {
+      if (mDoTrace)
+      {
+        System.err.println("task types do not match: " + taskSpec.type + " != " +
+                           task.getClass().getSimpleName() + "\n");
+      }
+      return false;
+    }
+    else if (!"Interaction".equals(taskSpec.type) &&
+             !"TextInputInteraction".equals(taskSpec.type) &&
+             !"Sequence".equals(taskSpec.type) &&
+             !"Selection".equals(taskSpec.type) &&
+             !"Iteration".equals(taskSpec.type))
+    {
+      fail("unknown task type " + taskSpec.type + " --> please extend test case");
+    }
+    
+    if ("TextInputInteraction".equals(taskSpec.type))
+    {
+      if (!"".equals(taskSpec.additionalInfo) &&
+          !(taskSpec.additionalInfo.equals(((TextInputInteractionTask) task).getEnteredText())))
+      {
+        if (mDoTrace)
+        {
+          System.err.println
+            ("expected text \"" + taskSpec.additionalInfo + "\" is not equal to the text " +
+             "provided by the task \"" + ((TextInputInteractionTask) task).getEnteredText() +
+             "\"\n");
+        }
+        return false;
+      }
+    }
+    else if ((task instanceof InteractionTask) &&
+        (((InteractionTask) task).getInteraction() != null) &&
+        (!taskSpec.interactionName.equals(((InteractionTask) task).getInteraction().getName())))
+    {
+      // simple interaction names do not match. But what about the interaction name in combination
+      // with the additional info
+      String complexInteractionName = taskSpec.interactionName +
+        (!"".equals(taskSpec.additionalInfo) ? " " + taskSpec.additionalInfo : "");
+      
+      if (!complexInteractionName.equals(((InteractionTask) task).getInteraction().getName()))
+      {
+        if (mDoTrace)
+        {
+          System.err.println("interaction names do not match: " + taskSpec.interactionName +
+                             " != " + ((InteractionTask) task).getInteraction().getName() + "\n");
+        }
+        return false;
+      }
+    }
+    
+    if (((taskSpec.children == null) && (task.getChildren().size() > 0)) ||
+        ((taskSpec.children != null) && (taskSpec.children.length != task.getChildren().size())))
+    {
+      if (mDoTrace)
+      {
+        System.err.println("numbers of children do not match: " +
+                           (taskSpec.children == null ? "0" : taskSpec.children.length) + " != " +
+                           (task.getChildren() == null ? "0" : task.getChildren().size()) + "\n");
+      }
+      return false;
+    }
+    
+    Iterator<TaskTreeNode> children = task.getChildren().iterator();
+    if (taskSpec.children != null)
+    {
+      for (TaskSpec child : taskSpec.children)
+      {
+        if (!taskSpecEqualsTask(child, children.next()))
+        {
+          if (mDoTrace)
+          {
+            System.err.println("one of the children does not match\n");
+          }
+          return false;
+        }
+      }
+    }
+        
+    if (!children.hasNext())
+    {
+      if (mDoTrace)
+      {
+        System.err.println("nodes match\n");
+      }
+      return true;
+    }
+    else
+    {
+      if (mDoTrace)
+      {
+        System.err.println("number of children does not match\n");
+      }
+      return false;
+    }
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void dumpTaskMap(Map<TaskTreeNode, Integer> taskMap)
+  {
+    System.err.println();
+    for (Map.Entry<TaskTreeNode, Integer> entry : taskMap.entrySet())
+    {
+      dumpTask(entry.getKey(), entry.getValue(), "");
+      System.err.println();
+    }
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   *
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void dumpTask(TaskTreeNode task, int count, String indent)
+  {
+    System.err.print(indent);
+    System.err.print(task);
+    System.err.print(" ");
+    System.err.print(task.getDescription());
+    System.err.print(" ");
+    
+    if (count > 0)
+    {
+      System.err.print("(");
+      System.err.print(count);
+      System.err.print(" occurrences)");
+    }
+    
+    System.err.println();
+    
+    if ((task.getChildren() != null) && (task.getChildren().size() > 0))
+    {
+      for (TaskTreeNode child : task.getChildren())
+      {
+        dumpTask(child, 0, indent + "  ");
+      }
+    }
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO comment
+   *
+   * @version $Revision: $ $Date: $
+   * @author  2011, last modified by $Author: $
+   */
+  //-----------------------------------------------------------------------------------------------
+  private class TaskSpec
+  {
+    public String type;
+    public String interactionName;
+    public String additionalInfo;
+    public TaskSpec[] children;
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/Utilities.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/Utilities.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/testutils/Utilities.java	(revision 445)
@@ -0,0 +1,43 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TestUtils.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 02.04.2012 $
+// Project   : TaskTreeTestUtils
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.testutils;
+
+import de.ugoe.cs.quest.tasktrees.nodeequality.NodeEqualityRuleManager;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 02.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class Utilities
+{
+  /** */
+  private static final NodeEqualityRuleManager NODE_EQUALITY_RULE_MANAGER =
+    new NodeEqualityRuleManager();
+  
+  static
+  {
+    NODE_EQUALITY_RULE_MANAGER.init();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  public static NodeEqualityRuleManager getNodeEqualityRuleManagerForTests()
+  {
+    return NODE_EQUALITY_RULE_MANAGER;
+  }
+
+}
Index: /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/treeimpl/TaskTreeImplTest.java
===================================================================
--- /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/treeimpl/TaskTreeImplTest.java	(revision 445)
+++ /trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/treeimpl/TaskTreeImplTest.java	(revision 445)
@@ -0,0 +1,549 @@
+//-------------------------------------------------------------------------------------------------
+// Module    : $RCSfile: TaskTreeImplTest.java,v $
+// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 02.04.2012 $
+// Project   : TaskTreeImpl
+// Creation  : 2012 by patrick
+// Copyright : Patrick Harms, 2012
+//-------------------------------------------------------------------------------------------------
+package de.ugoe.cs.quest.tasktrees.treeimpl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
+import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
+import de.ugoe.cs.quest.tasktrees.treeifc.InteractionTask;
+import de.ugoe.cs.quest.tasktrees.treeifc.Iteration;
+import de.ugoe.cs.quest.tasktrees.treeifc.NodeInfo;
+import de.ugoe.cs.quest.tasktrees.treeifc.Selection;
+import de.ugoe.cs.quest.tasktrees.treeifc.Sequence;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTree;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeBuilder;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNode;
+import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNodeFactory;
+import de.ugoe.cs.quest.tasktrees.treeimpl.NodeInfoImpl;
+import de.ugoe.cs.quest.tasktrees.treeimpl.TaskTreeBuilderImpl;
+import de.ugoe.cs.quest.tasktrees.treeimpl.TaskTreeNodeFactoryImpl;
+
+//-------------------------------------------------------------------------------------------------
+/**
+ * TODO comment
+ * 
+ * @version $Revision: $ $Date: 02.04.2012$
+ * @author 2012, last modified by $Author: patrick$
+ */
+//-------------------------------------------------------------------------------------------------
+public class TaskTreeImplTest
+{
+  /** */
+  private static final int MAX_TREE_DEPTH = 15;
+  
+  /** */
+  private TaskTreeBuilder mTaskTreeBuilder = new TaskTreeBuilderImpl();
+  
+  /** */
+  private TaskTreeNodeFactory mTaskTreeNodeFactory = new TaskTreeNodeFactoryImpl();
+  
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * @throws Exception 
+   * 
+   */
+  //-----------------------------------------------------------------------------------------------
+  @Test
+  public void testRandomTrees() throws Exception
+  {
+    int noOfTrees = 10;
+    int noOfMaxChildren = 8;
+    int maxDepth = MAX_TREE_DEPTH;
+    
+    for (int i = 0; i < noOfTrees; i++)
+    {
+      System.err.println("iteration " + (i + 1) + ":");
+      System.err.println("  creating tree");
+      Map<TaskTreeNode, NodeInfo> treeInfos = new HashMap<TaskTreeNode, NodeInfo>();
+      TaskTreeNode rootNode = createTree(noOfMaxChildren, maxDepth, treeInfos);
+      System.err.println("  creating task tree");
+      TaskTree taskTree = mTaskTreeNodeFactory.createTaskTree(rootNode);
+      
+      System.err.println("  validating task tree");
+      assertEquals(rootNode, taskTree.getRoot());
+      assertMapsEqual(treeInfos, taskTree.getTaskMap());
+    }
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @param taskMap
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void assertMapsEqual(Map<TaskTreeNode, NodeInfo> map1,
+                               Map<TaskTreeNode, NodeInfo> map2)
+  {
+    try
+    {
+      if (map1 == null)
+      {
+        assertNull(map2);
+        return;
+      }
+      
+      assertEquals(map1.size(), map2.size());
+      
+      for (Map.Entry<TaskTreeNode, NodeInfo> entry : map1.entrySet())
+      {
+        NodeInfo value2 = map2.get(entry.getKey());
+        assertNotNull(value2);
+        assertEquals(entry.getValue().getTask(), value2.getTask());
+        assertEquals(entry.getValue().getNoOfOccurencesInTree(), value2.getNoOfOccurencesInTree());
+      }
+    }
+    catch (AssertionError e)
+    {
+      dumpMap(map1);
+      dumpMap(map2);
+      throw e;
+    }
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param map2
+   */
+  //-----------------------------------------------------------------------------------------------
+  private void dumpMap(Map<TaskTreeNode, NodeInfo> map)
+  {
+    System.err.println();
+    
+    if (map == null)
+    {
+      System.err.println("map is null");
+    }
+    else
+    {
+      System.err.println("map:");
+      for (Map.Entry<TaskTreeNode, NodeInfo> entry : map.entrySet())
+      {
+        System.err.print("  ");
+        System.err.print(entry.getKey());
+        for (int i = entry.getKey().toString().length(); i < 49; i++)
+        {
+          System.err.print(" ");
+        }
+        System.err.print(" : ");
+        System.err.println(entry.getValue());
+      }
+    }
+    
+    System.err.println();
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param noOfMaxChildren
+   * @param maxDepth
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private TaskTreeNode createTree(int                         maxNoOfChildren,
+                                  int                         maxDepth,
+                                  Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    /*for (int i = 0; i < (MAX_TREE_DEPTH + 1 - maxDepth); i++)
+    {
+      System.err.print("  ");
+    }*/
+    
+    TaskTreeNode tree;
+    
+    // integrating the maximum depth here assures, that either something between 0 and 8 will
+    // be the type, or if the max depth decreases near 0 only interaction tasks will be created
+    // to finish the tree creation
+    int type = (int) (Math.random() * (Math.min(8, maxDepth)));
+    
+    switch (type)
+    {
+      case 0:
+      {
+        //System.err.print("creating new interaction task ");
+        tree = createNewInteractionTask(treeInfos);
+        break;
+      }
+      case 1:
+      {
+        //System.err.print("reusing interaction task ");
+        tree = reuseInteractionTask(treeInfos);
+        break;
+      }
+      case 2:
+      {
+        //System.err.println("creating new sequence {");
+        tree = createNewSequence(maxNoOfChildren, maxDepth, treeInfos);
+        break;
+      }
+      case 3:
+      {
+        //System.err.println("reusing sequence {");
+        tree = reuseSequence(maxNoOfChildren, maxDepth, treeInfos);
+        break;
+      }
+      case 4:
+      {
+        //System.err.println("creating new selection {");
+        tree = createNewSelection(maxNoOfChildren, maxDepth, treeInfos);
+        break;
+      }
+      case 5:
+      {
+        //System.err.println("reusing selection {");
+        tree = reuseSelection(maxNoOfChildren, maxDepth, treeInfos);
+        break;
+      }
+      case 6:
+      {
+        //System.err.println("creating new iteration {");
+        tree = createNewIteration(maxNoOfChildren, maxDepth, treeInfos);
+        break;
+      }
+      case 7:
+      {
+        //System.err.println("reusing iteration {");
+        tree = reuseIteration(maxNoOfChildren, maxDepth, treeInfos);
+        break;
+      }
+      default:
+      {
+        //System.err.print("creating new interaction task per default ");
+        tree = createNewInteractionTask(treeInfos);
+      }
+    }
+    
+    /*
+    if (!(tree instanceof InteractionTask))
+    {
+      for (int i = 0; i < (MAX_TREE_DEPTH + 1 - maxDepth); i++)
+      {
+        System.err.print("  ");
+      }
+      
+      System.err.print("} ");
+    }
+    
+    System.err.println(tree);*/
+    
+    return tree;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private InteractionTask createNewInteractionTask(Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    Thread.sleep(2);
+    long id = System.currentTimeMillis();
+    InteractionTask task = mTaskTreeNodeFactory.createNewInteractionTask
+      (new DummyGUIElement("elem" + id), new DummyInteraction("interaction" + id, 1));
+    
+    treeInfos.put(task, new NodeInfoImpl(task));
+    
+    return task;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private InteractionTask reuseInteractionTask(Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    int noOfInteractionTasks = 0;
+    
+    for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+    {
+      if (entry.getKey() instanceof InteractionTask)
+      {
+        noOfInteractionTasks++;
+      }
+    }
+    
+    if (noOfInteractionTasks > 0)
+    {
+      noOfInteractionTasks = (int) (Math.random() * noOfInteractionTasks);
+      
+      for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+      {
+        if (entry.getKey() instanceof InteractionTask)
+        {
+          if (--noOfInteractionTasks <= 0)
+          {
+            return (InteractionTask) entry.getKey();
+          }
+        }
+      }
+    }
+    else
+    {
+      return createNewInteractionTask(treeInfos); 
+    }
+    
+    throw new RuntimeException("this is an implementation error");
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private Sequence createNewSequence(int                         maxNoOfChildren,
+                                     int                         maxDepth,
+                                     Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    Sequence sequence = mTaskTreeNodeFactory.createNewSequence();
+    
+    int noOfChildren = (int) (Math.random() * maxNoOfChildren);
+    
+    for (int i = 0; i < noOfChildren; i++)
+    {
+      TaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos);
+      
+      // through first removing an existing parent it is assured, that a parent is recorded
+      // only once. This is needed, because parent may be reused in a tree as well, but we always
+      // iterate the whole tree
+      ((NodeInfoImpl) treeInfos.get(child)).removeParent(sequence);
+      ((NodeInfoImpl) treeInfos.get(child)).addParent(sequence);
+      mTaskTreeBuilder.addChild(sequence, child);
+    }
+    
+    treeInfos.put(sequence, new NodeInfoImpl(sequence));
+    return sequence;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private Sequence reuseSequence(int                         maxNoOfChildren,
+                                 int                         maxDepth,
+                                 Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    int noOfSequences = 0;
+    
+    for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+    {
+      if (entry.getKey() instanceof Sequence)
+      {
+        noOfSequences++;
+      }
+    }
+    
+    if (noOfSequences > 0)
+    {
+      noOfSequences = (int) (Math.random() * noOfSequences);
+      
+      for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+      {
+        if (entry.getKey() instanceof Sequence)
+        {
+          if (--noOfSequences <= 0)
+          {
+            return (Sequence) entry.getKey();
+          }
+        }
+      }
+    }
+    else
+    {
+      return createNewSequence(maxNoOfChildren, maxDepth, treeInfos); 
+    }
+    
+    throw new RuntimeException("this is an implementation error");
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private Selection createNewSelection(int                         maxNoOfChildren,
+                                       int                         maxDepth,
+                                       Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    Selection selection = mTaskTreeNodeFactory.createNewSelection();
+    
+    int noOfChildren = (int) (Math.random() * maxNoOfChildren);
+    
+    for (int i = 0; i < noOfChildren; i++)
+    {
+      TaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos);
+      
+      // through first removing an existing parent it is assured, that a parent is recorded
+      // only once. This is needed, because parent may be reused in a tree as well, but we always
+      // iterate the whole tree
+      ((NodeInfoImpl) treeInfos.get(child)).removeParent(selection);
+      ((NodeInfoImpl) treeInfos.get(child)).addParent(selection);
+      mTaskTreeBuilder.addChild(selection, child);
+    }
+    
+    treeInfos.put(selection, new NodeInfoImpl(selection));
+    return selection;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private Selection reuseSelection(int                         maxNoOfChildren,
+                                   int                         maxDepth,
+                                   Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    int noOfSelections = 0;
+    
+    for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+    {
+      if (entry.getKey() instanceof Selection)
+      {
+        noOfSelections++;
+      }
+    }
+    
+    if (noOfSelections > 0)
+    {
+      noOfSelections = (int) (Math.random() * noOfSelections);
+      
+      for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+      {
+        if (entry.getKey() instanceof Selection)
+        {
+          if (--noOfSelections <= 0)
+          {
+            return (Selection) entry.getKey();
+          }
+        }
+      }
+    }
+    else
+    {
+      return createNewSelection(maxNoOfChildren, maxDepth, treeInfos); 
+    }
+    
+    throw new RuntimeException("this is an implementation error");
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private Iteration createNewIteration(int                         maxNoOfChildren,
+                                       int                         maxDepth,
+                                       Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    Iteration iteration = mTaskTreeNodeFactory.createNewIteration();
+    
+    TaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos);
+    
+    // through first removing an existing parent it is assured, that a parent is recorded
+    // only once. This is needed, because parent may be reused in a tree as well, but we always
+    // iterate the whole tree
+    ((NodeInfoImpl) treeInfos.get(child)).removeParent(iteration);
+    ((NodeInfoImpl) treeInfos.get(child)).addParent(iteration);
+    mTaskTreeBuilder.setChild(iteration, child);
+    
+    treeInfos.put(iteration, new NodeInfoImpl(iteration));
+    return iteration;
+  }
+
+  //-----------------------------------------------------------------------------------------------
+  /**
+   * TODO: comment
+   *
+   * @param treeInfos
+   * @return
+   */
+  //-----------------------------------------------------------------------------------------------
+  private Iteration reuseIteration(int                         maxNoOfChildren,
+                                   int                         maxDepth,
+                                   Map<TaskTreeNode, NodeInfo> treeInfos)
+    throws Exception
+  {
+    int noOfIterations = 0;
+    
+    for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+    {
+      if (entry.getKey() instanceof Iteration)
+      {
+        noOfIterations++;
+      }
+    }
+    
+    if (noOfIterations > 0)
+    {
+      noOfIterations = (int) (Math.random() * noOfIterations);
+      
+      for (Map.Entry<TaskTreeNode, NodeInfo> entry : treeInfos.entrySet())
+      {
+        if (entry.getKey() instanceof Iteration)
+        {
+          if (--noOfIterations <= 0)
+          {
+            return (Iteration) entry.getKey();
+          }
+        }
+      }
+    }
+    else
+    {
+      return createNewIteration(maxNoOfChildren, maxDepth, treeInfos); 
+    }
+    
+    throw new RuntimeException("this is an implementation error");
+  }
+
+}
