Skip to content

Commit

Permalink
Establish method invocation mapping in commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Sep 26, 2024
1 parent efb0956 commit 40fc533
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/main/java/gr/uom/java/xmi/decomposition/AbstractCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,19 @@ public boolean identicalWithDifferentNumberOfArguments(AbstractCall call, Set<Re
return false;
}

public boolean identicalWithDifferentNumberOfArguments(AbstractCall call) {
if(identicalExpression(call) &&
identicalName(call) &&
!equalArguments(call) &&
arguments().size() != call.arguments().size()) {
int argumentIntersectionSize = argumentIntersection(call).size();
if(argumentIntersectionSize > 0 || arguments().size() == 0 || call.arguments().size() == 0) {
return true;
}
}
return false;
}

public boolean inlinedStatementBecomesAdditionalArgument(AbstractCall call, Set<Replacement> replacements, List<? extends AbstractCodeFragment> statements) {
if(identicalName(call) && this.arguments.size() < call.arguments.size() && this.argumentIntersection(call).size() > 0) {
int matchedArguments = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,14 @@ else if(invocationCoveringTheEntireStatement1.inlinedStatementBecomesAdditionalA
return replacementInfo.getReplacements();
}
}
if(assignmentInvocationCoveringTheEntireStatement1 != null && assignmentInvocationCoveringTheEntireStatement2 != null) {
if(assignmentInvocationCoveringTheEntireStatement1.identicalWithDifferentNumberOfArguments(assignmentInvocationCoveringTheEntireStatement2)) {
Replacement replacement = new MethodInvocationReplacement(assignmentInvocationCoveringTheEntireStatement1.actualString(),
assignmentInvocationCoveringTheEntireStatement2.actualString(), assignmentInvocationCoveringTheEntireStatement1, assignmentInvocationCoveringTheEntireStatement2, ReplacementType.METHOD_INVOCATION_ARGUMENT);
replacementInfo.addReplacement(replacement);
return replacementInfo.getReplacements();
}
}
if(!methodInvocations1.isEmpty() && invocationCoveringTheEntireStatement2 != null) {
for(String methodInvocation1 : methodInvocations1) {
for(AbstractCall operationInvocation1 : methodInvocationMap1.get(methodInvocation1)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ line range:1782-1782==line range:1791-1791
line range:1733-1733==line range:1723-1728
line range:1263-1274==line range:1753-1760
line range:1307-1307==line range:1291-1291
line range:1707-1711==line range:1692-1702
line range:1181-1189==line range:1181-1189
line range:1180-1191==line range:1180-1191
line range:1205-1211==line range:1205-1211
Expand Down Expand Up @@ -343,5 +344,7 @@ line range:1774-1785==line range:1783-1794
line range:1723-1728==line range:1714-1719
line range:1732-1734==line range:1722-1729
line range:1259-1275==line range:1750-1761
line range:1259-1275==line range:1683-1762
line range:1527-1563==line range:1511-1547
line range:1564-1609==line range:1548-1593
line range:1564-1609==line range:1548-1593
line range:1257-1259==line range:1257-1259

0 comments on commit 40fc533

Please sign in to comment.