Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.classpath
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.classpath	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.classpath	(revision 2054)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.project
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.project	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.project	(revision 2054)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>autoquest-plugin-alignment</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.settings/org.eclipse.jdt.core.prefs	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/.settings/org.eclipse.jdt.core.prefs	(revision 2054)
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/pom.xml
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/pom.xml	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/pom.xml	(revision 2054)
@@ -0,0 +1,85 @@
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+>
+    <parent>
+        <groupId>de.ugoe.cs.autoquest</groupId>
+        <artifactId>autoquest</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>autoquest-plugin-alignment</artifactId>
+    <name>autoquest-plugin-alignment</name>
+    <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+        </license>
+    </licenses>
+    <scm>
+        <url>${autoquest-scm-trunk-dir}/${project.artifactId}</url>
+        <connection>scm:svn:${autoquest-scm-trunk-dir}/${project.artifactId}</connection>
+    </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-resources-plugin</artifactId>
+            <version>2.4.3</version>
+        </dependency>
+    
+        <dependency>
+            <groupId>de.ugoe.cs</groupId>
+            <artifactId>java-utils</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>de.ugoe.cs.autoquest</groupId>
+            <artifactId>autoquest-plugin-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>de.ugoe.cs.autoquest</groupId>
+            <artifactId>autoquest-core-events</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>de.ugoe.cs.autoquest</groupId>
+            <artifactId>autoquest-core-usageprofiles</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>de.ugoe.cs.autoquest</groupId>
+            <artifactId>autoquest-misc</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+        	<groupId>de.ugoe.cs.autoquest</groupId>
+        	<artifactId>autoquest-core-tasktrees</artifactId>
+        	<version>${project.parent.version}</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencyManagement>
+    	<dependencies>
+    		<dependency>
+    			<groupId>de.ugoe.cs.autoquest</groupId>
+    			<artifactId>autoquest-core-usageprofiles</artifactId>
+    			<version>${project.parent.version}</version>
+    		</dependency>
+    	</dependencies>
+    </dependencyManagement>
+</project>
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/ALIGNMENTPlugin.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/ALIGNMENTPlugin.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/ALIGNMENTPlugin.java	(revision 2054)
@@ -0,0 +1,60 @@
+//   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.plugin.alignment;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.plugin.AutoQUESTPlugin;
+
+/**
+ * <p>
+ * Identifier class for the AutoQUEST Alignment plugin
+ * </p>
+ * 
+ * @author Ralph Krimmel
+ * @version 1.0
+ */
+public class ALIGNMENTPlugin implements AutoQUESTPlugin {
+
+	/**
+	 * <p>
+	 * The command packages of this plug-in.
+	 * </p>
+	 */
+	private final static String[] commandPackages = new String[] { "de.ugoe.cs.autoquest.plugin.alignment.commands" };
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.autoquest.plugin.AutoQUESTPlugin#getTitle()
+	 */
+	@Override
+	public String getTitle() {
+		return "Alignment-Plugin";
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.autoquest.plugin.AutoQUESTPlugin#getCommandPackages()
+	 */
+	@Override
+	public List<String> getCommandPackages() {
+		return Collections.unmodifiableList(Arrays.asList(commandPackages));
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/Alignment.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/Alignment.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/Alignment.java	(revision 2054)
@@ -0,0 +1,8 @@
+package de.ugoe.cs.autoquest.plugin.alignment;
+
+import java.util.List;
+
+public interface Alignment {
+	public List<Match> getMatches();
+	
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/FengDoolittle.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/FengDoolittle.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/FengDoolittle.java	(revision 2054)
@@ -0,0 +1,5 @@
+package de.ugoe.cs.autoquest.plugin.alignment;
+
+public class FengDoolittle {
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/Match.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/Match.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/Match.java	(revision 2054)
@@ -0,0 +1,9 @@
+package de.ugoe.cs.autoquest.plugin.alignment;
+
+public class Match {
+
+	
+	private float score;
+	private int start;
+	private int end;
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/ProgressiveMultiAlignment.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/ProgressiveMultiAlignment.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/ProgressiveMultiAlignment.java	(revision 2054)
@@ -0,0 +1,5 @@
+package de.ugoe.cs.autoquest.plugin.alignment;
+
+public class ProgressiveMultiAlignment {
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/SmithWaterman.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/SmithWaterman.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/SmithWaterman.java	(revision 2054)
@@ -0,0 +1,331 @@
+package de.ugoe.cs.autoquest.plugin.alignment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.SubstitutionMatrix;
+
+public class SmithWaterman implements Alignment {
+
+	/**
+	 * The first input
+	 */
+	private int[] input1;
+
+	/**
+	 * The second input String
+	 */
+	private int[] input2;
+
+	/**
+	 * The lengths of the input
+	 */
+	private int length1, length2;
+
+	/**
+	 * The score matrix. The true scores should be divided by the normalization
+	 * factor.
+	 */
+	private double[][] score;
+
+	/**
+	 * Score threshold
+	 */
+	private int scoreThreshold;;
+
+	/**
+	 * The similarity function constants.
+	 */
+	// static final int MATCH_SCORE = 10;
+	// static final int MISMATCH_SCORE = -8;
+	// static final int INDEL_SCORE = -9;
+
+	/**
+	 * Constants of directions. Multiple directions are stored by bits. The zero
+	 * direction is the starting point.
+	 */
+	static final int DR_LEFT = 1; // 0001
+	static final int DR_UP = 2; // 0010
+	static final int DR_DIAG = 4; // 0100
+	static final int DR_ZERO = 8; // 1000
+
+	/**
+	 * The directions pointing to the cells that give the maximum score at the
+	 * current cell. The first index is the column index. The second index is
+	 * the row index.
+	 */
+	private int[][] prevCells;
+
+	/**
+	 * Substitution matrix to calculate scores
+	 */
+	private SubstitutionMatrix submat;
+
+	public SmithWaterman(int[] input1, int[] input2, SubstitutionMatrix submat) {
+		this.input1 = input1;
+		this.input2 = input2;
+		length1 = input1.length;
+		length2 = input2.length;
+		this.submat = submat;
+
+		System.out.println("Starting SmithWaterman algorithm with a "
+				+ submat.getClass() + " Substitution Matrix: " + submat.info());
+		scoreThreshold = 20;
+		score = new double[length1 + 1][length2 + 1];
+		prevCells = new int[length1 + 1][length2 + 1];
+
+		buildMatrix();
+	}
+
+	/**
+	 * Compute the similarity score of substitution The position of the first
+	 * character is 1. A position of 0 represents a gap.
+	 * 
+	 * @param i
+	 *            Position of the character in str1
+	 * @param j
+	 *            Position of the character in str2
+	 * @return Cost of substitution of the character in str1 by the one in str2
+	 */
+	private double similarity(int i, int j) {
+		if (i == 0 || j == 0) {
+			// it's a gap (indel)
+			return submat.getGapPenalty();
+		}
+		// System.out.println("Diag letters: " + input1[i-1] + " " +
+		// input2[j-1]);
+		// return (input1[i - 1] == input2[j - 1]) ? MATCH_SCORE :
+		// MISMATCH_SCORE;
+		return submat.getDistance(i - 1, j - 1);
+	}
+
+	/**
+	 * Build the score matrix using dynamic programming. Note: The indel scores
+	 * must be negative. Otherwise, the part handling the first row and column
+	 * has to be modified.
+	 */
+	private void buildMatrix() {
+		if (submat.getGapPenalty() >= 0) {
+			throw new Error("Indel score must be negative");
+		}
+
+		int i; // length of prefix substring of str1
+		int j; // length of prefix substring of str2
+
+		// base case
+		score[0][0] = 0;
+		prevCells[0][0] = DR_ZERO; // starting point
+
+		// the first row
+		for (i = 1; i <= length1; i++) {
+			score[i][0] = 0;
+			prevCells[i][0] = DR_ZERO;
+		}
+
+		// the first column
+		for (j = 1; j <= length2; j++) {
+			score[0][j] = 0;
+			prevCells[0][j] = DR_ZERO;
+		}
+
+		// the rest of the matrix
+		for (i = 1; i <= length1; i++) {
+			for (j = 1; j <= length2; j++) {
+				double diagScore = score[i - 1][j - 1] + similarity(i, j);
+				double upScore = score[i][j - 1] + similarity(0, j);
+				double leftScore = score[i - 1][j] + similarity(i, 0);
+
+				score[i][j] = Math.max(diagScore,
+						Math.max(upScore, Math.max(leftScore, 0)));
+				prevCells[i][j] = 0;
+
+				// find the directions that give the maximum scores.
+				// the bitwise OR operator is used to record multiple
+				// directions.
+				if (diagScore == score[i][j]) {
+					prevCells[i][j] |= DR_DIAG;
+				}
+				if (leftScore == score[i][j]) {
+					prevCells[i][j] |= DR_LEFT;
+				}
+				if (upScore == score[i][j]) {
+					prevCells[i][j] |= DR_UP;
+				}
+				if (0 == score[i][j]) {
+					prevCells[i][j] |= DR_ZERO;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Get the maximum value in the score matrix.
+	 */
+	private double getMaxScore() {
+		double maxScore = 0;
+
+		// skip the first row and column
+		for (int i = 1; i <= length1; i++) {
+			for (int j = 1; j <= length2; j++) {
+				if (score[i][j] > maxScore) {
+					maxScore = score[i][j];
+				}
+			}
+		}
+
+		return maxScore;
+	}
+
+	/**
+	 * Get the alignment score between the two input strings.
+	 */
+	public double getAlignmentScore() {
+		return getMaxScore();
+	}
+
+	/**
+	 * TODO: Iterative Version!!! Output the local alignments ending in the (i,
+	 * j) cell. aligned1 and aligned2 are suffixes of final aligned strings
+	 * found in backtracking before calling this function. Note: the strings are
+	 * replicated at each recursive call. Use buffers or stacks to improve
+	 * efficiency.
+	 */
+	private void printAlignments(int i, int j, String aligned1, String aligned2) {
+		// we've reached the starting point, so print the alignments
+
+		if ((prevCells[i][j] & DR_ZERO) > 0) {
+			System.out.println(aligned1);
+			System.out.println(aligned2);
+			System.out.println();
+
+			// Note: we could check other directions for longer alignments
+			// with the same score. we don't do it here.
+			return;
+		}
+
+		// find out which directions to backtrack
+		if ((prevCells[i][j] & DR_LEFT) > 0) {
+			printAlignments(i - 1, j, input1[i - 1] + aligned1, "_ " + aligned2);
+		}
+		if ((prevCells[i][j] & DR_UP) > 0) {
+			printAlignments(i, j - 1, "_ " + aligned1, input2[j - 1] + aligned2);
+		}
+		if ((prevCells[i][j] & DR_DIAG) > 0) {
+			printAlignments(i - 1, j - 1, input1[i - 1] + " " + aligned1,
+					input2[j - 1] + " " + aligned2);
+		}
+	}
+
+	/**
+	 * given the bottom right corner point trace back the top left conrner. at
+	 * entry: i, j hold bottom right (end of Aligment coords) at return: hold
+	 * top left (start of Alignment coords)
+	 */
+	private int[] traceback(int i, int j) {
+
+		// find out which directions to backtrack
+		while (true) {
+			if ((prevCells[i][j] & DR_LEFT) > 0) {
+				if (score[i - 1][j] > 0)
+					i--;
+				else
+					break;
+			}
+			if ((prevCells[i][j] & DR_UP) > 0) {
+				// return traceback(i, j-1);
+				if (score[i][j - 1] > 0)
+					j--;
+				else
+					break;
+			}
+			if ((prevCells[i][j] & DR_DIAG) > 0) {
+				// return traceback(i-1, j-1);
+				if (score[i - 1][j - 1] > 0) {
+					i--;
+					j--;
+				} else
+					break;
+			}
+		}
+		int[] m = { i, j };
+		return m;
+	}
+
+	/**
+	 * Output the local alignments with the maximum score.
+	 */
+	public void printAlignments() {
+		// find the cell with the maximum score
+		double maxScore = getMaxScore();
+
+		/*
+		 * for (int i = 0; i < matches.length; i++) {
+		 * System.out.println("Match #" + i + ":" + matches.get(i)); }
+		 */
+
+		// skip the first row and column
+		for (int i = 1; i <= length1; i++) {
+			for (int j = 1; j <= length2; j++) {
+				if (score[i][j] == maxScore) {
+					printAlignments(i, j, "", "");
+				}
+			}
+		}
+		// Note: empty alignments are not printed.
+	}
+
+	/**
+	 * print the dynmaic programming matrix
+	 */
+	public void printDPMatrix() {
+		System.out.print("   ");
+		for (int j = 1; j <= length2; j++)
+			System.out.print("   " + input2[j - 1]);
+		System.out.println();
+		for (int i = 0; i <= length1; i++) {
+			if (i > 0)
+				System.out.print(input1[i - 1] + " ");
+			else
+				System.out.print("  ");
+			for (int j = 0; j <= length2; j++) {
+				System.out.print(score[i][j] + " ");
+			}
+			System.out.println();
+		}
+	}
+
+	/**
+	 * Return a set of Matches identified in Dynamic programming matrix. A match
+	 * is a pair of subsequences whose score is higher than the preset
+	 * scoreThreshold
+	 **/
+	public List<Match> getMatches() {
+		ArrayList<Match> matchList = new ArrayList();
+		int fA = 0, fB = 0;
+		// skip the first row and column, find the next maxScore after
+		// prevmaxScore
+		for (int i = 1; i <= length1; i++) {
+			for (int j = 1; j <= length2; j++) {
+				if (score[i][j] > scoreThreshold
+						&& score[i][j] > score[i - 1][j - 1]
+						&& score[i][j] > score[i - 1][j]
+						&& score[i][j] > score[i][j - 1]) {
+					if (i == length1 || j == length2
+							|| score[i][j] > score[i + 1][j + 1]) {
+						// should be lesser than prev maxScore
+						fA = i;
+						fB = j;
+						int[] f = traceback(fA, fB); // sets the x, y to
+														// startAlignment
+														// coordinates
+						System.out.println(f[0] + " " + i + " " + f[1] + " "
+								+ j + " " + score[i][j]);
+						// TODO Add matches to matchList
+					}
+				}
+			}
+		}
+		return matchList;
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDbinaryAlignment.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDbinaryAlignment.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDbinaryAlignment.java	(revision 2054)
@@ -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.plugin.alignment.commands;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
+import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SequenceGenerator;
+import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.GlobalDataContainer;
+
+/**
+ * <p>
+ * Command to generate a binary alignment of two sequences
+ * </p>
+ * 
+ * @author Ralph Krimmel
+ * @version 1.0
+ */
+public class CMDbinaryAlignment implements Command {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	 */
+	@SuppressWarnings("unchecked")
+	public void run(List<Object> parameters) {
+		String sequencesName = "numberSequences";
+		String substitutionName = "substitutionMatrix";
+		String algorithm = "smithwaterman";
+		try {
+			sequencesName = (String) parameters.get(0);
+			substitutionName = (String) parameters.get(1);
+			if (parameters.size() > 2) {
+				algorithm = (String) parameters.get(2);
+			}
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
+
+		SimpleSequenceGenerator gen;
+		Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
+		if (obj != null) {
+			if (obj instanceof SimpleSequenceGenerator) {
+				gen = (SimpleSequenceGenerator) obj;
+				Console.println("Number of sequences: " + gen.sequenceCount());
+
+				int[] seq1 = gen.get(0).getSequence();
+				int[] seq2 = gen.get(0).getSequence();
+				
+				ObjectDistanceSubstitionMatrix submat = new
+				ObjectDistanceSubstitionMatrix();
+				submat.generate(sequences);
+				// SmithWaterman sw = new SmithWaterman(seq1, seq2,
+				// new NearbySubstitutionMatrix(seq1, seq2, 10));
+				// sw.printDPMatrix();
+				// System.out.println();
+				// sw.printAlignments();
+				// sw.getMatches();
+				System.out.println("foo");
+
+			} else {
+				Console.printerr("No number sequences generated. Please run the generateNumberSequences before.");
+				
+			}
+
+					}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#help()
+	 */
+	@Override
+	public String help() {
+		return "binaryAlignment <sequencesName> <substitutionMatrixname> {<algorithm>}";
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDdeleteShortSequences.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDdeleteShortSequences.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDdeleteShortSequences.java	(revision 2054)
@@ -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.plugin.alignment.commands;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
+import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.GlobalDataContainer;
+
+/**
+ * <p>
+ * Command to generate a binary alignment of two sequences
+ * </p>
+ * 
+ * @author Ralph Krimmel
+ * @version 1.0
+ */
+public class CMDdeleteShortSequences implements Command {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	 */
+	@SuppressWarnings("unchecked")
+	public void run(List<Object> parameters) {
+		String sequencesName = "sequences";
+		int delcount = 0;
+		int limit = 10;
+		try {
+			sequencesName = (String) parameters.get(0);
+			if (parameters.size() > 1) {
+				try {
+					limit = Integer.parseInt((String) parameters.get(1));
+					}
+				catch (NumberFormatException e)
+				{
+					Console.traceln(Level.WARNING,"Parameter not an integer. Using the default value.");
+				}
+			}
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
+
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
+		if (obj.getClass().equals(sequences.getClass())) {
+			sequences = (Collection<List<Event>>) obj;
+		}
+
+		if (sequences != null) {
+			Console.println("Number of sequences: " + sequences.size());
+			Iterator<List<Event>> iter = sequences.iterator();
+			while(iter.hasNext()) {
+			    if (iter.next().size() < limit) {
+			    	iter.remove();
+			    	delcount++;
+			    }
+			}
+			
+			Console.traceln(Level.INFO, "Deleted "+ delcount + " short sequences from " + sequencesName);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#help()
+	 */
+	@Override
+	public String help() {
+		return "deleteShortSequences <sequence name>";
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDgenerateNumberSequences.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDgenerateNumberSequences.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDgenerateNumberSequences.java	(revision 2054)
@@ -0,0 +1,88 @@
+//   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.plugin.alignment.commands;
+
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
+import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.GlobalDataContainer;
+
+/**
+ * <p>
+ * Command to generate a binary alignment of two sequences
+ * </p>
+ * 
+ * @author Ralph Krimmel
+ * @version 1.0
+ */
+public class CMDgenerateNumberSequences implements Command {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	 */
+	@SuppressWarnings("unchecked")
+	public void run(List<Object> parameters) {
+		String sequencesName = "sequences";
+		try {
+			sequencesName = (String) parameters.get(0);
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
+
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
+		if(obj != null) {
+			
+			if(obj.getClass().equals(sequences.getClass())) {
+				sequences = (Collection<List<Event>>) obj;
+			}
+		 
+				
+					Console.println("Number of sequences: " + sequences.size());
+
+					SimpleSequenceGenerator gen = new SimpleSequenceGenerator();
+					gen.generate(sequences);
+					gen.print();
+					GlobalDataContainer.getInstance().addData("numberSequences", gen);
+				
+
+				
+				
+				}
+			}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#help()
+	 */
+	@Override
+	public String help() {
+		return "generateNumberSequences <equencesName> {<algorithm>}";
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDgenerateSubstitutionMatrix.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDgenerateSubstitutionMatrix.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDgenerateSubstitutionMatrix.java	(revision 2054)
@@ -0,0 +1,89 @@
+//   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.plugin.alignment.commands;
+
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
+import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.GlobalDataContainer;
+
+/**
+ * <p>
+ * Command to generate a binary alignment of two sequences
+ * </p>
+ * 
+ * @author Ralph Krimmel
+ * @version 1.0
+ */
+public class CMDgenerateSubstitutionMatrix implements Command {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	 */
+	@SuppressWarnings("unchecked")
+	public void run(List<Object> parameters) {
+		String sequencesName = "numberSequences";
+		try {
+			sequencesName = (String) parameters.get(0);
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
+
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
+		if(obj != null) {
+			
+			if(obj.getClass().equals(sequences.getClass())) {
+				sequences = (Collection<List<Event>>) obj;
+			}
+		 
+				
+					Console.println("Number of sequences: " + sequences.size());
+
+					SimpleSequenceGenerator gen = new SimpleSequenceGenerator();
+					gen.generate(sequences);
+					gen.print();
+					GlobalDataContainer.getInstance().addData("numberSequences", gen);
+				
+
+				
+				
+				}
+			}
+
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#help()
+	 */
+	@Override
+    public String help() {
+                  return "generateSubstitutionMatrix <NumberSequencesName> {<algorithm>}";
+    }
+  
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDsequenceStats.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDsequenceStats.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDsequenceStats.java	(revision 2054)
@@ -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.plugin.alignment.commands;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Level;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
+import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
+import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
+import de.ugoe.cs.util.console.Command;
+import de.ugoe.cs.util.console.Console;
+import de.ugoe.cs.util.console.GlobalDataContainer;
+
+/**
+ * <p>
+ * Command to generate a binary alignment of two sequences
+ * </p>
+ * 
+ * @author Ralph Krimmel
+ * @version 1.0
+ */
+public class CMDsequenceStats implements Command {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#run(java.util.List)
+	 */
+	@SuppressWarnings("unchecked")
+	public void run(List<Object> parameters) {
+		String sequencesName = "sequences";
+		double standarddev = 0.0;
+		double mean = 0;
+		double median = 0;
+		double sum = 0;
+		
+		try {
+			sequencesName = (String) parameters.get(0);
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
+
+		Collection<List<Event>> sequences = new LinkedList<List<Event>>();
+		Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
+		if (obj != null) {
+		
+			if (obj.getClass().equals(sequences.getClass())) {
+				sequences = (Collection<List<Event>>) obj;
+			}
+
+		
+			Console.println("Number of sequences: " + sequences.size());
+			//Calculate the mean size
+			for(Iterator<List<Event>> iter = sequences.iterator();iter.hasNext();) {
+				sum += iter.next().size();
+	
+			}
+			mean = sum/sequences.size();
+			
+			
+			//Calculate the median
+			List<List<Event>> list = new ArrayList<List<Event>>(sequences);
+			Collections.sort(list,new SizeComparator());
+			
+			Console.println("Mean size: " +mean);
+			Console.println("Median size: " + list.get(Math.round(list.size()/2)).size());
+	
+		}
+	}
+
+	class SizeComparator implements Comparator<List<Event>> {
+	    @Override
+	    public int compare(List<Event> a, List<Event> b) {
+	        return a.size() < b.size() ? -1 : a.size() == b.size() ? 0 : 1;
+	    }
+	}
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see de.ugoe.cs.util.console.Command#help()
+	 */
+	@Override
+	public String help() {
+		return "sequenceStats <sequence name>";
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/NumberSequence.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/NumberSequence.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/NumberSequence.java	(revision 2054)
@@ -0,0 +1,28 @@
+package de.ugoe.cs.autoquest.plugin.alignment.seqgen;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+public class NumberSequence implements Serializable {
+	private int[] sequence;
+	private int signature;
+	
+	public NumberSequence(int size) {
+		
+		sequence = new int[size];
+	}
+	
+	public int[] getSequence() {
+		return sequence;
+	}
+	public void setSequence(int[] sequence) {
+		this.sequence = sequence;
+	}
+	public int getSignature() {
+		return signature;
+	}
+	public void setSignature(int signature) {
+		this.signature = signature;
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/RandomSequenceGenerator.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/RandomSequenceGenerator.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/RandomSequenceGenerator.java	(revision 2054)
@@ -0,0 +1,45 @@
+package de.ugoe.cs.autoquest.plugin.alignment.seqgen;
+import de.ugoe.cs.autoquest.eventcore.Event;
+
+import java.util.Collection;
+import java.util.List;
+
+public class RandomSequenceGenerator implements SequenceGenerator{
+
+	private int min;
+	private int max;
+	private int count;
+	
+	
+	public RandomSequenceGenerator(int min, int max, int count) {
+		this.min = min;
+		this.max = max;
+		this.count = count;
+	}
+	
+	public int[] generate(List<Event> eventList) {
+		int[] result = new int[count];
+		for (int i=0; i<count;i++) {
+			result[i]= min + (int)(Math.random() * ((max - min)) + 1);
+		}
+		return result;
+	}
+
+	@Override
+	public void generate(Collection<List<Event>> eventList) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public NumberSequence get(int index) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public int sequenceCount() {
+		return count;
+	}
+	
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SequenceGenerator.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SequenceGenerator.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SequenceGenerator.java	(revision 2054)
@@ -0,0 +1,17 @@
+package de.ugoe.cs.autoquest.plugin.alignment.seqgen;
+
+import java.util.Collection;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+
+public interface SequenceGenerator {
+	
+	public void generate(Collection<List<Event>> eventList);
+	public NumberSequence get(int index);
+	public int sequenceCount();
+	
+	
+	
+	
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SimpleSequenceGenerator.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SimpleSequenceGenerator.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/seqgen/SimpleSequenceGenerator.java	(revision 2054)
@@ -0,0 +1,98 @@
+package de.ugoe.cs.autoquest.plugin.alignment.seqgen;
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.autoquest.tasktrees.manager.TaskTreeManager;
+import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality;
+import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskHandlingStrategy;
+import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskInstanceComparator;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
+import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession;
+import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder;
+import de.ugoe.cs.autoquest.usageprofiles.SymbolMap;
+import de.ugoe.cs.util.console.Console;
+
+
+public class SimpleSequenceGenerator implements SequenceGenerator, Serializable {
+
+	private ArrayList<NumberSequence> numberseqs;
+
+
+	public SimpleSequenceGenerator() {
+		this.numberseqs = new ArrayList<NumberSequence>();
+	
+	}
+	
+	public void print() {
+		for (NumberSequence sequence : numberseqs) {
+				System.out.println(sequence.toString());
+		}
+		
+	}
+	
+	public void generate(Collection<List<Event>> sequences) {
+
+	
+		if (sequences != null) {
+			TaskTreeManager ttm = new TaskTreeManager();
+			
+			ttm.createTaskModel(sequences);
+			
+			TaskHandlingStrategy preparationTaskHandlingStrategy  = new TaskHandlingStrategy(TaskEquality.SEMANTICALLY_EQUAL);
+			SymbolMap<ITaskInstance, ITask> uniqueTasks = preparationTaskHandlingStrategy
+					.createSymbolMap();
+			TaskInstanceComparator comparator = preparationTaskHandlingStrategy
+					.getTaskComparator();
+			ITask task;
+			ITaskBuilder taskBuilder = new TaskBuilder();
+
+			List<IUserSession> sessions = ttm.getTaskModel().getUserSessions();
+			
+			for (IUserSession session : sessions) {
+				//Creating a new sequence that just consists of integers
+				NumberSequence templist = new NumberSequence(session.size()) ;
+				for (int i = 0; i < session.size(); i++) {
+					ITaskInstance taskInstance = session.get(i); 
+					task = uniqueTasks.getValue(taskInstance);
+
+					if (task == null) {
+						uniqueTasks.addSymbol(taskInstance,
+								taskInstance.getTask());
+				
+								templist.getSequence()[i]=taskInstance.getTask().getId();
+								
+					} else {
+						taskBuilder.setTask(taskInstance, task);
+						templist.getSequence()[i]=task.getId();
+						
+					}
+					
+				}
+				
+				comparator.clearBuffers();
+				numberseqs.add(templist);
+			}
+			
+		}
+
+	}
+
+
+	public NumberSequence get(int index) {
+		return numberseqs.get(index);
+	}
+
+
+	public int sequenceCount() {
+		return numberseqs.size();
+	}
+
+}
+	
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/DifferenceSubstitutionMatrix.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/DifferenceSubstitutionMatrix.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/DifferenceSubstitutionMatrix.java	(revision 2054)
@@ -0,0 +1,65 @@
+/**
+ * 
+ */
+package de.ugoe.cs.autoquest.plugin.alignment.substitution;
+
+import java.util.Collection;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+
+/**
+ * @author Ralph Krimmel
+ *
+ */
+public class DifferenceSubstitutionMatrix implements SubstitutionMatrix {
+
+	private int[] input1;
+	private int[] input2;
+	private int maxValue;
+	
+	public DifferenceSubstitutionMatrix(int[] input1,int[] input2) {
+		this.input1 = input1;
+		this.input2 = input2;
+		this.maxValue = getMaxValue();
+	}
+	
+	/* (non-Javadoc)
+	 * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int)
+	 */
+	public double getDistance(int pos1, int pos2) {
+		return maxValue - (input1[pos1] - input2[pos2]);
+	}
+	
+	private int getMaxValue() {
+		int max = input1[0];
+		for (int i=0; i < input1.length; i++) {
+			if(input1[i] > max) {
+				max = input1[i];
+			}
+		}
+		for (int j=0; j < input2.length; j++) {
+			if(input2[j] > max) {
+				max = input2[j];
+			}
+		}
+		return max;
+	}
+
+	@Override
+	public double getGapPenalty() {
+		return -maxValue;
+	}
+
+	@Override
+	public String info() {
+		return "Max Value: " + maxValue;
+	}
+
+	@Override
+	public void generate(Collection<List<Event>> eventList) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/NearbySubstitutionMatrix.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/NearbySubstitutionMatrix.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/NearbySubstitutionMatrix.java	(revision 2054)
@@ -0,0 +1,57 @@
+/**
+ * 
+ */
+package de.ugoe.cs.autoquest.plugin.alignment.substitution;
+
+import java.util.Collection;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+
+/**
+ * @author Ralph Krimmel
+ *
+ */
+public class NearbySubstitutionMatrix implements SubstitutionMatrix {
+
+	private int[] input1;
+	private int[] input2;
+	private int range;
+	
+	public NearbySubstitutionMatrix(int[] input1,int[] input2, int range) {
+		this.input1 = input1;
+		this.input2 = input2;
+		this.range = range;
+	}
+	
+	/* (non-Javadoc)
+	 * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int)
+	 */
+	public double getDistance(int pos1, int pos2) {
+		int difference = Math.abs(input1[pos1]-input2[pos2]); 
+		if(difference < range) {
+			return range-difference;
+		}
+		else {
+			return -range;
+		}
+	}
+
+
+	@Override
+	public double getGapPenalty() {
+		return -range-1;
+	}
+
+	@Override
+	public String info() {
+		return "Range: " + range;
+	}
+
+	@Override
+	public void generate(Collection<List<Event>> eventList) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/ObjectDistanceSubstitionMatrix.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/ObjectDistanceSubstitionMatrix.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/ObjectDistanceSubstitionMatrix.java	(revision 2054)
@@ -0,0 +1,68 @@
+package de.ugoe.cs.autoquest.plugin.alignment.substitution;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel;
+import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
+
+import java.util.List;
+
+import misc.AlignmentHelpers;
+import de.ugoe.cs.autoquest.eventcore.Event;
+import de.ugoe.cs.util.console.GlobalDataContainer;
+
+public class ObjectDistanceSubstitionMatrix implements SubstitutionMatrix {
+
+	private ArrayList<int[][]> matrix;
+	private int currentSequence;
+	
+	
+	public ObjectDistanceSubstitionMatrix() {
+		currentSequence = 0;
+		matrix = new ArrayList<int[][]>();
+	}
+	
+	@Override
+	public String info() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public double getDistance(int pos1, int pos2) {
+		// TODO Auto-generated method stub
+		
+		return matrix.get(currentSequence)[pos1][pos2];
+	}
+	
+	public double getDistance(int sequence, int pos1, int pos2) {
+		return  matrix.get(sequence)[pos1][pos2];
+		
+		
+	}
+
+	@Override
+	public double getGapPenalty() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public void generate(Collection<List<Event>> eventList) {
+		
+		for(Iterator<List<Event>> seqs = eventList.iterator(); seqs.hasNext();) {
+			matrix.add(new int[eventList.size()][eventList.size()]);
+			List<Event> tmpList = seqs.next();
+			
+			for (int i=0; i < tmpList.size(); i++) {
+				for (int j=0; j < tmpList.size(); j++) {
+					IGUIElement first = (IGUIElement) tmpList.get(i).getTarget();
+					IGUIElement second =(IGUIElement) tmpList.get(j).getTarget();
+					matrix.get(currentSequence)[i][j] = AlignmentHelpers.distanceBetween(first, second);
+				}
+			}			
+		}
+	}
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/SubstitutionMatrix.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/SubstitutionMatrix.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/SubstitutionMatrix.java	(revision 2054)
@@ -0,0 +1,18 @@
+package de.ugoe.cs.autoquest.plugin.alignment.substitution;
+
+import java.util.Collection;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.Event;
+
+public interface SubstitutionMatrix {
+
+	public String info();
+	
+	public double getDistance(int pos1, int pos2);
+
+	public double getGapPenalty();
+
+	public void generate(Collection<List<Event>> eventList);
+	
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/misc/AlignmentHelpers.java
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/misc/AlignmentHelpers.java	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/java/misc/AlignmentHelpers.java	(revision 2054)
@@ -0,0 +1,108 @@
+package misc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel;
+import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
+
+
+public class AlignmentHelpers extends GUIModel {
+	
+
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2593092958275693133L;
+
+	/**
+	 * <p>
+	 * return a common denominator for the provided list of GUI elements, i.e. a
+	 * GUI element, that is part of the parent GUI hiearchy of all GUI elements
+	 * in the list. If there is no common denominator, the method returns null.
+	 * </p>
+	 */
+	private static IGUIElement getCommonDenominator(List<IGUIElement> guiElements) {
+		IGUIElement commonDenominator = null;
+
+		if (guiElements.size() > 0) {
+			List<IGUIElement> commonDenominatorPath = new ArrayList<IGUIElement>();
+
+			// create a reference list using the first GUI element
+			IGUIElement guiElement = guiElements.get(0);
+			while (guiElement != null) {
+				// We can use every type
+				// if (guiElementMatchesConsideredTypes(guiElement)) {
+				commonDenominatorPath.add(0, guiElement);
+				// }
+				guiElement = guiElement.getParent();
+			}
+
+			if (commonDenominatorPath.size() == 0) {
+				return null;
+			}
+
+			// for each other GUI element, check the reference list for the
+			// first element in the
+			// path, that is not common to the current one, and delete it as
+			// well as it subsequent
+			// siblings
+			List<IGUIElement> currentPath = new ArrayList<IGUIElement>();
+			for (int i = 1; i < guiElements.size(); i++) {
+				currentPath.clear();
+				guiElement = guiElements.get(i);
+				while (guiElement != null) {
+					// if (guiElementMatchesConsideredTypes(guiElement)) {
+				    currentPath.add(0, guiElement);
+					// }
+					guiElement = guiElement.getParent();
+				}
+
+				// determine the index of the first unequal path element
+				int index = 0;
+				while ((index < commonDenominatorPath.size())
+						&& (index < currentPath.size())
+						&& commonDenominatorPath.get(index).equals(
+								currentPath.get(index))) {
+					index++;
+				}
+
+				// remove all elements from the common denonimator path, that do
+				// not match
+				while (index < commonDenominatorPath.size()) {
+					commonDenominatorPath.remove(index);
+				}
+			}
+
+			if (commonDenominatorPath.size() > 0) {
+				commonDenominator = commonDenominatorPath
+						.get(commonDenominatorPath.size() - 1);
+			}
+		}
+		return commonDenominator;
+	}
+
+	public static int distanceBetween(IGUIElement first, IGUIElement second) {
+
+		int hopcount1 = 0;
+		int hopcount2 = 0;
+		List<IGUIElement> tmp = new ArrayList<IGUIElement>();
+		tmp.add(first);
+		tmp.add(second);
+		IGUIElement commonDenominator = getCommonDenominator(tmp);
+		
+		while(!(first.equals(commonDenominator))) {
+			first = first.getParent();
+			hopcount1++;
+		}
+		
+		while(!(second.equals(commonDenominator))) {
+			second = second.getParent();
+			hopcount2++;
+		}
+
+		return hopcount1 + hopcount2;
+	}
+
+}
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgTestCasesToSequences
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgTestCasesToSequences	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgTestCasesToSequences	(revision 2054)
@@ -0,0 +1,10 @@
+Loads GUITAR test cases from a directory and treats each test case as a sequence. The result is a collection of sequences.
+
+$USAGE$
+<directory> name of the directory
+<sequencesName> name of the sequences
+<guiFileName> optional; if specified, this GUI file is used to retrieve widgetIds in addtion to the eventIds
+
+Example(s):
+efgTestCasesToSequences testcaseDir sequences
+efgTestCasesToSequences testcaseDir sequences guifile.gui 
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgToDFA
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgToDFA	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgToDFA	(revision 2054)
@@ -0,0 +1,8 @@
+Loads a GUITAR EFG file and creates a DFA based on the contents.
+
+$USAGE$
+<filename> name of the efg file
+<modelname> name of the DFA
+
+Example(s):
+efgToDFA efgfile.efg dfa
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgToMM
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgToMM	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/src/main/resources/manuals/efgToMM	(revision 2054)
@@ -0,0 +1,8 @@
+Loads a GUITAR EFG file and creates a first-order Markov model based on the contents. All transitions in the Markov model are equally probable.
+
+$USAGE$
+<filename> name of the efg file
+<modelname> name of the Markov model
+
+Example(s):
+efgToMM efgfile.efg markovModel
Index: /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/target/maven-archiver/pom.properties
===================================================================
--- /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/target/maven-archiver/pom.properties	(revision 2054)
+++ /trunk/deprecated/master-thesis-rkrimmel/autoquest-plugin-alignment/target/maven-archiver/pom.properties	(revision 2054)
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed Nov 06 00:13:59 CET 2013
+version=0.0.1-SNAPSHOT
+groupId=de.ugoe.cs.autoquest
+artifactId=autoquest-plugin-alignment
