Changeset 1294 for trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoder.java
- Timestamp:
- 08/14/13 17:04:42 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoder.java
r1212 r1294 26 26 import de.ugoe.cs.autoquest.eventcore.StringEventType; 27 27 import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 28 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 29 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 30 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 31 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 32 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 33 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; … … 173 179 } 174 180 else { 175 task = createUserInteractionTask (matcher);181 task = createUserInteractionTaskInstance(matcher).getTask(); 176 182 } 177 183 tasks.put(id, task); 178 184 } 179 185 180 if ((matcher.group(5) != null) && (!"".equals(matcher.group(5).trim()))) { 181 taskBuilder.setDescription(task, matcher.group(5).trim()); 182 } 183 184 ITaskInstance instance = taskFactory.createNewTaskInstance(task); 186 ITaskInstance instance; 187 188 if (task instanceof ISequence) { 189 instance = taskFactory.createNewTaskInstance((ISequence) task); 190 } 191 else if (task instanceof ISelection) { 192 instance = taskFactory.createNewTaskInstance((ISelection) task); 193 } 194 else if (task instanceof IIteration) { 195 instance = taskFactory.createNewTaskInstance((IIteration) task); 196 } 197 else if (task instanceof IOptional) { 198 instance = taskFactory.createNewTaskInstance((IOptional) task); 199 } 200 else { 201 instance = taskFactory.createNewTaskInstance 202 ((IEventTask) task, 203 ((IEventTaskInstance) task.getInstances().iterator().next()).getEvent()); 204 } 185 205 186 206 while (taskMatcher.find() && !"}".equals(taskMatcher.group(0))) { … … 216 236 } 217 237 218 taskBuilder.addChild(instance, childInstance); 238 if (instance instanceof ISequenceInstance) { 239 taskBuilder.addChild((ISequenceInstance) instance, childInstance); 240 } 241 else if (instance instanceof ISelectionInstance) { 242 taskBuilder.setChild((ISelectionInstance) instance, childInstance); 243 } 244 else if (instance instanceof IIterationInstance) { 245 taskBuilder.addChild((IIterationInstance) instance, childInstance); 246 } 247 else if (instance instanceof IOptionalInstance) { 248 taskBuilder.setChild((IOptionalInstance) instance, childInstance); 249 } 219 250 } 220 251 … … 229 260 * @return 230 261 */ 231 private ITask createUserInteractionTask(Matcher matcher) {262 private ITaskInstance createUserInteractionTaskInstance(Matcher matcher) { 232 263 String evenType = matcher.group(1); 233 264 String id = matcher.group(2); 234 IEventTarget even Target = targets.get(id);235 if (even Target == null) {236 even Target = determineTarget(evenType, id, matcher.group(4));237 targets.put(id, even Target);265 IEventTarget eventTarget = targets.get(id); 266 if (eventTarget == null) { 267 eventTarget = determineTarget(evenType, id, matcher.group(4)); 268 targets.put(id, eventTarget); 238 269 } 239 270 IEventType eventType = determineType(evenType, matcher.group(4)); 240 return taskFactory.createNewEventTask(eventType, evenTarget); 271 IEventTask task = taskFactory.createNewEventTask(eventType + " --> " + eventTarget); 272 273 return taskFactory.createNewTaskInstance(task, new Event(eventType, eventTarget)); 241 274 } 242 275
Note: See TracChangeset
for help on using the changeset viewer.