Skip to content

Commit fbf0312

Browse files
committed
Addressing old TODO
1 parent b77e668 commit fbf0312

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

src/main/java/gr/uom/java/xmi/decomposition/ReplacementAlgorithm.java

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,7 +2911,7 @@ else if(invocationCoveringTheEntireStatement2.getExpression() != null && invocat
29112911
Replacement replacement = new MethodInvocationReplacement(
29122912
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
29132913
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2914-
//replacementInfo.addReplacement(replacement);
2914+
replacementInfo.addReplacement(replacement);
29152915
return replacementInfo.getReplacements();
29162916
}
29172917
else if(arg.contains(".")) {
@@ -2920,38 +2920,58 @@ else if(arg.contains(".")) {
29202920
Replacement replacement = new MethodInvocationReplacement(
29212921
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
29222922
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2923-
//replacementInfo.addReplacement(replacement);
2923+
replacementInfo.addReplacement(replacement);
29242924
return replacementInfo.getReplacements();
29252925
}
29262926
}
29272927
if(arg.contains(" instanceof ")) {
29282928
String before = arg.substring(0, arg.indexOf(" instanceof "));
29292929
String after = arg.substring(arg.indexOf(" instanceof ") + " instanceof ".length(), arg.length());
29302930
if(statement2.getArgumentizedString().contains(before) && statement2.getArgumentizedString().contains(after)) {
2931+
Replacement replacement = new MethodInvocationReplacement(
2932+
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
2933+
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2934+
replacementInfo.addReplacement(replacement);
29312935
return replacementInfo.getReplacements();
29322936
}
29332937
}
29342938
else if(arg.contains(" > 0")) {
29352939
String before = arg.substring(0, arg.indexOf(" > 0"));
29362940
if(statement2.getArgumentizedString().contains(before)) {
2941+
Replacement replacement = new MethodInvocationReplacement(
2942+
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
2943+
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2944+
replacementInfo.addReplacement(replacement);
29372945
return replacementInfo.getReplacements();
29382946
}
29392947
}
29402948
else if(arg.contains(" < 0")) {
29412949
String before = arg.substring(0, arg.indexOf(" < 0"));
29422950
if(statement2.getArgumentizedString().contains(before)) {
2951+
Replacement replacement = new MethodInvocationReplacement(
2952+
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
2953+
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2954+
replacementInfo.addReplacement(replacement);
29432955
return replacementInfo.getReplacements();
29442956
}
29452957
}
29462958
else if(arg.contains(" == 0")) {
29472959
String before = arg.substring(0, arg.indexOf(" == 0"));
29482960
if(statement2.getArgumentizedString().contains(before)) {
2961+
Replacement replacement = new MethodInvocationReplacement(
2962+
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
2963+
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2964+
replacementInfo.addReplacement(replacement);
29492965
return replacementInfo.getReplacements();
29502966
}
29512967
}
29522968
else if(arg.endsWith(".isEmpty()")) {
29532969
String before = arg.substring(0, arg.indexOf(".isEmpty()"));
29542970
if(statement2.getArgumentizedString().contains(before)) {
2971+
Replacement replacement = new MethodInvocationReplacement(
2972+
invocationCoveringTheEntireStatement1.actualString(), invocation2.actualString(),
2973+
invocationCoveringTheEntireStatement1, invocation2, ReplacementType.ASSERTION_CONVERSION);
2974+
replacementInfo.addReplacement(replacement);
29552975
return replacementInfo.getReplacements();
29562976
}
29572977
}
@@ -3017,7 +3037,7 @@ else if((invocationCoveringTheEntireStatement1.getName().equals("isTrue") && inv
30173037
Replacement replacement = new MethodInvocationReplacement(
30183038
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
30193039
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3020-
//replacementInfo.addReplacement(replacement);
3040+
replacementInfo.addReplacement(replacement);
30213041
return replacementInfo.getReplacements();
30223042
}
30233043
else if(arg.contains(".")) {
@@ -3026,38 +3046,58 @@ else if(arg.contains(".")) {
30263046
Replacement replacement = new MethodInvocationReplacement(
30273047
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
30283048
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3029-
//replacementInfo.addReplacement(replacement);
3049+
replacementInfo.addReplacement(replacement);
30303050
return replacementInfo.getReplacements();
30313051
}
30323052
}
30333053
if(arg.contains(" instanceof ")) {
30343054
String before = arg.substring(0, arg.indexOf(" instanceof "));
30353055
String after = arg.substring(arg.indexOf(" instanceof ") + " instanceof ".length(), arg.length());
30363056
if(statement1.getArgumentizedString().contains(before) && statement1.getArgumentizedString().contains(after)) {
3057+
Replacement replacement = new MethodInvocationReplacement(
3058+
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
3059+
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3060+
replacementInfo.addReplacement(replacement);
30373061
return replacementInfo.getReplacements();
30383062
}
30393063
}
30403064
else if(arg.contains(" > 0")) {
30413065
String before = arg.substring(0, arg.indexOf(" > 0"));
30423066
if(statement1.getArgumentizedString().contains(before)) {
3067+
Replacement replacement = new MethodInvocationReplacement(
3068+
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
3069+
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3070+
replacementInfo.addReplacement(replacement);
30433071
return replacementInfo.getReplacements();
30443072
}
30453073
}
30463074
else if(arg.contains(" < 0")) {
30473075
String before = arg.substring(0, arg.indexOf(" < 0"));
30483076
if(statement1.getArgumentizedString().contains(before)) {
3077+
Replacement replacement = new MethodInvocationReplacement(
3078+
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
3079+
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3080+
replacementInfo.addReplacement(replacement);
30493081
return replacementInfo.getReplacements();
30503082
}
30513083
}
30523084
else if(arg.contains(" == 0")) {
30533085
String before = arg.substring(0, arg.indexOf(" == 0"));
30543086
if(statement1.getArgumentizedString().contains(before)) {
3087+
Replacement replacement = new MethodInvocationReplacement(
3088+
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
3089+
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3090+
replacementInfo.addReplacement(replacement);
30553091
return replacementInfo.getReplacements();
30563092
}
30573093
}
30583094
else if(arg.endsWith(".isEmpty()")) {
30593095
String before = arg.substring(0, arg.indexOf(".isEmpty()"));
30603096
if(statement1.getArgumentizedString().contains(before)) {
3097+
Replacement replacement = new MethodInvocationReplacement(
3098+
invocation1.actualString(), invocationCoveringTheEntireStatement2.actualString(),
3099+
invocation1, invocationCoveringTheEntireStatement2, ReplacementType.ASSERTION_CONVERSION);
3100+
replacementInfo.addReplacement(replacement);
30613101
return replacementInfo.getReplacements();
30623102
}
30633103
}

0 commit comments

Comments
 (0)