Ignore:
Timestamp:
03/18/13 11:54:15 (11 years ago)
Author:
pharms
Message:
  • complete refactoring of task detection
  • many performance improvements in task detection
  • improved merging of sequences using Myers diff algorithm
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceOnSameTargetDetectionRule.java

    r1117 r1127  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 
    1616 
     17import java.util.List; 
     18 
    1719import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
    1820import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     
    2931 * @author 2012, last modified by $Author: patrick$ 
    3032 */ 
    31 class DefaultEventTargetSequenceDetectionRule implements TemporalRelationshipRule { 
     33class SequenceOnSameTargetDetectionRule implements TemporalRelationshipRule { 
    3234 
    3335    /** 
     
    5860     *                            the temporal relationships identified during rule application 
    5961     */ 
    60     DefaultEventTargetSequenceDetectionRule(ITaskTreeNodeFactory taskTreeNodeFactory, 
    61                                             ITaskTreeBuilder     taskTreeBuilder) 
     62    SequenceOnSameTargetDetectionRule(ITaskTreeNodeFactory taskTreeNodeFactory, 
     63                                      ITaskTreeBuilder     taskTreeBuilder) 
    6264    { 
    6365        this.taskTreeNodeFactory = taskTreeNodeFactory; 
     
    7072    @Override 
    7173    public String toString() { 
    72         return "DefaultEventTargetSequenceDetectionRule"; 
     74        return "SequenceOnSameTargetDetectionRule"; 
    7375    } 
    7476 
     
    9193 
    9294        int index = 0; 
    93         while (index < parent.getChildren().size()) { 
    94             ITaskTreeNode child = parent.getChildren().get(index); 
     95        List<ITaskTreeNode> children = parent.getChildren(); 
     96         
     97        while (index < children.size()) { 
     98            ITaskTreeNode child = children.get(index); 
    9599 
    96100            IEventTarget eventTarget = determineEventTarget(child); 
     
    109113                    // or if this child is not a sequence itself 
    110114                    if ((startingIndex != endIndex) || 
    111                         (!(parent.getChildren().get(startingIndex) instanceof ISequence))) 
     115                        (!(children.get(startingIndex) instanceof ISequence))) 
    112116                    { 
    113117                        handleEventTargetSequence 
    114118                            (parent, currentEventTarget, startingIndex, endIndex, result); 
    115119 
    116                         result.setRuleApplicationStatus 
    117                             (RuleApplicationStatus.RULE_APPLICATION_FINISHED); 
     120                        result.setRuleApplicationStatus(RuleApplicationStatus.FINISHED); 
    118121                        return result; 
    119122                    } 
     
    134137 
    135138        if (startingIndex > -1) { 
    136             int endIndex = parent.getChildren().size() - 1; 
     139            int endIndex = children.size() - 1; 
    137140             
    138141            if (finalize) { 
     
    141144                if ((startingIndex > 0) && 
    142145                    ((startingIndex != endIndex) || 
    143                      (!(parent.getChildren().get(startingIndex) instanceof ISequence)))) 
     146                     (!(children.get(startingIndex) instanceof ISequence)))) 
    144147                { 
    145148                    handleEventTargetSequence 
    146149                        (parent, currentEventTarget, startingIndex, endIndex, result); 
    147150                 
    148                     result.setRuleApplicationStatus(RuleApplicationStatus.RULE_APPLICATION_FINISHED); 
     151                    result.setRuleApplicationStatus(RuleApplicationStatus.FINISHED); 
    149152                } 
    150153            } 
    151154            else { 
    152                 result.setRuleApplicationStatus(RuleApplicationStatus.RULE_APPLICATION_FEASIBLE); 
     155                result.setRuleApplicationStatus(RuleApplicationStatus.FEASIBLE); 
    153156            } 
    154157        } 
Note: See TracChangeset for help on using the changeset viewer.