From 699f585ae787b521c90c731fa199f54e803745e1 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Sun, 29 Dec 2024 18:38:11 -0500 Subject: [PATCH] Improve identicalWithExpressionArgumentSwap() Enables statement mappings in commit https://github.com/eclipse-jgit/jgit/commit/afb013b9837a385b658469f4595b65413e4d0dbf --- .../java/xmi/decomposition/AbstractCall.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java b/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java index 5eb5e6b0fa..17a456ad04 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java @@ -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 lambdaMappers) { @@ -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 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 argumentIntersection = argumentIntersection(call); + if(argumentIntersection.size() == arguments().size() && argumentIntersection.size() == call.arguments().size()-1) { + return true; + } + } + } return false; }