Fixed the mapping of statements
@@ -2352,10 +2352,13 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
double score = computeScore(statement1, statement2, removedOperations, addedOperations, tryWithResourceMigration);
if(score == 0 && replacements != null) {
- if(replacements.size() == 1 && (replacements.iterator().next().getType().equals(ReplacementType.INFIX_OPERATOR) || replacements.iterator().next().getType().equals(ReplacementType.INVERT_CONDITIONAL))) {
+ if(replacements.size() == 1 && (replacementInfo.getReplacements(ReplacementType.INFIX_OPERATOR).size() > 0 || replacementInfo.getReplacements(ReplacementType.INVERT_CONDITIONAL).size() > 0)) {
//special handling when there is only an infix operator or invert conditional replacement, but no children mapped
score = 1;
}
+ else if(replacements.size() <= 2 && replacementInfo.getReplacements(ReplacementType.INVERT_CONDITIONAL).size() > 0) {
+ score = 1;
+ }
else if(containsInvertCondition(statement1, statement2)) {
score = 1;
}
@@ -2472,10 +2475,13 @@ public class UMLOperationBodyMapper implements Comparable<UMLOperationBodyMapper
double score = computeScore(statement1, statement2, removedOperations, addedOperations, tryWithResourceMigration);
if(score == 0 && replacements != null) {
- if(replacements.size() == 1 && (replacements.iterator().next().getType().equals(ReplacementType.INFIX_OPERATOR) || replacements.iterator().next().getType().equals(ReplacementType.INVERT_CONDITIONAL))) {
+ if(replacements.size() == 1 && (replacementInfo.getReplacements(ReplacementType.INFIX_OPERATOR).size() > 0 || replacementInfo.getReplacements(ReplacementType.INVERT_CONDITIONAL).size() > 0)) {
//special handling when there is only an infix operator or invert conditional replacement, but no children mapped
score = 1;
}
+ else if(replacements.size() <= 2 && replacementInfo.getReplacements(ReplacementType.INVERT_CONDITIONAL).size() > 0) {
+ score = 1;
+ }
else if(containsInvertCondition(statement1, statement2)) {
score = 1;
}
