Raise embedded if into parent if.

This commit is contained in:
Gary Gregory 2021-02-28 12:19:37 -05:00
parent 4a845dc8bc
commit 11eb27dfb0
3 changed files with 12 additions and 24 deletions

View File

@ -203,10 +203,8 @@ public class SequencesComparator<T> {
++y;
}
// Second step
if (delta % 2 != 0 && delta - d <= k && k <= delta + d) {
if (vUp[i-delta] <= vDown[i]) { // NOPMD
return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
}
if ((delta % 2 != 0 && delta - d <= k && k <= delta + d) && (vUp[i-delta] <= vDown[i])) { // NOPMD
return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
}
}
@ -229,10 +227,8 @@ public class SequencesComparator<T> {
y--;
}
// Second step
if (delta % 2 == 0 && -d <= k && k <= d ) {
if (vUp[i] <= vDown[i + delta]) { // NOPMD
return buildSnake(vUp[i], k + start1 - start2, end1, end2);
}
if ((delta % 2 == 0 && -d <= k && k <= d) && (vUp[i] <= vDown[i + delta])) { // NOPMD
return buildSnake(vUp[i], k + start1 - start2, end1, end2);
}
}
}

View File

@ -172,14 +172,10 @@ abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K, V> {
}
return root.setKeyValue(key, value);
} else if (KeyAnalyzer.isEqualBitKey(bitIndex)) {
// This is a very special and rare case.
/* REPLACE OLD KEY+VALUE */
if (found != root) { // NOPMD
incrementModCount();
return found.setKeyValue(key, value);
}
} else /* REPLACE OLD KEY+VALUE */
if (KeyAnalyzer.isEqualBitKey(bitIndex) && found != root) { // NOPMD
incrementModCount();
return found.setKeyValue(key, value);
}
}

View File

@ -164,10 +164,8 @@ public class FactoryUtilsTest {
}
@Override
public boolean equals(final Object obj) {
if (obj instanceof Mock1) {
if (iVal == ((Mock1) obj).iVal) {
return true;
}
if (obj instanceof Mock1 && (iVal == ((Mock1) obj).iVal)) {
return true;
}
return false;
}
@ -188,10 +186,8 @@ public class FactoryUtilsTest {
}
@Override
public boolean equals(final Object obj) {
if (obj instanceof Mock2) {
if (iVal == ((Mock2) obj).iVal) {
return true;
}
if (obj instanceof Mock2 && (iVal == ((Mock2) obj).iVal)) {
return true;
}
return false;
}