Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Constants.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Constants.java	(revision 1578)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Constants.java	(revision 1578)
@@ -0,0 +1,8 @@
+package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms;
+
+public class Constants {
+	
+	public static final int GAP_SYMBOL = -1;
+	public static final int UNMATCHED_SYMBOL = -2;
+
+}
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java	(revision 1578)
@@ -97,5 +97,5 @@
 		// return (input1[i - 1] == input2[j - 1]) ? MATCH_SCORE :
 		// MISMATCH_SCORE;
-		return submat.getDistance(input1[i - 1], input2[j - 1]);
+		return submat.getScore(input1[i - 1], input2[j - 1]);
 	}
 
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java	(revision 1578)
@@ -2,10 +2,9 @@
 
 import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.logging.Level;
 
 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix;
+import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants;
 import de.ugoe.cs.util.console.Console;
 
@@ -79,5 +78,5 @@
 	 */
 	private double similarity(int i, int j) { 
-		return submat.getDistance(input1[i - 1], input2[j - 1]);
+		return submat.getScore(input1[i - 1], input2[j - 1]);
 	}
 
@@ -129,5 +128,4 @@
 
 			}
-			
 					
 			tempMax -= scoreThreshold;
@@ -145,5 +143,5 @@
 			{
 				matrix[i][0].setXvalue(input1[i-1]);
-				matrix[i][0].setYvalue(-2);
+				matrix[i][0].setYvalue(Constants.UNMATCHED_SYMBOL);
 			}
 			else { 
@@ -161,5 +159,5 @@
 
 				// find the directions that give the maximum scores.
-				// Multiple directions are ignored TODO
+				// TODO: Multiple directions are ignored, we choose the first maximum score 
 				//True if we had a match
 				if (diagScore == matrix[i][j].getScore()) {
@@ -171,10 +169,10 @@
 				if (leftScore == matrix[i][j].getScore()) {
 					matrix[i][j].setXvalue(input1[i-1]);
-					matrix[i][j].setYvalue(-1);
+					matrix[i][j].setYvalue(Constants.GAP_SYMBOL);
 					matrix[i][j].setPrevious(matrix[i-1][j]);
 				}
 				//true if we took an event from sequence y and not from x
 				if (upScore == matrix[i][j].getScore()) {
-					matrix[i][j].setXvalue(-1);
+					matrix[i][j].setXvalue(Constants.GAP_SYMBOL);
 					matrix[i][j].setYvalue(input2[j-1]);
 					matrix[i][j].setPrevious(matrix[i][j-1]);
@@ -184,5 +182,5 @@
 					matrix[i][j].setPrevious(matrix[i][0]);
 					matrix[i][j].setXvalue(input1[i-1]);
-					matrix[i][j].setYvalue(-2);
+					matrix[i][j].setYvalue(Constants.UNMATCHED_SYMBOL);
 				}
 			}
@@ -271,8 +269,8 @@
 			String append2="";
 					
-			if(tmp.getXvalue() == -1) {
+			if(tmp.getXvalue() == Constants.GAP_SYMBOL) {
 				append1 = "  ___";
 			}
-			else if(tmp.getXvalue() == -2) {
+			else if(tmp.getXvalue() == Constants.UNMATCHED_SYMBOL) {
 				append1 = "  ...";
 			}
@@ -281,8 +279,8 @@
 			}
 
-			if(tmp.getYvalue() == -1) {
+			if(tmp.getYvalue() == Constants.GAP_SYMBOL) {
 				append2 = "  ___";
 			}
-			else if(tmp.getYvalue() == -2) {
+			else if(tmp.getYvalue() == Constants.UNMATCHED_SYMBOL) {
 				append2 = "  ...";
 			}
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DifferenceSubstitutionMatrix.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DifferenceSubstitutionMatrix.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DifferenceSubstitutionMatrix.java	(revision 1578)
@@ -29,5 +29,5 @@
 	 * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int)
 	 */
-	public double getDistance(int pos1, int pos2) {
+	public double getScore(int pos1, int pos2) {
 		return maxValue - (input1[pos1] - input2[pos2]);
 	}
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java	(revision 1578)
@@ -29,5 +29,5 @@
 	 * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int)
 	 */
-	public double getDistance(int pos1, int pos2) {
+	public double getScore(int pos1, int pos2) {
 		int difference = Math.abs(input1[pos1]-input2[pos2]); 
 		if(difference < range) {
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java	(revision 1578)
@@ -5,7 +5,7 @@
 import java.util.Iterator;
 
-
 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentHelpers;
+import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance;
 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
@@ -40,8 +40,7 @@
 	@Override
 	public void generate() {
+	
 		int index = 0;
-		//TODO We need to determine this parameter before generating the matrix..
-		//float meandistance = 18;
-		//TODO We need to determine this parameter before generating the matrix..
+		
 		float maxDistance =34;
 		for (Iterator<ITaskInstance> it = uniqueTasks.getSymbols().iterator(); it
@@ -52,5 +51,4 @@
 				eti1 = (IEventTaskInstance) obj1;
 			}
-			//System.out.println(eti1.getTask().toString());
 		
 			for (Iterator<ITaskInstance> jt = uniqueTasks.getSymbols()
@@ -97,11 +95,12 @@
 				
 				matrix.set(tempindex1, tempindex2,distance);
-				
+	
 			}
 		}
-		//System.out.println("ObjectDistanceMatrix: MaxDistance: " + maxDistance);
+		
 		//System.out.println(meandistance/(uniqueTasks.size()*uniqueTasks.size()));
 		//System.out.println(idmapping.toString());
 		//System.out.println(matrix.toString());
+		//System.out.println("ObjectDistanceMatrix: MaxDistance: " + maxDistance);
 		//System.out.println(idmapping.keySet().toString());
 		//System.out.println(idmapping.values().toString());
@@ -113,8 +112,12 @@
 	}
 
-	@Override
-	public double getDistance(int taskId1, int taskId2) {
-		//System.out.println("Taskid1: " + taskId1 + " Taskid2: " + taskId2 + " Idmapping1: " + idmapping.get(taskId1) + " Idmapping2: " + idmapping.get(taskId2));
-		return matrix.get(idmapping.get(taskId1),idmapping.get(taskId2));
+	public double getScore(int taskId1, int taskId2) {
+		if(taskId1 == Constants.GAP_SYMBOL || taskId1 == Constants.UNMATCHED_SYMBOL || taskId2 == Constants.GAP_SYMBOL || taskId2 == Constants.UNMATCHED_SYMBOL ) {
+			return 0.0; 
+		} 
+		else {
+			return matrix.get(idmapping.get(taskId1),idmapping.get(taskId2));	
+		}
+		
 	}
 
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/SubstitutionMatrix.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/SubstitutionMatrix.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/SubstitutionMatrix.java	(revision 1578)
@@ -6,5 +6,5 @@
 	
 
-	public double getDistance(int pos1, int pos2);
+	public double getScore(int pos1, int pos2);
 
 	public double getGapPenalty();
Index: /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
===================================================================
--- /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1577)
+++ /branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java	(revision 1578)
@@ -63,9 +63,5 @@
  * </p>
  * <p>
- * For determining the longest sequence occurring most often, the implementation
- * uses a {@link Trie}. The depth of the tree is initially 3. If the algorithm
- * has a longest sequence occurring most often whose length is equal to the
- * depth of the trie, it recalculates the trie with an increased depth.
- * </p>
+
  * 
  * @author Patrick Harms
@@ -183,13 +179,13 @@
 							ns2.getSequence(), ns2.getSequence(), submat,
 							smithWatermanThreshold);
-					
 					SmithWatermanRepeated randomSequence = new SmithWatermanRepeated(
 							ns1.shuffle().getSequence(),ns2.shuffle().getSequence(),submat,smithWatermanThreshold);
 					
+					// Score of the aligmnment
 					double score = twoSequences.getAlignmentScore();
-					// Scores of the sequence being aligned to itself
+					// Scores of the sequence being aligned to itself (maximum score)
 					double sSelf1 = sameSequence1.getAlignmentScore();
 					double sSelf2 = sameSequence2.getAlignmentScore();
-
+					// Score of sequences shuffled before aligned  
 					double sRand = randomSequence.getAlignmentScore();
 
@@ -210,10 +206,10 @@
 			}
 		}
+		//System.out.println(sequenceDistances.toString());
 		UPGMATree guidetree = new UPGMATree(numberseqs, sequenceDistances);
 		
+	
 		/*
 		do {
-			System.out.println();
-			//FengDoolittle fd = new FengDoolittle();
 
 			// appData.getStopWatch().start("whole loop");
