Raise embedded if into parent if.
This commit is contained in:
parent
4a845dc8bc
commit
11eb27dfb0
|
@ -203,12 +203,10 @@ public class SequencesComparator<T> {
|
||||||
++y;
|
++y;
|
||||||
}
|
}
|
||||||
// Second step
|
// Second step
|
||||||
if (delta % 2 != 0 && delta - d <= k && k <= delta + d) {
|
if ((delta % 2 != 0 && delta - d <= k && k <= delta + d) && (vUp[i-delta] <= vDown[i])) { // NOPMD
|
||||||
if (vUp[i-delta] <= vDown[i]) { // NOPMD
|
|
||||||
return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
|
return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Up
|
// Up
|
||||||
for (int k = delta - d; k <= delta + d; k += 2) {
|
for (int k = delta - d; k <= delta + d; k += 2) {
|
||||||
|
@ -229,13 +227,11 @@ public class SequencesComparator<T> {
|
||||||
y--;
|
y--;
|
||||||
}
|
}
|
||||||
// Second step
|
// Second step
|
||||||
if (delta % 2 == 0 && -d <= k && k <= d ) {
|
if ((delta % 2 == 0 && -d <= k && k <= d) && (vUp[i] <= vDown[i + delta])) { // NOPMD
|
||||||
if (vUp[i] <= vDown[i + delta]) { // NOPMD
|
|
||||||
return buildSnake(vUp[i], k + start1 - start2, end1, end2);
|
return buildSnake(vUp[i], k + start1 - start2, end1, end2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// this should not happen
|
// this should not happen
|
||||||
throw new RuntimeException("Internal Error");
|
throw new RuntimeException("Internal Error");
|
||||||
|
|
|
@ -172,16 +172,12 @@ abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K, V> {
|
||||||
}
|
}
|
||||||
return root.setKeyValue(key, value);
|
return root.setKeyValue(key, value);
|
||||||
|
|
||||||
} else if (KeyAnalyzer.isEqualBitKey(bitIndex)) {
|
} else /* REPLACE OLD KEY+VALUE */
|
||||||
// This is a very special and rare case.
|
if (KeyAnalyzer.isEqualBitKey(bitIndex) && found != root) { // NOPMD
|
||||||
|
|
||||||
/* REPLACE OLD KEY+VALUE */
|
|
||||||
if (found != root) { // NOPMD
|
|
||||||
incrementModCount();
|
incrementModCount();
|
||||||
return found.setKeyValue(key, value);
|
return found.setKeyValue(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
throw new IllegalArgumentException("Failed to put: " + key + " -> " + value + ", " + bitIndex);
|
throw new IllegalArgumentException("Failed to put: " + key + " -> " + value + ", " + bitIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,11 +164,9 @@ public class FactoryUtilsTest {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (obj instanceof Mock1) {
|
if (obj instanceof Mock1 && (iVal == ((Mock1) obj).iVal)) {
|
||||||
if (iVal == ((Mock1) obj).iVal) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,11 +186,9 @@ public class FactoryUtilsTest {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (obj instanceof Mock2) {
|
if (obj instanceof Mock2 && (iVal == ((Mock2) obj).iVal)) {
|
||||||
if (iVal == ((Mock2) obj).iVal) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue