Changeset 1905


Ignore:
Timestamp:
03/10/15 15:06:08 (10 years ago)
Author:
pharms
Message:
  • corrected comparison of sequences
File:
1 edited

Legend:

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

    r1887 r1905  
    147147        } 
    148148 
    149         TaskEquality resultingEquality = requiredEqualityLevel != null ? 
    150             requiredEqualityLevel : TaskEquality.LEXICALLY_EQUAL; 
     149        TaskEquality resultingEquality = null; 
    151150         
    152151        for (int i = 0; i < children1.size(); i++) { 
     
    158157            TaskEquality taskEquality = callRuleManager(child1, child2, resultingEquality); 
    159158 
    160             if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL)) { 
     159            if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL) || 
     160                ((requiredEqualityLevel != null) && 
     161                 (!taskEquality.isAtLeast(requiredEqualityLevel)))) 
     162            { 
    161163                return TaskEquality.UNEQUAL; 
    162164            } 
    163165             
    164             resultingEquality = resultingEquality.getCommonDenominator(taskEquality); 
     166            if (resultingEquality == null) { 
     167                // non identical sequences can be at most lexically equal 
     168                resultingEquality = TaskEquality.LEXICALLY_EQUAL.getCommonDenominator(taskEquality); 
     169            } 
     170            else { 
     171                resultingEquality = resultingEquality.getCommonDenominator(taskEquality); 
     172            } 
    165173        } 
    166174 
     
    228236        } 
    229237 
    230         TaskEquality resultingEquality = requiredEqualityLevel != null ? 
    231             requiredEqualityLevel : TaskEquality.LEXICALLY_EQUAL; 
     238        TaskEquality resultingEquality = TaskEquality.LEXICALLY_EQUAL; 
    232239         
    233240        for (int i = 0; i < sequence1.size(); i++) { 
     
    239246            TaskEquality taskEquality = callRuleManager(child1, child2, resultingEquality); 
    240247 
    241             if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL)) { 
     248            if ((taskEquality == null) || (taskEquality == TaskEquality.UNEQUAL) || 
     249                ((requiredEqualityLevel != null) && 
     250                 (!taskEquality.isAtLeast(requiredEqualityLevel)))) 
     251            { 
    242252                return TaskEquality.UNEQUAL; 
    243253            } 
    244254             
    245             resultingEquality = resultingEquality.getCommonDenominator(taskEquality); 
     255            if (resultingEquality == null) { 
     256                // non identical sequences can be at most lexically equal 
     257                resultingEquality = TaskEquality.LEXICALLY_EQUAL.getCommonDenominator(taskEquality); 
     258            } 
     259            else { 
     260                resultingEquality = resultingEquality.getCommonDenominator(taskEquality); 
     261            } 
    246262        } 
    247263 
Note: See TracChangeset for help on using the changeset viewer.