Changeset 1300 for trunk/autoquest-core-usability
- Timestamp:
- 08/23/13 14:35:29 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRule.java
r1149 r1300 22 22 import java.util.Map; 23 23 24 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 25 import de.ugoe.cs.autoquest.eventcore.IEventType; 24 26 import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 25 27 import de.ugoe.cs.autoquest.eventcore.guimodel.ITextArea; 26 28 import de.ugoe.cs.autoquest.eventcore.guimodel.ITextField; 27 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 28 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; 29 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship; 30 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 31 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 32 36 … … 247 251 private void calculateStatistics(ITask task, TextInputStatistics statistics) { 248 252 249 if ((task instanceof IEventTask) && 250 (((IEventTask) task).getEventType() instanceof TextInput)) 251 { 253 if (isTextInput(task)) { 252 254 calculateStatistics((IEventTask) task, statistics); 253 255 } … … 269 271 270 272 /** 273 * <p> 274 * TODO: comment 275 * </p> 276 * 277 * @param task 278 * @return 279 */ 280 private boolean isTextInput(ITask task) { 281 if (task.getInstances().size() > 0) { 282 ITaskInstance instance = task.getInstances().iterator().next(); 283 if (instance instanceof IEventTaskInstance) { 284 return ((IEventTaskInstance) instance).getEvent().getType() instanceof TextInput; 285 } 286 } 287 288 return false; 289 } 290 291 /** 271 292 * TODO: comment 272 293 * … … 275 296 */ 276 297 private void calculateStatistics(IEventTask node, TextInputStatistics statistics) { 277 String[] fragments = 278 determineTextFragments(((TextInput) node.getEventType()).getEnteredText()); 279 280 if (node.getEventTarget() instanceof ITextField) { 281 statistics.addTextFieldInput(node, fragments); 282 } 283 else if (node.getEventTarget() instanceof ITextArea) { 284 statistics.addTextAreaInput(node, fragments); 298 299 for (ITaskInstance instance : node.getInstances()) { 300 IEventType type = ((IEventTaskInstance) instance).getEvent().getType(); 301 IEventTarget target = ((IEventTaskInstance) instance).getEvent().getTarget(); 302 303 if (type instanceof TextInput) { 304 String[] fragments = 305 determineTextFragments(((TextInput) type).getEnteredText()); 306 307 if (target instanceof ITextField) { 308 statistics.addTextFieldInput(node, fragments); 309 } 310 else if (target instanceof ITextArea) { 311 statistics.addTextAreaInput(node, fragments); 312 } 313 } 285 314 } 286 315 }
Note: See TracChangeset
for help on using the changeset viewer.