Ignore:
Timestamp:
09/14/12 16:04:08 (12 years ago)
Author:
pharms
Message:
  • corrected merging of sublists
File:
1 edited

Legend:

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

    r815 r818  
    391391    { 
    392392        ITaskTreeNode mergeResult = null; 
    393         NodeEquality nodeEquality = nodeEqualityRuleManager.applyRules(node1, node2); 
    394          
    395         if (nodeEquality.isAtLeast(NodeEquality.LEXICALLY_EQUAL)) { 
     393         
     394        if ((node1 instanceof ISequence) && (node2 instanceof ISequence)) { 
     395            mergeResult = mergeEqualSequences 
     396                ((ISequence) node1, (ISequence) node2, treeBuilder, nodeFactory); 
     397        } 
     398        else if ((node1 instanceof ISelection) && (node2 instanceof ISelection)) { 
     399            mergeResult = mergeEqualSelections 
     400                ((ISelection) node1, (ISelection) node2, treeBuilder, nodeFactory); 
     401        } 
     402        else if ((node1 instanceof IIteration) && (node2 instanceof IIteration)) { 
     403            mergeResult = mergeEqualIterations 
     404                ((IIteration) node1, (IIteration) node2, treeBuilder, nodeFactory); 
     405        } 
     406        else if (node1 instanceof ISelection) { 
     407            treeBuilder.addChild((ISelection) node1, node2); 
    396408            mergeResult = node1; 
    397409        } 
     410        else if (node2 instanceof ISelection) { 
     411            treeBuilder.addChild((ISelection) node2, node1); 
     412            mergeResult = node2; 
     413        } 
     414        else if (node1 instanceof IIteration) { 
     415            mergeResult = mergeEqualTasks 
     416                (((IIteration) node1).getChildren().get(0), node2, treeBuilder, nodeFactory); 
     417             
     418            if (mergeResult != null) { 
     419                IIteration iteration = nodeFactory.createNewIteration(); 
     420                treeBuilder.setChild(iteration, mergeResult); 
     421                mergeResult = iteration; 
     422            } 
     423        } 
     424        else if (node2 instanceof IIteration) { 
     425            mergeResult = mergeEqualTasks 
     426                (((IIteration) node2).getChildren().get(0), node1, treeBuilder, nodeFactory); 
     427             
     428            if (mergeResult != null) { 
     429                IIteration iteration = nodeFactory.createNewIteration(); 
     430                treeBuilder.setChild(iteration, mergeResult); 
     431                mergeResult = iteration; 
     432            } 
     433        } 
    398434        else { 
    399             if ((node1 instanceof ISequence) && (node2 instanceof ISequence)) { 
    400                 mergeResult = mergeEqualSequences 
    401                     ((ISequence) node1, (ISequence) node2, treeBuilder, nodeFactory); 
    402             } 
    403             else if ((node1 instanceof ISelection) && (node2 instanceof ISelection)) { 
    404                 mergeResult = mergeEqualSelections 
    405                     ((ISelection) node1, (ISelection) node2, treeBuilder, nodeFactory); 
    406             } 
    407             else if ((node1 instanceof IIteration) && (node2 instanceof IIteration)) { 
    408                 mergeResult = mergeEqualIterations 
    409                     ((IIteration) node1, (IIteration) node2, treeBuilder, nodeFactory); 
    410             } 
    411             else if (node1 instanceof ISelection) { 
    412                 treeBuilder.addChild((ISelection) node1, node2); 
     435            NodeEquality nodeEquality = nodeEqualityRuleManager.applyRules(node1, node2); 
     436             
     437            if (nodeEquality.isAtLeast(NodeEquality.LEXICALLY_EQUAL)) { 
    413438                mergeResult = node1; 
    414439            } 
    415             else if (node2 instanceof ISelection) { 
    416                 treeBuilder.addChild((ISelection) node2, node1); 
    417                 mergeResult = node2; 
    418             } 
    419         } 
    420          
     440        } 
     441 
    421442        if (mergeResult == null) { 
    422443            mergeResult = nodeFactory.createNewSelection(); 
     
    528549    { 
    529550        ITaskTreeNode mergedChild = mergeEqualTasks 
    530             (iteration1.getChildren().get(0), iteration1.getChildren().get(0), 
     551            (iteration1.getChildren().get(0), iteration2.getChildren().get(0), 
    531552             treeBuilder, nodeFactory); 
    532553         
Note: See TracChangeset for help on using the changeset viewer.