Changeset 1854 for trunk/autoquest-core-tasktrees/src/main/java/de
- Timestamp:
- 12/23/14 11:45:51 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/CondenseSimilarTasksRule.java
r1767 r1854 15 15 package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 16 16 17 import java.io.PrintStream;18 17 import java.util.ArrayList; 19 18 import java.util.Collection; … … 23 22 import java.util.List; 24 23 import java.util.Map; 25 import java.util.logging.Level;26 24 27 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; … … 38 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 39 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 40 import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship;41 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 42 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; … … 192 189 193 190 do { 194 //System.out.println("recreating task model");195 191 appData.setTaskModel(taskFactory.createTaskModel(sessions)); 196 192 appData.setMostSimilarTasks(null); 193 194 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 195 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>> 196 // for (ITask task : appData.getTaskModel().getTasks()) { 197 // if (task.getInstances().size() <= 0) { 198 // throw new RuntimeException("task " + task + " has no instances anymore"); 199 // } 200 // 201 // try { 202 // new TaskTreeValidator().validate(task); 203 // } 204 // catch (Exception e) { 205 // new TaskTreeEncoder().encode(task, System.err); 206 // } 207 // } 208 // 209 // new TaskTreeValidator().validate(sessions); 210 211 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 212 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<< 213 197 214 198 215 Console.println("condensing " + appData.getTaskModel().getTasks().size() + " tasks"); … … 201 218 202 219 if (appData.getMostSimilarTasks() != null) { 203 /*System.out.println("*************************************************************");204 System.out.println("handling " + appData.getMostSimilarTasks().size() +205 " most similar tasks");206 System.out.println("*************************************************************");*/207 220 for (SimilarTasks mostSimilarTask : appData.getMostSimilarTasks()) { 208 221 handleSimilarTasks(mostSimilarTask, appData); … … 212 225 } 213 226 214 harmonizeEqualMarkingTemporalRelationships(appData);215 227 } 216 228 while (appData.getMostSimilarTasks() != null); … … 266 278 Iterator<ITask> taskIterator = allTasks.iterator(); 267 279 List<ITask> taskList = new ArrayList<ITask>(allTasks.size()); 280 268 281 while (taskIterator.hasNext()) { 269 282 ITask task = taskIterator.next(); 270 283 271 if ((task instanceof IStructuringTemporalRelationship)/* &&272 (!appData.isSelfCreatedTask(task))*/)273 {284 // only Sequences need to be compared with each other. Iterations differ only in their 285 // child, i.e., in the child sequences. 286 if (task instanceof ISequence) { 274 287 taskList.add(task); 275 288 } … … 295 308 // discarding tasks in preceding merges. 296 309 297 // similarTasks.dump(System.out);310 // similarTasks.dump(System.out); 298 311 299 312 if ((similarTasks.getLeftHandSide().getInstances().size() <= 0) || … … 313 326 (similarTasks, identTaskHandlStrat.getTaskComparator()); 314 327 315 //similarTasks.dump(System.out); 328 if (similarTasks == null) { 329 // this may happen, if no mergable level of similarity can be found 330 return; 331 } 332 333 // similarTasks.dump(System.out); 316 334 317 335 List<FlattenInstruction> flattenInstructions = 318 336 getFlattenInstructions(similarTasks, appData); 319 337 320 for (FlattenInstruction instruction : flattenInstructions) {321 instruction.dump(System.out);322 }338 // for (FlattenInstruction instruction : flattenInstructions) { 339 // instruction.dump(System.out); 340 // } 323 341 324 342 int noOfFlattenedInstances = similarTasks.getLeftHandSide().getInstances().size() + … … 330 348 331 349 for (FlattenInstruction instruction : flattenInstructions) { 332 System.out.println("exclude " + instruction.path);350 //System.out.println("exclude " + instruction.path); 333 351 excludes.add(instruction.path); 334 352 } … … 343 361 (similarTasks.getRightHandSide(), flattenInstructions, flattenedSessions, excludes); 344 362 363 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 364 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>> 345 365 /*for (IUserSession session : flattenedSessions.values()) { 346 new TaskTreeEncoder().encode(session, System.out); 366 System.out.println("user session {"); 367 368 for (ITaskInstance instance : session) { 369 System.out.println(instance); 370 } 371 372 System.out.println("}"); 347 373 }*/ 374 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 375 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 348 376 349 377 List<IUserSession> flattenedSessionList = … … 354 382 355 383 Map<ITaskInstance, ITaskInstance> replacements = new HashMap<ITaskInstance, ITaskInstance>(); 384 ITask replacementTask = null; 385 356 386 for (Map.Entry<ITaskInstance, IUserSession> entry : flattenedSessions.entrySet()) { 357 358 359 387 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 360 388 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>> 361 389 // the user sessions were sufficiently equal to have now only one common task as child 390 362 391 if (entry.getValue().size() != 1) { 363 392 //new TaskTreeEncoder().encode(entry.getValue(), System.out, excludes); 364 393 throw new RuntimeException("flattened sessions were not combined as expected"); 365 394 } 395 396 if (replacementTask == null) { 397 replacementTask = entry.getValue().get(0).getTask(); 398 } 399 else if (replacementTask != entry.getValue().get(0).getTask()) { 400 throw new RuntimeException("two separate replacement tasks were calculated as " + 401 "replacement, one for both tasks to be merged"); 402 } 403 366 404 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 367 405 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 368 406 369 370 407 replacements.put(entry.getKey(), entry.getValue().get(0)); 371 408 } 372 373 409 374 410 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 375 411 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEST IMPLEMENTATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 412 // ((Task) replacementTask).setDescription 413 // (replacementTask + " calculated as full replacement for " + 414 // similarTasks.getLeftHandSide() + " and " + similarTasks.getRightHandSide()); 415 376 416 int allInstances = similarTasks.getLeftHandSide().getInstances().size() + 377 417 similarTasks.getRightHandSide().getInstances().size(); … … 390 430 // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< TEST IMPLEMENTATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 391 431 432 // create also replacements for potential parent iterations or optionals 433 IIteration harmonizedIteration = taskFactory.createNewIteration(); 434 taskBuilder.setMarkedTask(harmonizedIteration, replacementTask); 435 436 IOptional harmonizedOptional = taskFactory.createNewOptional(); 437 taskBuilder.setMarkedTask(harmonizedOptional, replacementTask); 392 438 393 439 for (IUserSession session : appData.getSessions()) { 394 replaceTaskInstances(session, replacements, similarTasks); 440 replaceTaskInstances(session, replacements, similarTasks, 441 harmonizedIteration, harmonizedOptional); 442 443 // several subsequent instances, which had formerly different tasks, may now have the 444 // same. Hence, they need to be merged. But as everything else would be way too complex, 445 // we only perform the merge, if they occur next to each other on the same level 446 mergeSubsequentIdenticalMarkingTemporalRelationships(session); 395 447 } 396 448 … … 420 472 421 473 List<FlattenInstruction> result = new LinkedList<FlattenInstruction>(); 422 Task InstanceComparator comp = identTaskHandlStrat.getTaskComparator();474 TaskComparator comp = identTaskHandlStrat.getTaskComparator(); 423 475 424 476 // first create instructions for the deltas … … 427 479 (delta.getType() == Delta.TYPE.DELETE)) 428 480 { 481 // System.out.println("handling " + delta.getType()); 429 482 Chunk chunk; 430 483 TaskPath insertAfterPath = null; … … 434 487 chunk = delta.getRevised(); 435 488 int pos = delta.getOriginal().getPosition(); 489 // System.out.println(" position " + pos); 490 436 491 if (pos > 0) { 437 492 insertAfterPath = leftHandSideTraversal.getTraversalPaths()[pos - 1]; … … 457 512 optional = taskFactory.createNewOptional(); 458 513 taskBuilder.setMarkedTask(optional, child); 514 // ((Task) optional).setDescription(optional.getDescription() + 515 // " created for " + delta.getType()); 459 516 optional = (IOptional) appData.ensureUnique(optional); 460 517 createReplacementInstructions(chunk, optional, null, result); … … 553 610 // of the children as variants 554 611 selection = taskFactory.createNewSelection(); 612 // ((Task) selection).setDescription(selection.getDescription() + 613 // " created for " + delta.getType()); 555 614 taskBuilder.addChild(selection, child1); 556 615 taskBuilder.addChild(selection, child2); … … 668 727 else { 669 728 ISequence task = taskFactory.createNewSequence(); 670 729 // ((Task) task).setDescription(task.getDescription() + 730 // " created to represent a chunk"); 731 671 732 for (Object pathObj : chunk.getLines()) { 672 733 TaskPath path = (TaskPath) pathObj; … … 736 797 boolean instructionApplied = false; 737 798 738 Task InstanceComparator comp = identTaskHandlStrat.getTaskComparator();799 TaskComparator comp = identTaskHandlStrat.getTaskComparator(); 739 800 740 801 //System.out.println("applying instructions on " + taskPath); … … 743 804 if (instruction.matches(taskPath)) { 744 805 //System.out.print("found instruction "); 745 instruction.dump(System.out);806 //instruction.dump(System.out); 746 807 747 808 switch (instruction.getInstruction()) { … … 998 1059 private void replaceTaskInstances(ITaskInstanceList taskInstanceList, 999 1060 Map<ITaskInstance, ITaskInstance> replacements, 1000 SimilarTasks similarTasks) 1061 SimilarTasks similarTasks, 1062 IIteration harmonizedIteration, 1063 IOptional harmonizedOptional) 1001 1064 { 1002 1065 for (int i = 0; i < taskInstanceList.size(); i++) { … … 1006 1069 if (replacement != null) { 1007 1070 1008 // update the model 1071 // update the model for sequences (others are updated in the calling method) 1009 1072 if (taskInstanceList instanceof ISequenceInstance) { 1010 1073 ISequence task = ((ISequenceInstance) taskInstanceList).getSequence(); 1011 1074 taskBuilder.setChild(task, i, replacement.getTask()); 1012 }1013 else if (taskInstanceList instanceof IIterationInstance) {1014 taskBuilder.setMarkedTask1015 (((IIterationInstance) taskInstanceList).getIteration(),1016 replacement.getTask());1017 1075 } 1018 1076 … … 1023 1081 discardTaskInstancesNotBelongingToTraversals(childInstance, path, similarTasks); 1024 1082 } 1025 else if (childInstance instanceof ITaskInstanceList) { 1026 replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks); 1027 } 1028 else if (childInstance instanceof IOptionalInstance) { 1029 replaceTaskInstances((IOptionalInstance) childInstance, replacements, similarTasks); 1030 } 1031 else if (childInstance instanceof ISelectionInstance) { 1032 replaceTaskInstances((ISelectionInstance) childInstance, replacements, similarTasks); 1083 else { 1084 ITask modelUpdate = replaceTaskInstances(childInstance, replacements, similarTasks, 1085 harmonizedIteration, harmonizedOptional); 1086 1087 if (modelUpdate != null) { 1088 if (taskInstanceList instanceof ISequenceInstance) { 1089 taskBuilder.setChild 1090 (((ISequenceInstance) taskInstanceList).getSequence(), i, modelUpdate); 1091 } 1092 } 1033 1093 } 1034 1094 } … … 1040 1100 private void replaceTaskInstances(IOptionalInstance optionalInstance, 1041 1101 Map<ITaskInstance, ITaskInstance> replacements, 1042 SimilarTasks similarTasks) 1102 SimilarTasks similarTasks, 1103 IIteration harmonizedIteration, 1104 IOptional harmonizedOptional) 1043 1105 { 1044 1106 ITaskInstance childInstance = optionalInstance.getChild(); … … 1048 1110 1049 1111 if (replacement != null) { 1050 1051 // update the model 1052 taskBuilder.setMarkedTask(optionalInstance.getOptional(), replacement.getTask()); 1112 // do not update the model --> is updated in the calling method 1053 1113 1054 1114 // perform the actual replacement and throw away the instance … … 1058 1118 discardTaskInstancesNotBelongingToTraversals(childInstance, path, similarTasks); 1059 1119 } 1060 else if (childInstance instanceof ITaskInstanceList) { 1061 replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks); 1062 } 1063 else if (childInstance instanceof ISelectionInstance) { 1064 replaceTaskInstances((ISelectionInstance) childInstance, replacements, similarTasks); 1065 } 1066 else if (childInstance instanceof IOptionalInstance) { 1067 throw new IllegalArgumentException 1068 ("optional must not have an optional as its child"); 1120 else { 1121 ITask modelUpdate = replaceTaskInstances(childInstance, replacements, similarTasks, 1122 harmonizedIteration, harmonizedOptional); 1123 1124 if (modelUpdate != null) { 1125 taskBuilder.setMarkedTask(optionalInstance.getOptional(), modelUpdate); 1126 } 1069 1127 } 1070 1128 } … … 1076 1134 private void replaceTaskInstances(ISelectionInstance selectionInstance, 1077 1135 Map<ITaskInstance, ITaskInstance> replacements, 1078 SimilarTasks similarTasks) 1136 SimilarTasks similarTasks, 1137 IIteration harmonizedIteration, 1138 IOptional harmonizedOptional) 1079 1139 { 1080 Task InstanceComparator comparator = identTaskHandlStrat.getTaskComparator();1140 TaskComparator comparator = identTaskHandlStrat.getTaskComparator(); 1081 1141 1082 1142 ITaskInstance childInstance = selectionInstance.getChild(); … … 1116 1176 discardTaskInstancesNotBelongingToTraversals(childInstance, path, similarTasks); 1117 1177 } 1118 else if (childInstance instanceof ITaskInstanceList) { 1119 replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks); 1120 } 1121 else if (childInstance instanceof IOptionalInstance) { 1122 replaceTaskInstances((IOptionalInstance) childInstance, replacements, similarTasks); 1123 } 1124 else if (childInstance instanceof ISelectionInstance) { 1125 throw new IllegalArgumentException 1126 ("selection must not have a selection as its child"); 1127 } 1128 } 1178 else { 1179 ITask modelUpdate = replaceTaskInstances(childInstance, replacements, similarTasks, 1180 harmonizedIteration, harmonizedOptional); 1181 1182 if (modelUpdate != null) { 1183 taskBuilder.removeChild 1184 (selectionInstance.getSelection(), childInstance.getTask()); 1185 1186 boolean found = false; 1187 for (ITask child : selectionInstance.getSelection().getChildren()) { 1188 if (comparator.equals(child, modelUpdate)) { 1189 found = true; 1190 break; 1191 } 1192 } 1193 1194 if (!found) { 1195 taskBuilder.addChild(selectionInstance.getSelection(), modelUpdate); 1196 } 1197 } 1198 } 1199 } 1200 } 1201 1202 /** 1203 * 1204 */ 1205 private ITask replaceTaskInstances(ITaskInstance childInstance, 1206 Map<ITaskInstance, ITaskInstance> replacements, 1207 SimilarTasks similarTasks, 1208 IIteration harmonizedIteration, 1209 IOptional harmonizedOptional) 1210 { 1211 ITask modelUpdate = null; 1212 1213 if (childInstance instanceof IIterationInstance) { 1214 ITask markedTask = ((IIterationInstance) childInstance).getIteration().getMarkedTask(); 1215 1216 if ((markedTask == similarTasks.getLeftHandSide()) || 1217 (markedTask == similarTasks.getRightHandSide())) 1218 { 1219 taskBuilder.setTask(childInstance, harmonizedIteration); 1220 modelUpdate = harmonizedIteration; 1221 } 1222 1223 replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks, 1224 harmonizedIteration, harmonizedOptional); 1225 } 1226 else if (childInstance instanceof IOptionalInstance) { 1227 ITask markedTask = ((IOptionalInstance) childInstance).getOptional().getMarkedTask(); 1228 1229 if ((markedTask == similarTasks.getLeftHandSide()) || 1230 (markedTask == similarTasks.getRightHandSide())) 1231 { 1232 taskBuilder.setTask(childInstance, harmonizedOptional); 1233 modelUpdate = harmonizedOptional; 1234 } 1235 1236 replaceTaskInstances((IOptionalInstance) childInstance, replacements, similarTasks, 1237 harmonizedIteration, harmonizedOptional); 1238 } 1239 else if (childInstance instanceof ISelectionInstance) { 1240 replaceTaskInstances((ISelectionInstance) childInstance, replacements, similarTasks, 1241 harmonizedIteration, harmonizedOptional); 1242 } 1243 else if (childInstance instanceof ISequenceInstance) { 1244 replaceTaskInstances((ITaskInstanceList) childInstance, replacements, similarTasks, 1245 harmonizedIteration, harmonizedOptional); 1246 } 1247 1248 return modelUpdate; 1129 1249 } 1130 1250 … … 1198 1318 } 1199 1319 } 1200 1201 /**1202 *1203 */1204 private void harmonizeEqualMarkingTemporalRelationships(RuleApplicationData appData) {1205 Console.println("harmonizing marking temporal relationships");1206 1207 TaskInstanceComparator comparator = identTaskHandlStrat.getTaskComparator();1208 ITaskModel model = taskFactory.createTaskModel(appData.getSessions());1209 1210 // determine a list of equal marking temporal relationship lists1211 List<List<IMarkingTemporalRelationship>> equalTasks =1212 new LinkedList<List<IMarkingTemporalRelationship>>();1213 1214 for (ITask task1 : model.getTasks()) {1215 if (task1 instanceof IMarkingTemporalRelationship) {1216 IMarkingTemporalRelationship parent1 = (IMarkingTemporalRelationship) task1;1217 for (ITask task2 : model.getTasks()) {1218 if (task2 instanceof IMarkingTemporalRelationship) {1219 IMarkingTemporalRelationship parent2 = (IMarkingTemporalRelationship) task2;1220 1221 // check if the parents are of the same type, but distinct and if the1222 // children are identical1223 if (!comparator.equals(parent1, parent2) &&1224 (parent1.getClass().isAssignableFrom(parent2.getClass()) ||1225 parent2.getClass().isAssignableFrom(parent1.getClass())) &&1226 comparator.equals(parent1.getMarkedTask(), parent2.getMarkedTask()))1227 {1228 List<IMarkingTemporalRelationship> equalTaskList = null;1229 1230 GET_EQUAL_TASK_LIST:1231 for (List<IMarkingTemporalRelationship> candidate : equalTasks) {1232 for (IMarkingTemporalRelationship task : candidate) {1233 if (comparator.equals(task, parent1) ||1234 comparator.equals(task, parent2))1235 {1236 equalTaskList = candidate;1237 break GET_EQUAL_TASK_LIST;1238 }1239 }1240 }1241 1242 if (equalTaskList == null) {1243 equalTaskList = new LinkedList<IMarkingTemporalRelationship>();1244 equalTasks.add(equalTaskList);1245 }1246 1247 boolean found1 = false;1248 boolean found2 = false;1249 1250 for (IMarkingTemporalRelationship task : equalTaskList) {1251 if (comparator.equals(task, parent1)) {1252 found1 = true;1253 }1254 else if (comparator.equals(task, parent2)) {1255 found2 = true;1256 }1257 }1258 1259 if (!found1) {1260 equalTaskList.add(parent1);1261 }1262 1263 if (!found2) {1264 equalTaskList.add(parent2);1265 }1266 }1267 }1268 }1269 }1270 }1271 1272 Console.traceln(Level.FINER, "found " + equalTasks.size() +1273 " groups of equal marking temporal relationships");1274 1275 // set the same task for all instances1276 List<ITaskInstance> instanceBuffer = new ArrayList<ITaskInstance>();1277 for (List<IMarkingTemporalRelationship> equalTaskList : equalTasks) {1278 for (int i = 1; i < equalTaskList.size(); i++) {1279 // to prevent a concurrent modification, first copy the list of instances1280 instanceBuffer.clear();1281 instanceBuffer.addAll(equalTaskList.get(i).getInstances());1282 for (ITaskInstance instance : instanceBuffer) {1283 taskBuilder.setTask(instance, equalTaskList.get(0));1284 }1285 }1286 }1287 1288 // several subsequent instances, which had formerly different tasks, may now have the same.1289 // Hence, they need to be merged. But as everything else would be way too complex, we only1290 // perform the merge, if they occur next to each other on the same level1291 for (IUserSession session : appData.getSessions()) {1292 mergeSubsequentIdenticalMarkingTemporalRelationships(session);1293 }1294 1295 }1296 1320 1297 1321 /** … … 1300 1324 private void mergeSubsequentIdenticalMarkingTemporalRelationships(ITaskInstanceList list) { 1301 1325 int index = 0; 1302 Task InstanceComparator comparator = identTaskHandlStrat.getTaskComparator();1326 TaskComparator comparator = identTaskHandlStrat.getTaskComparator(); 1303 1327 1304 1328 while (index < (list.size() - 1)) { … … 1445 1469 * 1446 1470 */ 1447 RuleApplicationData(List<IUserSession> sessions) {1471 private RuleApplicationData(List<IUserSession> sessions) { 1448 1472 this.sessions = sessions; 1449 1473 } … … 1465 1489 * @return the mostSimilarTasksDeterminer 1466 1490 */ 1467 MostSimilarTaskDeterminer getMostSimilarTasksDeterminer() {1491 private MostSimilarTaskDeterminer getMostSimilarTasksDeterminer() { 1468 1492 return mostSimilarTasksDeterminer; 1469 1493 } … … 1472 1496 * 1473 1497 */ 1474 void markAsAlreadyCondensed(ITask task1, ITask task2) {1498 private void markAsAlreadyCondensed(ITask task1, ITask task2) { 1475 1499 mostSimilarTasksDeterminer.addComparisonToSkip(task1, task2); 1476 1500 } … … 1550 1574 ITask child2 = ((IOptional) newTask).getMarkedTask(); 1551 1575 if (createdChildEquals(child1, child2)) { 1552 System.out.println("reusing optional " + newTask + " for " + task);1576 // System.out.println("reusing optional " + newTask + " for " + task); 1553 1577 return newTask; 1554 1578 } … … 1562 1586 List<ITask> children2 = ((ISelection) newTask).getChildren(); 1563 1587 if (createdSelectionChildrenEqual(children1, children2)) { 1564 System.out.println("reusing selection " + newTask + " for " + task);1588 /*System.out.println("reusing selection " + newTask + " for " + task); 1565 1589 1566 /*System.out.println("---------------------------- existing task");1590 System.out.println("---------------------------- existing task"); 1567 1591 new TaskTreeEncoder().encode(newTask, System.out); 1568 1592 … … 1606 1630 1607 1631 if (equal) { 1608 System.out.println("reusing sequence " + candidate + " for " + task);1632 // System.out.println("reusing sequence " + candidate + " for " + task); 1609 1633 return candidate; 1610 1634 } … … 1788 1812 1789 1813 1790 /**1791 *1792 */1793 void dump(PrintStream out) {1794 for (int i = 0; i < path.size(); i++) {1795 out.print("-->");1796 out.print(path.getTask(i).getId());1797 out.print('(');1798 out.print(path.get(i).getIndex());1799 out.print(')');1800 }1801 1802 out.print(" ");1803 out.print(instruction);1804 1805 out.println();1806 }1814 // /** 1815 // * 1816 // */ 1817 // void dump(PrintStream out) { 1818 // for (int i = 0; i < path.size(); i++) { 1819 // out.print("-->"); 1820 // out.print(path.getTask(i).getId()); 1821 // out.print('('); 1822 // out.print(path.get(i).getIndex()); 1823 // out.print(')'); 1824 // } 1825 // 1826 // out.print(" "); 1827 // out.print(instruction); 1828 // 1829 // out.println(); 1830 // } 1807 1831 1808 1832 }
Note: See TracChangeset
for help on using the changeset viewer.