Index: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModel.java
===================================================================
--- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskTree.java	(revision 1132)
+++ trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModel.java	(revision 1146)
@@ -15,10 +15,17 @@
 package de.ugoe.cs.autoquest.tasktrees.treeimpl;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
-import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree;
-import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode;
-import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeInfo;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession;
 
 /**
@@ -28,67 +35,77 @@
  * @author 2012, last modified by $Author: patrick$
  */
-public class TaskTree implements ITaskTree {
+class TaskModel implements ITaskModel {
     
-    /** the map of nodes */
-    private Map<ITaskTreeNode, ITaskTreeNodeInfo> taskMap;
+    /**  */
+    private static final long serialVersionUID = 1L;
 
-    /** the root node of the task tree */
-    private ITaskTreeNode rootNode;
+    /** the map of tasks */
+    private List<IUserSession> userSessions;
+
+    /** the map of tasks */
+    private Map<ITask, TaskInfo> taskMap = new HashMap<ITask, TaskInfo>();
 
     /**
-     * TODO: comment
-     * 
+     *
      */
-    TaskTree(ITaskTreeNode rootNode) {
-        this.rootNode = rootNode;
+    TaskModel(List<IUserSession> userSessions) {
+        if ((userSessions == null) || (userSessions.size() == 0)) {
+            throw new IllegalArgumentException("user sessions must not be null");
+        }
+        
+        this.userSessions = userSessions;
+        
+        for (IUserSession session : this.userSessions) {
+            for (ITaskInstance taskInstance : session) {
+                addTaskToMap(taskInstance.getTask());
+            }
+        }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see de.ugoe.cs.tasktree.treeifc.TaskTree#getRoot()
+
+    /* (non-Javadoc)
+     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel#getUserSessions()
      */
     @Override
-    public ITaskTreeNode getRoot() {
-        return rootNode;
+    public List<IUserSession> getUserSessions() {
+        return Collections.unmodifiableList(userSessions);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see de.ugoe.cs.tasktree.treeifc.TaskTree#getTaskMap()
+
+    /* (non-Javadoc)
+     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel#getTasks()
      */
     @Override
-    public synchronized Map<ITaskTreeNode, ITaskTreeNodeInfo> getTaskMap() {
-        if (taskMap == null) {
-            taskMap = new HashMap<ITaskTreeNode, ITaskTreeNodeInfo>();
-            addNodeToMap(rootNode, null);
-        }
-        return taskMap;
+    public Collection<ITask> getTasks() {
+        return Collections.unmodifiableCollection(taskMap.keySet());
+    }
+
+
+    /* (non-Javadoc)
+     * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel#getTaskInfo(de.ugoe.cs.autoquest.tasktrees.treeifc.ITask)
+     */
+    @Override
+    public ITaskInfo getTaskInfo(ITask task) {
+        return taskMap.get(task);
     }
 
     /**
-     * TODO: comment
-     * 
-     * @param rootNode
+     *
      */
-    private void addNodeToMap(ITaskTreeNode node, ITaskTreeNode parent) {
-        NodeInfo nodeInfo = (NodeInfo) taskMap.get(node);
+    private void addTaskToMap(ITask task) {
+        TaskInfo taskInfo = taskMap.get(task);
 
-        if (nodeInfo == null) {
-            nodeInfo = new NodeInfo(node);
-            taskMap.put(node, nodeInfo);
+        if (taskInfo == null) {
+            taskInfo = new TaskInfo(task);
+            taskMap.put(task, taskInfo);
         }
 
-        if (parent != null) {
-            // 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
-            //nodeInfo.removeParent(parent);
-            nodeInfo.addParent(parent);
+        if (task instanceof IStructuringTemporalRelationship) {
+            for (ITask child : ((IStructuringTemporalRelationship) task).getChildren()) {
+                addTaskToMap(child);
+            }
         }
-
-        for (ITaskTreeNode child : node.getChildren()) {
-            addNodeToMap(child, node);
+        else if (task instanceof IMarkingTemporalRelationship) {
+            addTaskToMap(((IMarkingTemporalRelationship) task).getMarkedTask());
         }
     }
@@ -100,21 +117,6 @@
      */
     @Override
-    public TaskTree clone() {
-        TaskTree clone = null;
-        try {
-            clone = (TaskTree) super.clone();
-
-            clone.rootNode = rootNode.clone();
-
-            // the clone will create the task map itself, when it is first retrieved
-            clone.taskMap = null;
-
-        }
-        catch (CloneNotSupportedException e) {
-            // this should never happen. Therefore simply dump the exception
-            e.printStackTrace();
-        }
-
-        return clone;
+    public TaskModel clone() {
+        return new TaskModel(userSessions);
     }
 
