Index: trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java
===================================================================
--- trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java	(revision 1204)
+++ trunk/autoquest-core-usability-evaluation/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/InteractionPattern.java	(revision 1217)
@@ -15,5 +15,4 @@
 package de.ugoe.cs.autoquest.usability.rules.patterns;
 
-import java.util.Arrays;
 import java.util.List;
 
@@ -24,11 +23,11 @@
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
-import de.ugoe.cs.autoquest.usability.tasktree.IterativeDFSFilterStrategy;
-import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskModelFilter;
-import de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter;
+import de.ugoe.cs.autoquest.usability.taskmodel.filter.IterativeDFSFilterStrategy;
+import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskModelFilter;
+import de.ugoe.cs.autoquest.usability.taskmodel.filter.types.TaskTypeFilter;
 
 /**
  * <p>
- * TODO comment
+ * A interaction pattern is a simple approach to describe the structure of usage behaviour.
  * </p>
  * 
@@ -36,110 +35,191 @@
  */
 public class InteractionPattern {
-    
+
+    /**
+     * <p>
+     * {@link TaskModelFilter}, which is used to filter a task model after different {@link ITask}s
+     * </p>
+     */
     private TaskModelFilter taskTreeFilter = new TaskModelFilter(new IterativeDFSFilterStrategy());
-    
-    private TaskTypeFilter concernedTask;
-
+
+    /**
+     * <p>
+     * Type of root task. Determines the order in which sub task appear.
+     * </p>
+     */
+    private TaskTypeFilter rootTask;
+
+    /**
+     * <p>
+     * Helper objects, which decide whether or not a defined pattern condition holds.
+     * </p>
+     */
     private List<InteractionPatternVisitor> patternVisitors;
-    
+
+    /**
+     * <p>
+     * Flag, which indicates if the interaction pattern was found within a given task model.
+     * </p>
+     */
     private boolean present = false;
-    
-    /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @param concernedNode
-     * @param eventType
-     */
-    public InteractionPattern(TaskTypeFilter concernedNode,
-                        InteractionPatternVisitor... patternVisitor)
+
+    /**
+     * <p>
+     * Constructor. Creates a new interaction pattern for a given root task and a collection of
+     * {@link InteractionPatternVisitor}s.
+     * </p>
+     * 
+     * @param rootTask
+     *            Type of root task, which determines the order in which sub task appear.
+     * @param patternVisitors
+     *            {@link InteractionPatternVisitor}s, which decide whether or not a defined pattern
+     *            condition holds
+     */
+    public InteractionPattern(TaskTypeFilter rootTask,
+                              List<InteractionPatternVisitor> patternVisitors)
     {
-        this.patternVisitors = Arrays.asList(patternVisitor);
-        this.concernedTask = concernedNode;
-    }
-
+        this.patternVisitors = patternVisitors;
+        this.rootTask = rootTask;
+    }
+
+    /**
+     * 
+     * <p>
+     * Checks if a interaction pattern is contained in a given task model.
+     * </p>
+     * 
+     * @param taskModel
+     *            {@link ITaskModel}, which might contain the interaction pattern
+     * @return true, iff interaction pattern is contained
+     */
     public boolean containedIn(ITaskModel taskModel) {
         List<ITask> allConcernedTasks = filterAllConcernedTasksFrom(taskModel);
-        for(ITask concernedTask : allConcernedTasks) {
-            checkTask(concernedTask);  
-            if(this.present) break;
+        for (ITask concernedTask : allConcernedTasks) {
+            checkTask(concernedTask);
+            if (this.present)
+                break;
         }
         return this.present;
     }
 
-    private void checkTask(ITask concernedTask) {
-        applyAllVisitors(concernedTask);
-        if(allVisitorsArePresent()) {
+    /**
+     * 
+     * <p>
+     * Checks a single {@link ITask} for the interaction pattern.
+     * </p>
+     * 
+     * @param task
+     *            task, which might contain the interaction pattern
+     */
+    private void checkTask(ITask task) {
+        applyAllVisitors(task);
+        if (allVisitorsArePresent()) {
             this.present = true;
-        } else {
+        }
+        else {
             resetAllVisitors();
         }
     }
-    
+
+    /**
+     * 
+     * <p>
+     * Checks if a interaction pattern is contained in a given task.
+     * </p>
+     * 
+     * @param task
+     *            task, which might contain the interaction pattern
+     * @return true, iff interaction pattern is contained
+     */
     public boolean containedIn(ITask task) {
         checkTask(task);
-        return this.present;      
-    }
-
-    private void applyAllVisitors(ITask concernedTask) {
+        return this.present;
+    }
+
+    /**
+     * 
+     * <p>
+     * Method applys all {@link InteractionPatternVisitor}s, to check single interaction pattern
+     * conditions.
+     * </p>
+     * 
+     * @param task
+     *            task, which might contain the interaction pattern
+     */
+    private void applyAllVisitors(ITask task) {
         Optional<InteractionPatternVisitor> previousVisitor = Optional.absent();
-        for(InteractionPatternVisitor visitor : patternVisitors) {
-			if (appliedOnSelectionNode(previousVisitor)) {
-				for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) {
-					selection.accept(visitor);
-				}
-			} else {
-				previousVisitor = Optional.of(visitor);
-				concernedTask.accept(visitor);
-			}
-        }
-    }
-
-    private boolean appliedOnSelectionNode(Optional<InteractionPatternVisitor> previousVisitor) {
-        return previousVisitor.isPresent() && previousVisitor.get().hasExcludedSelectionNodes();
-    }
-
-    /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @param taskTree
-     * @return
+        for (InteractionPatternVisitor visitor : patternVisitors) {
+            if (appliedOnSelectionNode(previousVisitor)) {
+                for (ITask selection : previousVisitor.get().getRetainedSelectionNodes()) {
+                    selection.accept(visitor);
+                }
+            }
+            else {
+                previousVisitor = Optional.of(visitor);
+                task.accept(visitor);
+            }
+        }
+    }
+
+    /**
+     * 
+     * <p>
+     * Checks, if a {@link InteractionPatternVisitor} was applied on a {@link ISelection} task.
+     * </p>
+     * 
+     * @param interactionPatternVisitor
+     *            {@link InteractionPatternVisitor}
+     * @return true, iff {@link InteractionPatternVisitor} was applied on {@link ISelection} task
+     */
+    private boolean appliedOnSelectionNode(Optional<InteractionPatternVisitor> interactionPatternVisitor)
+    {
+        return interactionPatternVisitor.isPresent() &&
+            interactionPatternVisitor.get().hasExcludedSelectionNodes();
+    }
+
+    /**
+     * <p>
+     * Filters given task model after root task of interaction pattern.
+     * </p>
+     * 
+     * @param taskModel
+     *            {@link ITaskModel}
+     * @return all tasks of task model, which matches root task of interaction pattern
      */
     private List<ITask> filterAllConcernedTasksFrom(ITaskModel taskModel) {
-        return this.taskTreeFilter.filterByNodeType(this.concernedTask).from(taskModel).tasksMatchedFilter();
-    }
-    
-    /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
-     * @return
+        return this.taskTreeFilter.filterByNodeType(this.rootTask).from(taskModel)
+            .tasksMatchedFilter();
+    }
+
+    /**
+     * <p>
+     * Checks, if all interaction pattern condition are evaluated to true.
+     * </p>
+     * 
+     * @return true, iff all interaction pattern condition are true
      */
     private boolean allVisitorsArePresent() {
-        Iterable<InteractionPatternVisitor> allPresent = Iterables.filter(this.patternVisitors, new Predicate<InteractionPatternVisitor>() {
-            
-            public boolean apply(InteractionPatternVisitor visitor) {
-                return visitor.isPresent();
-            }
-            
-        });
+        Iterable<InteractionPatternVisitor> allPresent =
+            Iterables.filter(this.patternVisitors, new Predicate<InteractionPatternVisitor>() {
+
+                public boolean apply(InteractionPatternVisitor visitor) {
+                    return visitor.isPresent();
+                }
+
+            });
         return Iterables.size(allPresent) == this.patternVisitors.size();
     }
-    
-    /**
-     * <p>
-     * TODO: comment
-     * </p>
-     *
+
+    /**
+     * <p>
+     * Resets all interaction pattern condition.
+     * </p>
+     * 
      */
     private void resetAllVisitors() {
-        for(InteractionPatternVisitor visitor : this.patternVisitors) {
+        for (InteractionPatternVisitor visitor : this.patternVisitors) {
             visitor.reset();
         }
-        
+
     }
 
