Index: branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java
===================================================================
--- branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java	(revision 1676)
+++ branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java	(revision 1677)
@@ -46,51 +46,94 @@
 	public void generate() {
 		
+		int index1=-1;
+		int index2=-1;
+		float distance=0;
 		for (Iterator<ITaskInstance> it = uniqueTasks.getSymbols().iterator(); it
 				.hasNext();) {
 			Object obj1 = it.next();
-			IEventTaskInstance eti1 = null;
-			if (obj1 instanceof IEventTaskInstance) {
-				System.out.println(obj1);
-				eti1 = (IEventTaskInstance) obj1;
-			}
-			else {
-				//System.out.println("Not an EventTaskInstance");
-				//System.out.println(obj1);
-				continue;
-			}
-		
 			for (Iterator<ITaskInstance> jt = uniqueTasks.getSymbols()
 					.iterator(); jt.hasNext();) {
+			
+				IEventTaskInstance eti1 = null;
+				ITask task1 = null;
+				
 				IEventTaskInstance eti2 = null;
+				ITask task2 = null;
+				
 				Object obj2 = jt.next();
-				if (obj2 instanceof IEventTaskInstance) {
+				
+				if (obj1 instanceof IEventTaskInstance && obj2 instanceof IEventTaskInstance) {
+					eti1 = (IEventTaskInstance) obj1;
+					index1 = getIndex(eti1);
 					eti2 = (IEventTaskInstance) obj2;
+					index2 = getIndex(eti2);
+					distance = distanceBetweenInstances(eti1,eti2);
 				}
-				else{
-					//System.out.println("Not an EventtaskInstance");
-					//System.out.println(obj1);
-					continue;
+				else if(obj1 instanceof IEventTaskInstance &&  !(obj2 instanceof IEventTaskInstance)) {
+					task2 = ((ITaskInstance) obj2).getTask();
+					index2 = getIndex(task2);
+					eti1 = (IEventTaskInstance) obj1;
+					index1 = getIndex(eti1);
+					distance = distanceBetweenTaskAndInstance(task2,eti1);
 				}
-		
-				matrix.set(getIndex(eti1), getIndex(eti2),distanceBetweenInstances(eti1,eti2));
+				else if(!(obj1 instanceof IEventTaskInstance) && obj2 instanceof IEventTaskInstance) {
+					task1 = ((ITaskInstance) obj1).getTask();
+					index1 = getIndex(task1);
+					eti2 = (IEventTaskInstance) obj2;
+					index2 = getIndex(eti2);
+					distance = distanceBetweenTaskAndInstance(task1,eti2);
+				}
+				else if(!(obj2 instanceof IEventTaskInstance) && !(obj2 instanceof IEventTaskInstance)) {
+					task1 = ((ITaskInstance) obj1).getTask();
+					index1 = getIndex(task1);
+					task2 = ((ITaskInstance) obj2).getTask();
+					index2 = getIndex(task2);
+					distance = distanceBetweenTasks(task1,task2);
+				}
+				else {
+					System.out.println("Unknown error");
+				}
+				
+				matrix.set(index1, index2,distance);
 	
 			}
 		}
 	}
+
+	
+	private float distanceBetweenTaskAndInstance(ITask task1, IEventTaskInstance eti) {
+		return 0;
+	}
+	
+	private float distanceBetweenTasks(ITask task1, ITask task2) {
+		return 0;
+	}
+
+
+	private int getIndex(ITask task) {
+		int tempindex =-1;
+		if(!idmapping.containsKey(task.getId())) {
+			idmapping.put(task.getId(), index);
+			tempindex = index;
+			index++;
+		}
+		else {
+			tempindex = idmapping.get(task.getId());
+		}
+		return tempindex;
+	}
 	
 	private int getIndex(IEventTaskInstance eti) {
 		int tempindex = -1;
-		if(!idmapping.containsKey(eti.getTask().getId()))
-		{
+		if(!idmapping.containsKey(eti.getTask().getId())) {
 			idmapping.put(eti.getTask().getId(), index);
 			tempindex = index;
 			index++;
 		}	
-		else 
-		{
+		else {
 			tempindex = idmapping.get(eti.getTask().getId());
 		}
 		return tempindex;
-	}
+	};
 	
 	private float distanceBetweenInstances(IEventTaskInstance eti1, IEventTaskInstance eti2)  {
@@ -111,5 +154,9 @@
 		} 
 		else {
-			return matrix.get(idmapping.get(taskId1),idmapping.get(taskId2));	
+			int first = idmapping.get(taskId1);
+			int second = idmapping.get(taskId2);
+			System.out.println("First: " + first + " Second: " + second);
+			System.out.println("Matrix: " + matrix.get(first, second));
+			return matrix.get(first,second);	
 		}
 		
