提交 4da501a8 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Push negations down to improve readability

上级 e3f77f71
......@@ -244,7 +244,7 @@ public class Comparison extends Condition {
result = l == ValueNull.INSTANCE;
break;
case IS_NOT_NULL:
result = !(l == ValueNull.INSTANCE);
result = l != ValueNull.INSTANCE;
break;
default:
throw DbException.throwInternalError("type=" + compareType);
......
......@@ -956,7 +956,7 @@ public class Function extends Expression implements FunctionCall {
result = v0;
for (int i = 0; i < args.length; i++) {
Value v = getNullOrValue(session, args, values, i);
if (!(v == ValueNull.INSTANCE)) {
if (v != ValueNull.INSTANCE) {
result = v.convertTo(dataType);
break;
}
......@@ -968,7 +968,7 @@ public class Function extends Expression implements FunctionCall {
result = ValueNull.INSTANCE;
for (int i = 0; i < args.length; i++) {
Value v = getNullOrValue(session, args, values, i);
if (!(v == ValueNull.INSTANCE)) {
if (v != ValueNull.INSTANCE) {
v = v.convertTo(dataType);
if (result == ValueNull.INSTANCE) {
result = v;
......@@ -1005,7 +1005,7 @@ public class Function extends Expression implements FunctionCall {
// (expr, when, then, else)
// (expr, when, then, when, then)
// (expr, when, then, when, then, else)
if (!(v0 == ValueNull.INSTANCE)) {
if (v0 != ValueNull.INSTANCE) {
for (int i = 1, len = args.length - 1; i < len; i += 2) {
Value when = args[i].getValue(session);
if (database.areEqual(v0, when)) {
......
......@@ -222,8 +222,7 @@ public class MVStoreTool {
if (mapId == 0 && details) {
ByteBuffer data;
if (compressed) {
boolean fast = !((type & DataUtils.PAGE_COMPRESSED_HIGH) ==
DataUtils.PAGE_COMPRESSED_HIGH);
boolean fast = (type & DataUtils.PAGE_COMPRESSED_HIGH) != DataUtils.PAGE_COMPRESSED_HIGH;
Compressor compressor = getCompressor(fast);
int lenAdd = DataUtils.readVarInt(chunk);
int compLen = pageSize + start - chunk.position();
......
......@@ -177,7 +177,7 @@ public class JdbcUtils {
if (classFactory.match(className)) {
try {
Class<?> userClass = classFactory.loadClass(className);
if (!(userClass == null)) {
if (userClass != null) {
return (Class<Z>) userClass;
}
} catch (Exception e) {
......
......@@ -542,7 +542,7 @@ public class TestBatchUpdates extends TestBase {
trace("Count val is: " + count);
// make sure that we have the correct error code for
// the failed update.
if (!(batchUpdates[1] == -3 && count == 1)) {
if (batchUpdates[1] != -3 || count != 1) {
fail("insert failed");
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论