org.h2.value.Value.negate()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.h2.value.Value.negate()方法的一些代码示例,展示了Value.negate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.negate()方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:negate

Value.negate介绍

[英]Return -value if this value support arithmetic operations.
[中]Return-如果此值支持算术运算,则返回值。

代码示例

代码示例来源:origin: com.h2database/h2

@Override
public Value getValue(Session session) {
  Value v = condition.getValue(session);
  if (v == ValueNull.INSTANCE) {
    return v;
  }
  return v.convertTo(Value.BOOLEAN).negate();
}

代码示例来源:origin: com.h2database/h2

private int readInt() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");
  }
  if (minus) {
    // must do that now, otherwise Integer.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  int i = currentValue.getInt();
  read();
  return i;
}

代码示例来源:origin: com.h2database/h2

private long readLong() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "long");
  }
  if (minus) {
    // must do that now, otherwise Long.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  long i = currentValue.getLong();
  read();
  return i;
}

代码示例来源:origin: com.h2database/h2

@Override
public Expression optimize(Session session) {
  Expression e2 = condition.getNotIfPossible(session);
  if (e2 != null) {
    return e2.optimize(session);
  }
  Expression expr = condition.optimize(session);
  if (expr.isConstant()) {
    Value v = expr.getValue(session);
    if (v == ValueNull.INSTANCE) {
      return ValueExpression.getNull();
    }
    return ValueExpression.get(v.convertTo(Value.BOOLEAN).negate());
  }
  condition = expr;
  return this;
}

代码示例来源:origin: com.h2database/h2

return l == ValueNull.INSTANCE ? l : l.negate();
case CONCAT: {
  Mode mode = session.getDatabase().getMode();

代码示例来源:origin: com.h2database/h2

switch (info.type) {
case ABS:
  result = v0.getSignum() >= 0 ? v0 : v0.negate();
  break;
case ACOS:

代码示例来源:origin: com.h2database/h2

read();
if (currentTokenType == VALUE) {
  r = ValueExpression.get(currentValue.negate());
  if (r.getType() == Value.LONG &&
      r.getValue(session).getLong() == Integer.MIN_VALUE) {

代码示例来源:origin: com.eventsourcing/h2

@Override
public Value getValue(Session session) {
  Value v = condition.getValue(session);
  if (v == ValueNull.INSTANCE) {
    return v;
  }
  return v.convertTo(Value.BOOLEAN).negate();
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

public Value getValue(Session session) throws SQLException {
  Value v = condition.getValue(session);
  if (v == ValueNull.INSTANCE) {
    return v;
  }
  return v.convertTo(Value.BOOLEAN).negate();
}

代码示例来源:origin: org.wowtools/h2

@Override
public Value getValue(Session session) {
  Value v = condition.getValue(session);
  if (v == ValueNull.INSTANCE) {
    return v;
  }
  return v.convertTo(Value.BOOLEAN).negate();
}

代码示例来源:origin: com.eventsourcing/h2

private long readLong() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "long");
  }
  if (minus) {
    // must do that now, otherwise Long.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  long i = currentValue.getLong();
  read();
  return i;
}

代码示例来源:origin: com.eventsourcing/h2

private int readInt() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");
  }
  if (minus) {
    // must do that now, otherwise Integer.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  int i = currentValue.getInt();
  read();
  return i;
}

代码示例来源:origin: org.wowtools/h2

private long readLong() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "long");
  }
  if (minus) {
    // must do that now, otherwise Long.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  long i = currentValue.getLong();
  read();
  return i;
}

代码示例来源:origin: org.wowtools/h2

private int readInt() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");
  }
  if (minus) {
    // must do that now, otherwise Integer.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  int i = currentValue.getInt();
  read();
  return i;
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

return l == ValueNull.INSTANCE ? l : l.negate();
case CONCAT: {
  Mode mode = session.getDatabase().getMode();

代码示例来源:origin: com.eventsourcing/h2

return l == ValueNull.INSTANCE ? l : l.negate();
case CONCAT: {
  Mode mode = session.getDatabase().getMode();

代码示例来源:origin: org.wowtools/h2

return l == ValueNull.INSTANCE ? l : l.negate();
case CONCAT: {
  Mode mode = session.getDatabase().getMode();

代码示例来源:origin: com.eventsourcing/h2

@Override
public Expression optimize(Session session) {
  Expression e2 = condition.getNotIfPossible(session);
  if (e2 != null) {
    return e2.optimize(session);
  }
  Expression expr = condition.optimize(session);
  if (expr.isConstant()) {
    Value v = expr.getValue(session);
    if (v == ValueNull.INSTANCE) {
      return ValueExpression.getNull();
    }
    return ValueExpression.get(v.convertTo(Value.BOOLEAN).negate());
  }
  condition = expr;
  return this;
}

代码示例来源:origin: org.wowtools/h2

@Override
public Expression optimize(Session session) {
  Expression e2 = condition.getNotIfPossible(session);
  if (e2 != null) {
    return e2.optimize(session);
  }
  Expression expr = condition.optimize(session);
  if (expr.isConstant()) {
    Value v = expr.getValue(session);
    if (v == ValueNull.INSTANCE) {
      return ValueExpression.getNull();
    }
    return ValueExpression.get(v.convertTo(Value.BOOLEAN).negate());
  }
  condition = expr;
  return this;
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

public Expression optimize(Session session) throws SQLException {
  if (!SysProperties.OPTIMIZE_NOT) {
    condition = condition.optimize(session);
    return this;
  }
  Expression e2 = condition.getNotIfPossible(session);
  if (e2 != null) {
    return e2.optimize(session);
  }
  Expression expr = condition.optimize(session);
  if (expr.isConstant()) {
    Value v = expr.getValue(session);
    if (v == ValueNull.INSTANCE) {
      return ValueExpression.NULL;
    }
    return ValueExpression.get(v.convertTo(Value.BOOLEAN).negate());
  }
  condition = expr;
  return this;
}

相关文章

微信公众号

最新文章

更多