Changeset 2126 for trunk/autoquest-core-tasktrees/src/main/java/de/ugoe
- Timestamp:
- 05/03/16 17:06:33 (9 years ago)
- Location:
- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 3 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 = -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/utils/SimilarTasks.java
r1980 r2126 1301 1301 */ 1302 1302 private boolean isInefficientAction(ITask task) { 1303 ITaskInstance inst = task.getInstances().iterator().next(); 1304 1305 if ((inst instanceof IEventTaskInstance) && 1306 (((IEventTaskInstance) inst).getEvent().getType() instanceof Scroll)) 1307 { 1308 return true; 1303 if (task instanceof IEventTask) { 1304 IEventTaskInstance inst = (IEventTaskInstance) task.getInstances().iterator().next(); 1305 if (inst.getEvent().getType() instanceof Scroll) { 1306 return true; 1307 } 1308 else { 1309 return false; 1310 } 1309 1311 } 1310 1312 else if (task instanceof IMarkingTemporalRelationship) { -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Task.java
r1400 r2126 81 81 * </p> 82 82 */ 83 private Collection<ITaskInstance> instances = new HashSet<ITaskInstance>(); 83 private final Collection<ITaskInstance> instances = new HashSet<ITaskInstance>(); 84 85 /** 86 * <p> 87 * the unmodifiable view on the instances of this task 88 * </p> 89 */ 90 private final Collection<ITaskInstance> unmodifiableInstances; 84 91 85 92 /** … … 107 114 throw new IllegalArgumentException("type must not be null"); 108 115 } 116 117 unmodifiableInstances = Collections.unmodifiableCollection(instances); 109 118 } 110 119 … … 154 163 @Override 155 164 public Collection<ITaskInstance> getInstances() { 156 return Collections.unmodifiableCollection(instances);165 return unmodifiableInstances; 157 166 } 158 167
Note: See TracChangeset
for help on using the changeset viewer.