예제 #1
0
  public Negation(
      final char[] expr,
      final int start,
      final int offset,
      final int fields,
      final ParserContext pCtx) {
    super(pCtx);
    this.expr = expr;
    this.start = start;
    this.offset = offset;

    if ((fields & COMPILE_IMMEDIATE) != 0) {
      if (((this.stmt = (ExecutableStatement) subCompileExpression(expr, start, offset, pCtx))
                  .getKnownEgressType()
              != null)
          && (!ParseTools.boxPrimitive(stmt.getKnownEgressType())
              .isAssignableFrom(Boolean.class))) {
        throw new CompileException(
            "negation operator cannot be applied to non-boolean type", expr, start);
      }
    }
  }
예제 #2
0
 @Override
 public Object getReducedValueAccelerated(
     final Object ctx, final Object thisValue, final VariableResolverFactory factory) {
   return !((Boolean) stmt.getValue(ctx, thisValue, factory));
 }