Index: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskComparator.java
===================================================================
--- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskTreeNodeComparator.java	(revision 1129)
+++ trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskComparator.java	(revision 1146)
@@ -13,11 +13,10 @@
 //   limitations under the License.
 
-package de.ugoe.cs.autoquest.tasktrees.temporalrelation;
+package de.ugoe.cs.autoquest.tasktrees.taskequality;
 
 import java.util.HashMap;
 
-import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality;
-import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager;
-import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
 import de.ugoe.cs.autoquest.usageprofiles.SymbolComparator;
 import de.ugoe.cs.util.StopWatch;
@@ -30,53 +29,52 @@
  * @author Patrick Harms
  */
-public class TaskTreeNodeComparator implements SymbolComparator<ITaskTreeNode> {
+public class TaskComparator implements SymbolComparator<ITaskInstance> {
     
     /**
      * <p>
-     * the node equality manager needed for comparing task tree nodes with each other
+     * the task equality manager needed for comparing tasks with each other
      * </p>
      */
-    private NodeEqualityRuleManager nodeEqualityRuleManager;
+    private TaskEqualityRuleManager taskEqualityRuleManager;
 
     /**
      * <p>
-     * the minimal node equality two identified sublists need to have to consider them as equal
-     * and to create an iteration for
+     * the minimal task equality two identified sublists need to have to consider them as equal
      * </p>
      */
-    private NodeEquality minimalNodeEquality;
-
+    private TaskEquality minimalNodeEquality;
+
+    /** */
     private Comparer comparer;
 
+    /** */
     private Comparer lexicalComparer;
 
+    /** */
     private StopWatch stopWatch = new StopWatch();
     
+    /** */
     private HashMap<Long, Boolean> equalityBuffer = new HashMap<Long, Boolean>();
 
+    /** */
     private HashMap<Long, Boolean> lexicalEqualityBuffer;
 
     /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @param nodeEqualityRuleManager
-     * @param minimalNodeEquality
-     */
-    public TaskTreeNodeComparator(NodeEqualityRuleManager nodeEqualityRuleManager,
-                                  NodeEquality            minimalNodeEquality)
+     *
+     */
+    public TaskComparator(TaskEqualityRuleManager taskEqualityRuleManager,
+                                  TaskEquality            minimalNodeEquality)
     {
         super();
-        this.nodeEqualityRuleManager = nodeEqualityRuleManager;
+        this.taskEqualityRuleManager = taskEqualityRuleManager;
         this.minimalNodeEquality = minimalNodeEquality;
         
-        if (minimalNodeEquality == NodeEquality.LEXICALLY_EQUAL) {
+        if (minimalNodeEquality == TaskEquality.LEXICALLY_EQUAL) {
             comparer = new LexicalComparer();
         }
-        else if (minimalNodeEquality == NodeEquality.SYNTACTICALLY_EQUAL) {
+        else if (minimalNodeEquality == TaskEquality.SYNTACTICALLY_EQUAL) {
             comparer = new SyntacticalComparer();
         }
-        else if (minimalNodeEquality == NodeEquality.SEMANTICALLY_EQUAL) {
+        else if (minimalNodeEquality == TaskEquality.SEMANTICALLY_EQUAL) {
             comparer = new SemanticalComparer();
         }
@@ -85,5 +83,5 @@
         }
         
-        if (minimalNodeEquality == NodeEquality.LEXICALLY_EQUAL) {
+        if (minimalNodeEquality == TaskEquality.LEXICALLY_EQUAL) {
             lexicalComparer = comparer;
             lexicalEqualityBuffer = equalityBuffer;
@@ -99,7 +97,14 @@
      */
     @Override
-    public boolean equals(ITaskTreeNode symbol1, ITaskTreeNode symbol2) {
-        //String id = "compare " + symbol1.getClass().getSimpleName() + " " +
-        //    symbol2.getClass().getSimpleName();
+    public boolean equals(ITaskInstance taskInstance1, ITaskInstance taskInstance2) {
+        return equals(taskInstance1.getTask(), taskInstance2.getTask());
+    }        
+
+    /**
+     * 
+     */
+    public boolean equals(ITask task1, ITask task2) {
+        //String id = "compare " + taskInstance1.getClass().getSimpleName() + " " +
+        //    taskInstance2.getClass().getSimpleName();
         //String id = "compare";
         //stopWatch.start(id);
@@ -107,12 +112,12 @@
         Boolean result;
         
-        if (symbol1 != symbol2) {
-            long key = ((long) System.identityHashCode(symbol1)) << 32;
-            key += System.identityHashCode(symbol2);
+        if (task1 != task2) {
+            long key = ((long) System.identityHashCode(task1)) << 32;
+            key += System.identityHashCode(task2);
             
             result = equalityBuffer.get(key);
             
             if (result == null) {
-                result = comparer.compare(symbol1, symbol2);
+                result = comparer.compare(task1, task2);
                 equalityBuffer.put(key, result);
             }
@@ -123,5 +128,5 @@
         //stopWatch.stop(id);
         
-        /*boolean result2 = nodeEqualityRuleManager.areAtLeastEqual(symbol1, symbol2, minimalNodeEquality);
+        /*boolean result2 = taskEqualityRuleManager.areAtLeastEqual(symbol1, symbol2, minimalNodeEquality);
         if (result != result2) {
             throw new IllegalStateException("implementation error");
@@ -132,9 +137,39 @@
 
     /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @return
+     *
+     */
+    public boolean haveLexicallyEqualTasks(ITaskInstance taskInstance1,
+                                           ITaskInstance taskInstance2)
+    {
+        return areLexicallyEqual(taskInstance1.getTask(), taskInstance2.getTask());
+    }
+        
+
+    /**
+     *
+     */
+    public boolean areLexicallyEqual(ITask task1, ITask task2) {
+        Boolean result;
+        
+        if (task1 != task2) {
+            long key = ((long) System.identityHashCode(task1)) << 32;
+            key += System.identityHashCode(task2);
+            
+            result = lexicalEqualityBuffer.get(key);
+            
+            if (result == null) {
+                result = lexicalComparer.compare(task1, task2);
+                lexicalEqualityBuffer.put(key, result);
+            }
+        }
+        else {
+            result = true;
+        }
+        
+        return result;
+    }
+
+    /**
+     *
      */
     StopWatch getStopWatch() {
@@ -143,41 +178,7 @@
 
     /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @param node1
-     * @param node2
-     * @return
-     */
-    boolean areLexicallyEqual(ITaskTreeNode symbol1, ITaskTreeNode symbol2) {
-        Boolean result;
-        
-        if (symbol1 != symbol2) {
-            long key = ((long) System.identityHashCode(symbol1)) << 32;
-            key += System.identityHashCode(symbol2);
-            
-            result = lexicalEqualityBuffer.get(key);
-            
-            if (result == null) {
-                result = lexicalComparer.compare(symbol1, symbol2);
-                lexicalEqualityBuffer.put(key, result);
-            }
-        }
-        else {
-            result = true;
-        }
-        
-        return result;
-    }
-
-    /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @return
-     */
-    NodeEquality getConsideredNodeEquality() {
+     *
+     */
+    TaskEquality getConsideredNodeEquality() {
         return minimalNodeEquality;
     }
@@ -190,5 +191,5 @@
          * 
          */
-        boolean compare(ITaskTreeNode node1, ITaskTreeNode node2);
+        boolean compare(ITask task1, ITask task2);
     }
 
@@ -201,6 +202,6 @@
          * 
          */
-        public boolean compare(ITaskTreeNode node1, ITaskTreeNode node2) {
-            return nodeEqualityRuleManager.areLexicallyEqual(node1, node2);
+        public boolean compare(ITask task1, ITask task2) {
+            return taskEqualityRuleManager.areLexicallyEqual(task1, task2);
         }
     }
@@ -214,6 +215,6 @@
          * 
          */
-        public boolean compare(ITaskTreeNode node1, ITaskTreeNode node2) {
-            return nodeEqualityRuleManager.areSyntacticallyEqual(node1, node2);
+        public boolean compare(ITask task1, ITask task2) {
+            return taskEqualityRuleManager.areSyntacticallyEqual(task1, task2);
         }
     }
@@ -227,6 +228,6 @@
          * 
          */
-        public boolean compare(ITaskTreeNode node1, ITaskTreeNode node2) {
-            return nodeEqualityRuleManager.areSemanticallyEqual(node1, node2);
+        public boolean compare(ITask task1, ITask task2) {
+            return taskEqualityRuleManager.areSemanticallyEqual(task1, task2);
         }
     }
@@ -240,6 +241,6 @@
          * 
          */
-        public boolean compare(ITaskTreeNode node1, ITaskTreeNode node2) {
-            return nodeEqualityRuleManager.areAtLeastEqual(node1, node2, minimalNodeEquality);
+        public boolean compare(ITask task1, ITask task2) {
+            return taskEqualityRuleManager.areAtLeastEqual(task1, task2, minimalNodeEquality);
         }
     }
