Changeset 1676 for branches/autoquest-core-tasktrees-alignment
- Timestamp:
- 08/14/14 09:08:50 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java
r1675 r1676 21 21 private SymbolMap<ITaskInstance, ITask> uniqueTasks; 22 22 private double gapPenalty; 23 private int index = 0; 23 24 24 25 private double positiveThreshold; … … 44 45 45 46 public void generate() { 46 47 int index = 0;48 47 49 float maxDistance =34;50 48 for (Iterator<ITaskInstance> it = uniqueTasks.getSymbols().iterator(); it 51 49 .hasNext();) { … … 53 51 IEventTaskInstance eti1 = null; 54 52 if (obj1 instanceof IEventTaskInstance) { 53 System.out.println(obj1); 55 54 eti1 = (IEventTaskInstance) obj1; 56 55 } 57 56 else { 58 57 //System.out.println("Not an EventTaskInstance"); 58 //System.out.println(obj1); 59 59 continue; 60 60 } … … 69 69 else{ 70 70 //System.out.println("Not an EventtaskInstance"); 71 //System.out.println(obj1); 71 72 continue; 72 73 } 73 IGUIElement first = (IGUIElement) eti1.getEvent().getTarget(); 74 IGUIElement second = (IGUIElement) eti2.getEvent().getTarget(); 75 int tempindex1 = -1; 76 int tempindex2 = -1; 77 if(!idmapping.containsKey(eti1.getTask().getId())) 78 { 79 idmapping.put(eti1.getTask().getId(), index); 80 tempindex1 = index; 81 index++; 82 } 83 else 84 { 85 tempindex1 = idmapping.get(eti1.getTask().getId()); 86 } 87 if(!idmapping.containsKey(eti2.getTask().getId())) 88 { 89 idmapping.put(eti2.getTask().getId(), index); 90 tempindex2 = index; 91 index++; 92 } 93 else 94 { 95 tempindex2 = idmapping.get(eti2.getTask().getId()); 96 } 97 float distance = -1*AlignmentHelpers.distanceBetween(first, second); 98 99 100 if(distance > maxDistance){ 101 maxDistance = distance; 102 } 103 104 distance += positiveThreshold; 105 106 107 108 matrix.set(tempindex1, tempindex2,distance); 74 75 matrix.set(getIndex(eti1), getIndex(eti2),distanceBetweenInstances(eti1,eti2)); 109 76 110 77 } 111 78 } 79 } 80 81 private int getIndex(IEventTaskInstance eti) { 82 int tempindex = -1; 83 if(!idmapping.containsKey(eti.getTask().getId())) 84 { 85 idmapping.put(eti.getTask().getId(), index); 86 tempindex = index; 87 index++; 88 } 89 else 90 { 91 tempindex = idmapping.get(eti.getTask().getId()); 92 } 93 return tempindex; 94 } 95 96 private float distanceBetweenInstances(IEventTaskInstance eti1, IEventTaskInstance eti2) { 97 IGUIElement first = (IGUIElement) eti1.getEvent().getTarget(); 98 IGUIElement second = (IGUIElement) eti2.getEvent().getTarget(); 99 float distance = -1*AlignmentHelpers.distanceBetween(first, second); 100 distance += positiveThreshold; 101 return distance; 112 102 } 113 103
Note: See TracChangeset
for help on using the changeset viewer.