- Timestamp:
- 06/24/15 11:29:20 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/CondenseSimilarTasksRule.java
r1973 r1976 188 188 189 189 RuleApplicationData appData = new RuleApplicationData(sessions); 190 //int mergecount = 0; 190 191 191 192 do { 192 193 appData.setTaskModel(taskFactory.createTaskModel(sessions)); 194 195 /*mergecount++; 196 if ((mergecount > 140) && ((mergecount % 20) == 0)) { 197 System.out.println("performing validation " + mergecount); 198 new TaskTreeValidator().validate(appData.getTaskModel().getUserSessions(), true); 199 }*/ 200 201 193 202 appData.setMostSimilarTasks(null); 194 203 … … 319 328 super.visit(optionalInstance); 320 329 321 if (optionalInstance.getChild() == null) {322 return;323 }324 325 // there may have been a model update at the child. If so, set the326 // new marked task327 330 IOptional optional = optionalInstance.getOptional(); 328 ITask newChildTask = optionalInstance.getChild().getTask(); 329 330 if (newChildTask != optional.getMarkedTask()) { 331 taskBuilder.setMarkedTask(optional, newChildTask); 332 } 333 331 332 if (optionalInstance.getChild() != null) { 333 // there may have been a model update at the child. If so, set the 334 // new marked task 335 ITask newChildTask = optionalInstance.getChild().getTask(); 336 337 if (newChildTask != optional.getMarkedTask()) { 338 taskBuilder.setMarkedTask(optional, newChildTask); 339 } 340 } 341 334 342 // check, if there is a harmonized optional 335 343 IOptional harmonizedOptional = 336 344 harmonizedOptionals.get(optional.getMarkedTask()); 337 345 338 346 if ((harmonizedOptional != null) && (optional != harmonizedOptional)) { 339 347 // there is a harmonized optional --> set it as new task … … 869 877 for (TaskPath path : leftHandSideTraversal.getTraversalPaths()) { 870 878 for (FlattenInstruction instruction : result) { 871 if (instruction.matches(path)) { 879 if ((instruction.getInstruction() != FlattenInstruction.Instruction.INTEGRATE_OPTIONAL) && 880 (instruction.matches(path))) 881 { 872 882 continue OUTER; 873 883 } … … 880 890 for (TaskPath path : rightHandSideTraversal.getTraversalPaths()) { 881 891 for (FlattenInstruction instruction : result) { 882 if (instruction.matches(path)) { 892 if ((instruction.getInstruction() != FlattenInstruction.Instruction.INTEGRATE_OPTIONAL) && 893 (instruction.matches(path))) 894 { 883 895 continue OUTER; 884 896 } … … 982 994 List<TaskPath> previousPaths) 983 995 { 984 boolean instructionApplied = false;985 996 986 997 TaskComparator comp = identTaskHandlStrat.getTaskComparator(); 987 998 988 //System.out.println("applying instructions on " + taskPath); 999 // System.out.println("applying integrate optional instructions on " + taskPath); 1000 1001 for (FlattenInstruction instruction : flattenInstructions) { 1002 if ((instruction.getInstruction() == FlattenInstruction.Instruction.INTEGRATE_OPTIONAL) && 1003 (instruction.matches(taskPath))) 1004 { 1005 // System.out.print("found instruction "); 1006 // instruction.dump(System.out); 1007 TaskPath previousPath = previousPaths.size() > 0 ? 1008 previousPaths.get(previousPaths.size() - 1) : null; 1009 1010 if (pathsMatch(instruction.getPrecedingPath(), previousPath)) { 1011 IOptional optional = instruction.getOptional(); 1012 IOptionalInstance optionalInstance = 1013 taskFactory.createNewTaskInstance(optional); 1014 taskBuilder.addTaskInstance(session, optionalInstance); 1015 } 1016 1017 break; 1018 } 1019 } 1020 1021 boolean instanceHandled = false; 1022 // System.out.println("applying other instructions on " + taskPath); 989 1023 990 1024 for (FlattenInstruction instruction : flattenInstructions) { 991 1025 if (instruction.matches(taskPath)) { 992 // System.out.print("found instruction ");993 // instruction.dump(System.out);1026 // System.out.print("found instruction "); 1027 // instruction.dump(System.out); 994 1028 995 1029 switch (instruction.getInstruction()) { … … 998 1032 taskBuilder.addTaskInstance(session, instance); 999 1033 } 1000 inst ructionApplied = true;1034 instanceHandled = true; 1001 1035 break; 1002 1036 } 1003 1037 case MAKE_OPTIONAL: { 1004 inst ructionApplied = true;1005 1038 instanceHandled = true; 1039 1006 1040 if (instance == null) { 1007 1041 break; … … 1030 1064 } 1031 1065 case MAKE_SELECTION: { 1032 inst ructionApplied = true;1066 instanceHandled = true; 1033 1067 1034 1068 if (instance == null) { … … 1072 1106 } 1073 1107 case INTEGRATE_OPTIONAL: { 1074 TaskPath previousPath = previousPaths.size() > 0 ? 1075 previousPaths.get(previousPaths.size() - 1) : null; 1076 1077 if (pathsMatch(instruction.getPrecedingPath(), previousPath)) { 1078 IOptional optional = instruction.getOptional(); 1079 IOptionalInstance optionalInstance = 1080 taskFactory.createNewTaskInstance(optional); 1081 taskBuilder.addTaskInstance(session, optionalInstance); 1082 } 1083 1084 if (instance != null) { 1085 taskBuilder.addTaskInstance(session, instance); 1086 } 1087 1088 instructionApplied = true; 1108 // have been applied beforehand 1089 1109 break; 1090 1110 } … … 1095 1115 } 1096 1116 1097 if (inst ructionApplied) {1117 if (instanceHandled) { 1098 1118 break; 1099 1119 } 1100 1120 } 1101 1121 1102 if (!inst ructionApplied) {1122 if (!instanceHandled) { 1103 1123 ITask task = taskPath.getLast(); 1104 1124 if (task instanceof IIteration) {
Note: See TracChangeset
for help on using the changeset viewer.