Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithEventAndContainsEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithEventAndContainsEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithEventAndContainsEventTest.java	(revision 1170)
@@ -0,0 +1,92 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsAndEndsWithEventAndContainsEventTest {
+    
+    @Test
+    public void starts_and_ends_with_event_and_contains_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      TextInput target2 {}" +
+                      "      MouseClick target3 {}" +
+                      "      TextInput target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_and_ends_with_event_and_contains_event_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      TextInput target1 {}" +
+                      "      EventTask target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq2 {" +
+                      "      EventTask target3 {}" +
+                      "      EventTask target4 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq3 {" +
+                      "      EventTask target5 {}" +
+                      "      MouseClick target6 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithEventTest.java	(revision 1170)
@@ -0,0 +1,85 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsAndEndsWithEventTest {
+    
+    @Test
+    public void sequence_starts_and_ends_with_positive_2() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      TextInput target2 {}" +
+                      "      MouseClick target3 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void iteration_starts_and_ends_with_negative_3() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Iteration iter1 {" +
+                      "    Selection sel1 {" +
+                      "      EventTask target1 {}" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq1 {" +
+                      "        EventTask target2 {}" +
+                      "        EventTask target3 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(ITERATION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithPatternAndContainsPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithPatternAndContainsPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithPatternAndContainsPatternTest.java	(revision 1170)
@@ -0,0 +1,97 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsAndEndsWithPatternAndContainsPatternTest {
+
+    @Test
+    public void sequence_starts_and_ends_with_pattern_and_contains_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+        	          "    Iteration iter1 {" +
+        	          "      MouseClick t1 {}" +
+        	          "    }" + 
+                      "    Sequence seq2 {" +
+                      "      MouseClick t2 {}" +
+                      "      TextInput t3 {}" +
+                      "    }" +
+                      "    Iteration iter2 {" +
+                      "      TextInput t1 {}" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = builder.concernedNode(ITERATION).contains(MOUSE_CLICK).build();
+        UsagePattern containedPattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).contains(TEXT_INPUT).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(containedPattern).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void sequence_starts_and_ends_with_pattern_and_contains_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Iteration iter1 {" +
+                      "      MouseClick t1 {}" +
+                      "    }" +
+                      "    Sequence seq2 {" + 
+                      "      TextInput t2 {}" +
+                      "      TextInput t3 {}" +
+                      "    }" +
+                      "    Iteration iter2 {" +
+                      "      TextInput t1 {}" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = builder.concernedNode(ITERATION).contains(MOUSE_CLICK).build();
+        UsagePattern containedPattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).contains(TEXT_INPUT).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(containedPattern).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsAndEndsWithPatternTest.java	(revision 1170)
@@ -0,0 +1,102 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsAndEndsWithPatternTest {
+
+    @Test
+    public void starts_and_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Iteration iter1 {" +
+                      "      MouseClick t1 {}" +
+                      "    }" +
+                      "  }" +
+                      "  TextInput () {}" +
+                      "  Selection sel1 {" +
+                      "    MouseClick t2 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq3 {" +
+                      "      TextInput t3 {}" +
+                      "      MouseClick t1 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).contains(MOUSE_CLICK).build();
+        UsagePattern endsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_and_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Iteration iter1 {" +
+                      "      MouseClick t1 {}" +
+                      "    }" +
+                      "    TextInput t2 {}" +
+                      "    Selection sel1 {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput t3 {}" +
+                      "        MouseClick t1 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).contains(MOUSE_CLICK).build();
+        UsagePattern endsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(ITERATION).startsWith(endsWithPattern).endsWith(startsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsEventTest.java	(revision 1170)
@@ -0,0 +1,91 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventAndContainsEventTest {
+    
+    @Test
+    public void starts_and_ends_with_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      TextInput target2 {}" +
+                      "      MouseClick target3 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void sequence_starts_and_ends_with_event_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      TextInput target1 {}" +
+                      "      EventTask target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq2 {" +
+                      "      EventTask target3 {}" +
+                      "      EventTask target4 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq3 {" +
+                      "      EventTask target5 {}" +
+                      "      MouseClick target6 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndContainsPatternTest.java	(revision 1170)
@@ -0,0 +1,103 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventAndContainsPatternTest {
+
+    @Test
+    public void starts_and_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq1 {" +
+                      "        MouseClick t2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq1 {" +
+                      "        TextInput t3 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern containedPattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = builder.concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(containedPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_and_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      MouseClick target1 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Selection sel2 {" +
+                      "      TextInput t2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Selection sel2 {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Sequence seq2 {" +
+                      "    EventTask target3 {}" +
+                      "    EventTask target4 {}" +
+                      "    EventTask target5 {}" +
+                      "    MouseClick target6 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern containedPattern = builder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = builder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).contains(containedPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndEndsWithPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndEndsWithPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventAndEndsWithPatternTest.java	(revision 1170)
@@ -0,0 +1,83 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventAndEndsWithPatternTest {
+
+    @Test
+    public void starts_with_event_contains_event_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    MouseClickt2 {}" +
+                      "    Iteration iter1 {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_event_contains_event_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    MouseClick t2 {}" +
+                      "    Iteration {" +
+                      "      TextInput t3 {}" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+   
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsEventEndsWithPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsEventEndsWithPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsEventEndsWithPatternTest.java	(revision 1170)
@@ -0,0 +1,83 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventContainsEventEndsWithPatternTest {
+
+    @Test
+    public void starts_with_event_contains_event_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    MouseClick t2 {}" +
+                      "    Iteration {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_event_contains_event_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    MouseClick t2 {}" +
+                      "    Iteration {" +
+                      "      TextInput t3 {}" +
+                      "    }" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+   
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithEventTest.java	(revision 1170)
@@ -0,0 +1,103 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventContainsPatternAndEndsWithEventTest {
+
+    @Test
+    public void starts_with_event_contains_pattern_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        MouseClick t2 {}" +
+                      "        TextInput t3 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      MouseClick t2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  TextInput t3 {}" +
+                      "  MouseClick t2 {}" +
+                      "  Iteration iter1 {" +
+                      "    TextInput t4 {}" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern containedPattern = builder.concernedNode(SELECTION).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(containedPattern).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_event_contains_pattern_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+		  		      "  Sequence seq1 {" + 
+		              "    TextInput t1 {}" +
+		              "    Selection sel1 {" +
+		              "      Sequence seq2 {" +
+		              "        MouseClick t2 {}" +
+		              "        TextInput t3 {}" +
+		              "      }" +
+		              "    }" +
+		              "    Selection sel1 {" +
+		              "      MouseClick t2 {}" +
+		              "    }" +
+		              "  }" +
+		              "  TextInput t3 {}" +
+		              "  MouseClick t2 {}" +
+		              "  Iteration iter1 {" +
+		              "    TextInput t4 {}" +
+		              "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern containedPattern = builder.concernedNode(SELECTION).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(containedPattern).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+   
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventContainsPatternAndEndsWithPatternTest.java	(revision 1170)
@@ -0,0 +1,102 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventContainsPatternAndEndsWithPatternTest {
+
+    @Test
+    public void starts_with_event_contains_pattern_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        MouseClick t2 {}" +
+                      "        TextInput t3 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      MouseClick t2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  TextInput t3 {}" +
+                      "  MouseClick t2 {}" +
+                      "  Iteration iter1 {" +
+                      "    MouseClick t4 {}" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern containedPattern = builder.concernedNode(SELECTION).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(containedPattern).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_event_contains_pattern_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" + 
+                      "    TextInput t1 {}" +
+                      "    Selection sel1{" +
+                      "      TextInput t2 {}" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "  }" +
+                      "  TextInput t2 {}" +
+                      "  MouseClick t4 {}" +
+                      "  Iteration iter1 {" +
+                      "    MouseClick t5 {}" +
+                      "  }" + 
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder builder = new UsagePatternBuilder();
+        UsagePattern endsWithPattern = builder.concernedNode(ITERATION).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+   
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithEventTest.java	(revision 1170)
@@ -0,0 +1,80 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithEventTest {
+    
+    @Test
+    public void starts_with_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence {" +
+                      "      TextInput target2 {}" +
+                      "      EventTask target3 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_event_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Iteration iter1 {" +
+                      "    Selection sel1 {" +
+                      "      EventTask target2 {}" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      EventTask target3 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePattern pattern = new UsagePatternBuilder().concernedNode(SEQUENCE).startsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndContainsEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndContainsEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndContainsEventTest.java	(revision 1170)
@@ -0,0 +1,90 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternAndContainsEventTest {
+    
+    @Test
+    public void starts_with_pattern_and_contains_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      Iteration iter1 {" +
+                      "        TextInput target4 {}" +
+                      "      }" +
+                      "      MouseClick t2 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).startsWith(TEXT_INPUT).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(MOUSE_CLICK).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_and_contains_event_negative() {
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      Iteration iter1 {" +
+                      "        TextInput target4 {}" +
+                      "      }" +
+                      "      EventTask t2 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).contains(TEXT_INPUT).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(MOUSE_CLICK).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndContainsPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndContainsPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndContainsPatternTest.java	(revision 1170)
@@ -0,0 +1,108 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternAndContainsPatternTest {
+
+    @Test
+    public void starts_with_pattern_and_contains_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Iteration iter1 {" +
+                      "      MouseClick t1 {}" +
+                      "    }" +
+                      "    TextInput t2 {}" +
+                      "    Selection sel1 {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput t2 {}" +
+                      "        MouseClick t3 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "  Iteration iter2 () {" +
+                      "    MouseClick t1 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).contains(MOUSE_CLICK).build();
+        UsagePattern containedPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(containedPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_and_contains_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Iteration iter1 {" +
+                      "      MouseClick t1 {}" +
+                      "    }" +
+                      "    TextInput t2 {}" +
+                      "    Selection sel1 {" +
+                      "      MouseClick t3 {}" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        MouseClick t2 {}" +
+                      "        TextInput t3 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "  Iteration iter2 () {" +
+                      "    MouseClick t1 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).contains(MOUSE_CLICK).build();
+        UsagePattern endsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(ITERATION).startsWith(endsWithPattern).endsWith(startsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndEndsWithEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndEndsWithEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternAndEndsWithEventTest.java	(revision 1170)
@@ -0,0 +1,101 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternAndEndsWithEventTest {
+
+    @Test
+    public void starts_with_pattern_contains_event_and_ends_with_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    MouseClick target2 {}" +
+                      "    TextInput target3 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_contains_event_and_ends_with_event_negative() {
+        // Given
+        String spec = "UserSession {" +
+	  		          "  Sequence seq1 {" +
+	                  "    Selection sel1 {" +
+	                  "      Sequence seq2 {" +
+	                  "        TextInput target4 {}" +
+	                  "        MouseClick target2 {}" +
+	                  "      }" +
+	                  "    }" +
+	                  "    Selection sel1 {" +
+	                  "      Sequence seq3 {" +
+	                  "        TextInput target4 {}" +
+	                  "        EventTask target2 {}" +
+	                  "      }" +
+	                  "    }" +
+                      "    EventTask target2 {}" +
+                      "    MouseClick target3 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsEventAndEndsWithEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsEventAndEndsWithEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsEventAndEndsWithEventTest.java	(revision 1170)
@@ -0,0 +1,101 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternContainsEventAndEndsWithEventTest {
+
+    @Test
+    public void starts_with_pattern_contains_event_and_ends_with_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    MouseClick target2 {}" +
+                      "    TextInput target3 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_contains_event_and_ends_with_event_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    EventTask target2 {}" +
+                      "    MouseClick target3 {}" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsEventAndEndsWithPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsEventAndEndsWithPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsEventAndEndsWithPatternTest.java	(revision 1170)
@@ -0,0 +1,127 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternContainsEventAndEndsWithPatternTest {
+
+    @Test
+    public void starts_with_pattern_contains_event_and_ends_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2{" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "  MouseClick target2 {}" +
+                      "  TextInput target3 {}" +
+                      "  Selection sel2 {" +
+                      "    Sequence seq4 {" +
+                      "      TextInput target4 {}" +
+                      "      MouseClick target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel2 {" +
+                      "    Sequence seq5 {" +
+                      "      TextInput target4 {}" +
+                      "      EventTask target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern endsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(MOUSE_CLICK).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_contains_event_and_ends_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "  EventTask target2 {}" +
+                      "  TextInput target3 {}" +
+                      "  Selection sel2 {" +
+                      "    Sequence seq4 {" +
+                      "      TextInput target4 {}" +
+                      "      MouseClick target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "  Selection sel2 {" +
+                      "    Sequence seq5 {" +
+                      "      TextInput target4 {}" +
+                      "      EventTask target2 {}" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern endsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(MOUSE_CLICK).endsWith(endsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsPatternAndEndsWithEventTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsPatternAndEndsWithEventTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternContainsPatternAndEndsWithEventTest.java	(revision 1170)
@@ -0,0 +1,109 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SELECTION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternContainsPatternAndEndsWithEventTest {
+
+    @Test
+    public void starts_with_pattern_contains_pattern_and_ends_with_event_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "  Sequence seq4 {" +
+                      "    MouseClick target2 {}" +
+                      "    EventTask t5 {}" +
+                      "  }" +
+                      "  TextInput target3 {}" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern containsPattern = patternBuilder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(containsPattern).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_contains_pattern_and_ends_with_event_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        TextInput target4 {}" +
+                      "        MouseClick target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "  Sequence seq4 {" +
+                      "    TextInput target2 {}" +
+                      "    EventTask () {}" +
+                      "  }" +
+                      "  TextInput target3 {}" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SELECTION).startsWith(TEXT_INPUT).endsWith(MOUSE_CLICK).build();
+        UsagePattern containsPattern = patternBuilder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).contains(containsPattern).endsWith(TEXT_INPUT).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+    
+}
Index: /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternTest.java
===================================================================
--- /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternTest.java	(revision 1170)
+++ /trunk/autoquest-core-usability-evaluation-test/src/main/java/de/ugoe/cs/autoquest/usability/rules/patterns/visitors/startswith/StartsWithPatternTest.java	(revision 1170)
@@ -0,0 +1,97 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.usability.rules.patterns.visitors.startswith;
+
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.MOUSE_CLICK;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.EventTypeFilter.TEXT_INPUT;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.ITERATION;
+import static de.ugoe.cs.autoquest.usability.tasktree.filters.TaskTypeFilter.SEQUENCE;
+import static org.fest.assertions.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePattern;
+import de.ugoe.cs.autoquest.usability.rules.patterns.UsagePatternBuilder;
+import de.ugoe.cs.autoquest.usability.testutil.GenerateTaskModelUtil;
+
+/**
+ * <p>
+ * TODO comment
+ * </p>
+ * 
+ * @author Alexander Deicke
+ */
+public class StartsWithPatternTest {
+    
+    @Test
+    public void starts_with_pattern_positive() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Selection sel1 {" +
+                      "    EventTask target1 {}" +
+                      "  }" +
+                      "  Selection sel1 {" +
+                      "    Sequence seq1 {" +
+                      "      Iteration iter1 {" +
+                      "        Sequence seq2 {" +
+                      "          TextInput target4 {}" +
+                      "          MouseClick target2 {}" +
+                      "          TextInput target4 {}" +
+                      "        }" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(ITERATION).startsWith(TEXT_INPUT).contains(MOUSE_CLICK).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isTrue();
+    }
+    
+    @Test
+    public void starts_with_pattern_negative() {
+        // Given
+        String spec = "UserSession {" +
+        		      "  Sequence seq1 {" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq2 {" +
+                      "        MouseClick target4 {}" +
+                      "        EventTask target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "    Selection sel1 {" +
+                      "      Sequence seq3 {" +
+                      "        TextInput target4 {}" +
+                      "        TextInput target2 {}" +
+                      "      }" +
+                      "    }" +
+                      "  }" +
+                      "}";
+        ITaskModel taskTree = GenerateTaskModelUtil.getTaskModelFromSpec(spec);
+        UsagePatternBuilder patternBuilder = new UsagePatternBuilder();
+        UsagePattern startsWithPattern = patternBuilder.concernedNode(SEQUENCE).startsWith(MOUSE_CLICK).endsWith(TEXT_INPUT).build();
+        UsagePattern pattern = patternBuilder.concernedNode(SEQUENCE).startsWith(startsWithPattern).build();
+        // When
+        boolean patternContained = pattern.containedIn(taskTree);
+        // Then
+        assertThat(patternContained).isFalse();
+    }
+
+}
