Changeset 1300


Ignore:
Timestamp:
08/23/13 14:35:29 (11 years ago)
Author:
pharms
Message:
  • rework of task model to move event instance stuff to task instances
  • introduction of sequence, selection, iteration and optional instances
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-usability/src/main/java/de/ugoe/cs/autoquest/usability/TextInputStatisticsRule.java

    r1149 r1300  
    2222import java.util.Map; 
    2323 
     24import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     25import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2426import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    2527import de.ugoe.cs.autoquest.eventcore.guimodel.ITextArea; 
    2628import de.ugoe.cs.autoquest.eventcore.guimodel.ITextField; 
    2729import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2831import de.ugoe.cs.autoquest.tasktrees.treeifc.IMarkingTemporalRelationship; 
    2932import de.ugoe.cs.autoquest.tasktrees.treeifc.IStructuringTemporalRelationship; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    3135import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
    3236 
     
    247251    private void calculateStatistics(ITask task, TextInputStatistics statistics) { 
    248252         
    249         if ((task instanceof IEventTask) && 
    250             (((IEventTask) task).getEventType() instanceof TextInput)) 
    251         { 
     253        if (isTextInput(task)) { 
    252254            calculateStatistics((IEventTask) task, statistics); 
    253255        } 
     
    269271 
    270272    /** 
     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    /** 
    271292     * TODO: comment 
    272293     *  
     
    275296     */ 
    276297    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            } 
    285314        } 
    286315    } 
Note: See TracChangeset for help on using the changeset viewer.