Index: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java
===================================================================
--- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java	(revision 987)
+++ trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java	(revision 1107)
@@ -79,19 +79,52 @@
     /**
      * <p>
-     * the temporal relationship rule known to the manager. The rules are applied in the order
-     * they occur in this list.
-     * </p>
-     */
-    private List<TemporalRelationshipRule> rules = new ArrayList<TemporalRelationshipRule>();
-
-    /**
-     * <p>
-     * initialize the manager with a node equality rule manager to be used by the known rules
-     * for task tree node comparison.
-     * </p>
-     */
-    public TemporalRelationshipRuleManager(NodeEqualityRuleManager nodeEqualityRuleManager) {
+     * the task tree node factory to be used during rule application
+     * </p>
+     */
+    private ITaskTreeNodeFactory taskTreeNodeFactory;
+
+    /**
+     * <p>
+     * the task tree builder to be used during rule application
+     * </p>
+     */
+    private ITaskTreeBuilder taskTreeBuilder;
+
+    /**
+     * <p>
+     * the temporal relationship rules known to the manager that are executed on whole sub trees.
+     * The rules are applied in the order they occur in this list.
+     * </p>
+     */
+    private TemporalRelationshipRule[] treeScopeRules;
+
+    /**
+     * <p>
+     * the temporal relationship rules known to the manager that are executed on whole sub trees.
+     * The rules are applied in the order they occur in this list.
+     * </p>
+     */
+    private TemporalRelationshipRule[] nodeScopeRules;
+
+    /**
+     * <p>
+     * initialize the manager
+     * </p>
+     * 
+     * @param nodeEqualityRuleManager the node equality rule manager to be used by the known rules
+     *                                for task tree node comparison during rule application
+     * @param taskTreeNodeFactory     the node factory to be used for instantiating new task tree
+     *                                nodes during rule application
+     * @param taskTreeBuilder         the task tree builder to be used for linking task tree nodes
+     *                                with each other during rule application
+     */
+    public TemporalRelationshipRuleManager(NodeEqualityRuleManager nodeEqualityRuleManager,
+                                           ITaskTreeNodeFactory    taskTreeNodeFactory,
+                                           ITaskTreeBuilder        taskTreeBuilder)
+    {
         super();
         this.nodeEqualityRuleManager = nodeEqualityRuleManager;
+        this.taskTreeNodeFactory = taskTreeNodeFactory;
+        this.taskTreeBuilder = taskTreeBuilder;
     }
 
@@ -107,17 +140,44 @@
         frameFilter.add(IFrame.class);
         frameFilter.add(IDialog.class);
-
-        rules.add(new DefaultGuiElementSequenceDetectionRule(frameFilter));
-        rules.add(new DefaultGuiElementSequenceDetectionRule());
-        rules.add(new DefaultEventTargetSequenceDetectionRule());
-        rules.add(new TrackBarSelectionDetectionRule(nodeEqualityRuleManager));
-        //rules.add(new DefaultGuiEventSequenceDetectionRule());
+        //frameFilter.add(ICanvas.class);
+
+        treeScopeRules = new TemporalRelationshipRule[] {
+            new DefaultTaskSequenceDetectionRule
+                (nodeEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL,
+                 taskTreeNodeFactory, taskTreeBuilder)
+        };
         
-        rules.add(new DefaultIterationDetectionRule
-                      (nodeEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL));
-        rules.add(new DefaultIterationDetectionRule
-                      (nodeEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL));
-        rules.add(new DefaultIterationDetectionRule
-                      (nodeEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL));
+        //treeScopeRules.add(new DefaultGuiElementSequenceDetectionRule(frameFilter));
+
+        nodeScopeRules = new TemporalRelationshipRule[] {
+            //new DefaultGuiElementSequenceDetectionRule(taskTreeNodeFactory, taskTreeBuilder),
+            //new DefaultEventTargetSequenceDetectionRule(taskTreeNodeFactory, taskTreeBuilder),
+            new TrackBarSelectionDetectionRule
+                (nodeEqualityRuleManager, taskTreeNodeFactory, taskTreeBuilder),
+            //new DefaultGuiEventSequenceDetectionRule(taskTreeNodeFactory, taskTreeBuilder),
+            new DefaultIterationDetectionRule
+                (nodeEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL,
+                 taskTreeNodeFactory, taskTreeBuilder),
+            new DefaultIterationDetectionRule
+                (nodeEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL,
+                 taskTreeNodeFactory, taskTreeBuilder),
+            new DefaultIterationDetectionRule
+                (nodeEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL,
+                 taskTreeNodeFactory, taskTreeBuilder)
+        };
+
+    }
+
+    /**
+     * <p>
+     * applies the known rules to the provided parent node. For the creation of further nodes,
+     * the provided builder and node factory are utilized. The method expectes, that no more data
+     * is available and, therefore, finalizes the rule application.
+     * </p>
+     * 
+     * @param nodeFactory  the node factory to be used for instantiating new task tree nodes.
+     */
+    public void applyRules(ITaskTreeNode parent) {
+        applyRules(parent, true);
     }
 
@@ -132,16 +192,9 @@
      * 
      * @param parent       the parent node to apply the rules on
-     * @param builder      the task tree builder to be used for linking task tree nodes with each
-     *                     other
-     * @param nodeFactory  the node factory to be used for instantiating new task tree nodes.
      * @param finalize     used to indicate, if the rule application shall break up if a rule would
      *                     be feasible if further data was available, or not.
      */
-    public void applyRules(ITaskTreeNode        parent,
-                           ITaskTreeBuilder     builder,
-                           ITaskTreeNodeFactory nodeFactory,
-                           boolean              finalize)
-    {
-        applyRules(parent, builder, nodeFactory, finalize, "");
+    public void applyRules(ITaskTreeNode parent, boolean finalize) {
+        applyRules(treeScopeRules, parent, finalize, "");
     }
 
@@ -157,7 +210,4 @@
      * 
      * @param parent       the parent node to apply the rules on
-     * @param builder      the task tree builder to be used for linking task tree nodes with each
-     *                     other
-     * @param nodeFactory  the node factory to be used for instantiating new task tree nodes.
      * @param finalize     used to indicate, if the rule application shall break up if a rule would
      *                     be feasible if further data was available, or not.
@@ -165,9 +215,8 @@
      *                     on the recursion depth of calling this method.
      */
-    private int applyRules(ITaskTreeNode        parent,
-                           ITaskTreeBuilder     builder,
-                           ITaskTreeNodeFactory nodeFactory,
-                           boolean              finalize,
-                           String               logIndent)
+    private int applyRules(TemporalRelationshipRule[] rules,
+                           ITaskTreeNode              parent,
+                           boolean                    finalize,
+                           String                     logIndent)
     {
         Console.traceln(Level.FINER, logIndent + "applying rules for " + parent);
@@ -179,5 +228,5 @@
             do {
                 Console.traceln(Level.FINER, logIndent + "trying rule " + rule + " on " + parent);
-                result = rule.apply(parent, builder, nodeFactory, finalize);
+                result = rule.apply(parent, finalize);
 
                 if ((result != null) &&
@@ -193,5 +242,5 @@
                     for (ITaskTreeNode newParent : result.getNewlyCreatedParentNodes()) {
                         noOfRuleApplications +=
-                            applyRules(newParent, builder, nodeFactory, true, logIndent + "  ");
+                            applyRules(nodeScopeRules, newParent, true, logIndent + "  ");
                     }
                 }
