Skip to content

Commit

Permalink
Improve identicalWithExpressionArgumentSwap()
Browse files Browse the repository at this point in the history
Enables statement mappings in commit
eclipse-jgit/jgit@afb013b
  • Loading branch information
tsantalis committed Dec 29, 2024
1 parent 3312bde commit 699f585
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,9 @@ public boolean renamedWithNoExpressionAndArgumentIntersection(AbstractCall call,
}

private boolean oneNameContainsTheOther(AbstractCall call) {
return this.getName().contains(call.getName()) || call.getName().contains(this.getName());
return this.getName().contains(call.getName()) || call.getName().contains(this.getName()) ||
this.getName().toLowerCase().contains(call.getName().toLowerCase()) ||
call.getName().toLowerCase().contains(this.getName().toLowerCase());
}

public boolean renamedWithIdenticalArgumentsAndNoExpression(AbstractCall call, double distance, List<UMLOperationBodyMapper> lambdaMappers) {
Expand Down Expand Up @@ -931,6 +933,24 @@ public boolean identicalWithExpressionArgumentSwap(AbstractCall call) {
}
}
}
else if(getExpression() == null && call.getExpression() != null && (identicalName(call) || oneNameContainsTheOther(call))) {
int argumentIndex1 = arguments().indexOf(call.getExpression());
if(argumentIndex1 != -1) {
Set<String> argumentIntersection = argumentIntersection(call);
if(argumentIntersection.size() == arguments().size()-1 && argumentIntersection.size() == call.arguments().size()) {
return true;
}
}
}
else if(getExpression() != null && call.getExpression() == null && (identicalName(call) || oneNameContainsTheOther(call))) {
int argumentIndex2 = call.arguments().indexOf(getExpression());
if(argumentIndex2 != -1) {
Set<String> argumentIntersection = argumentIntersection(call);
if(argumentIntersection.size() == arguments().size() && argumentIntersection.size() == call.arguments().size()-1) {
return true;
}
}
}
return false;
}

Expand Down

0 comments on commit 699f585

Please sign in to comment.