Changeset 1767 for trunk/autoquest-core-tasktrees/src/main
- Timestamp:
- 09/26/14 10:46:05 (10 years ago)
- Location:
- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 8 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java
r1401 r1767 27 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 28 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 29 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 30 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; … … 280 282 { 281 283 Map<ITask, IIteration> iterations = new HashMap<ITask, IIteration>(); 284 Map<IIteration, IOptional> optionals = new HashMap<IIteration, IOptional>(); 282 285 Map<IIteration, List<IIterationInstance>> iterationInstances = 283 286 new HashMap<IIteration, List<IIterationInstance>>(); … … 286 289 IIteration iteration = taskFactory.createNewIteration(); 287 290 iterations.put(iteratedTask, iteration); 291 292 if (iteratedTask instanceof IOptional) { 293 IOptional optional = taskFactory.createNewOptional(); 294 taskBuilder.setMarkedTask(optional, iteration); 295 optionals.put(iteration, optional); 296 } 297 288 298 iterationInstances.put(iteration, new LinkedList<IIterationInstance>()); 289 299 } 290 300 301 IOptionalInstance optionalInstance; 291 302 IIterationInstance iterationInstance; 292 303 293 304 for (IUserSession session : sessions) { 294 305 int index = 0; 306 optionalInstance = null; 295 307 iterationInstance = null; 308 boolean inReplacement = false; 296 309 297 310 while (index < session.size()) { … … 302 315 IIteration iteration = iterations.get(currentTask); 303 316 if (iteration != null) { 304 if ((iterationInstance == null) || (iterationInstance.getTask() != iteration)) 305 { 306 iterationInstance = taskFactory.createNewTaskInstance(iteration); 307 iterationInstances.get(iteration).add(iterationInstance); 308 taskBuilder.addTaskInstance(session, index, iterationInstance); 317 if (!inReplacement || (iterationInstance.getTask() != iteration)) { 318 if (currentTask instanceof IOptional) { 319 IOptional optional = optionals.get(iteration); 320 optionalInstance = taskFactory.createNewTaskInstance(optional); 321 taskBuilder.addTaskInstance(session, index, optionalInstance); 322 } 323 else { 324 iterationInstance = taskFactory.createNewTaskInstance(iteration); 325 iterationInstances.get(iteration).add(iterationInstance); 326 taskBuilder.addTaskInstance(session, index, iterationInstance); 327 } 328 inReplacement = true; 309 329 index++; 310 330 } 311 331 312 taskBuilder.addChild(iterationInstance, session.get(index)); 332 if (currentTask instanceof IOptional) { 333 ITaskInstance child = ((IOptionalInstance) session.get(index)).getChild(); 334 335 if (child != null) { 336 if (iterationInstance == null) { 337 iterationInstance = taskFactory.createNewTaskInstance(iteration); 338 iterationInstances.get(iteration).add(iterationInstance); 339 taskBuilder.setChild(optionalInstance, iterationInstance); 340 } 341 taskBuilder.addChild(iterationInstance, child); 342 } 343 } 344 else { 345 taskBuilder.addChild(iterationInstance, session.get(index)); 346 } 347 313 348 taskBuilder.removeTaskInstance(session, index); 314 349 } … … 316 351 if (iterationInstance != null) { 317 352 iterationInstance = null; 353 optionalInstance = null; 354 inReplacement = false; 318 355 } 319 356 index++; … … 544 581 replaceTaskOccurrences(task, appData.getSessions(), sequence); 545 582 546 harmonizeSequenceInstancesModel(sequence, sequenceInstances, task.size());583 harmonizeSequenceInstancesModel(sequence, sequenceInstances, task.size()); 547 584 appData.detectedAndReplacedTasks 548 585 (appData.detectedAndReplacedTasks() || (sequenceInstances.size() > 0)); -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskIdentityComparator.java
r1401 r1767 16 16 17 17 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 18 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 19 20 … … 43 44 @Override 44 45 public boolean equals(ITaskInstance taskInstance1, ITaskInstance taskInstance2) { 45 return taskInstance1.getTask() == taskInstance2.getTask(); 46 return equals(taskInstance1.getTask(), taskInstance2.getTask()); 47 } 48 49 /* (non-Javadoc) 50 * @see TaskInstanceComparator#equals(ITask, ITask) 51 */ 52 @Override 53 public boolean equals(ITask task1, ITask task2) { 54 return task1 == task2; 46 55 } 47 56 -
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java
r1294 r1767 148 148 new SequenceForTaskDetectionRule 149 149 (TaskEquality.SEMANTICALLY_EQUAL, taskFactory, taskBuilder), 150 new CondenseSimilarTasksRule 151 (TaskEquality.SEMANTICALLY_EQUAL, taskFactory, taskBuilder), 150 152 /*new DefaultTaskSequenceDetectionRule 151 153 (NodeEquality.SYNTACTICALLY_EQUAL, taskFactory, taskTreeBuilder),
Note: See TracChangeset
for help on using the changeset viewer.