Changeset 2126 for trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality
- Timestamp:
- 05/03/16 17:06:33 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRule.java
r1887 r2126 43 43 import de.ugoe.cs.autoquest.eventcore.guimodel.IText; 44 44 import de.ugoe.cs.autoquest.eventcore.guimodel.IToolTip; 45 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 45 46 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 46 47 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; … … 68 69 @Override 69 70 public boolean isApplicable(ITask task1, ITask task2) { 70 for (ITaskInstance instance : task1.getInstances()) { 71 if ((!(instance instanceof IEventTaskInstance)) || 72 (!(((IEventTaskInstance) instance).getEvent().getType() instanceof IInteraction))) 73 { 74 return false; 75 } 76 } 77 78 for (ITaskInstance instance : task2.getInstances()) { 79 if ((!(instance instanceof IEventTaskInstance)) || 80 (!(((IEventTaskInstance) instance).getEvent().getType() instanceof IInteraction))) 81 { 82 return false; 83 } 71 if (!(task1 instanceof IEventTask)) { 72 return false; 73 } 74 75 if (!(task2 instanceof IEventTask)) { 76 return false; 77 } 78 79 IEventTaskInstance instance1 = (IEventTaskInstance) task1.getInstances().iterator().next(); 80 81 if (!(instance1.getEvent().getType() instanceof IInteraction)) { 82 return false; 83 } 84 85 IEventTaskInstance instance2 = (IEventTaskInstance) task2.getInstances().iterator().next(); 86 87 if (!(instance2.getEvent().getType() instanceof IInteraction)) { 88 return false; 84 89 } 85 90 … … 178 183 Collection<ITaskInstance> taskInstances1 = task1.getInstances(); 179 184 Collection<ITaskInstance> taskInstances2 = task2.getInstances(); 185 186 if (taskInstances1.size() > taskInstances2.size()) { 187 // it may be the case, that all instances of first task match already the first instance 188 // of the second task. In this case, the below for loops would iterate of all instances 189 // of the first task but the internal loop would always break. But if the first task 190 // has many more instances than the second task, performing the comparison the other 191 // way around would result in less comparisons. Hence, we switch the task instance lists 192 // to have fewer comparisons. 193 Collection<ITaskInstance> tmp = taskInstances1; 194 taskInstances1 = taskInstances2; 195 taskInstances2 = tmp; 196 } 180 197 181 198 TaskEquality checkedEquality =
Note: See TracChangeset
for help on using the changeset viewer.