Appends a NOT expression to this expression.

@param exp the builder containing the expression to NOT with the current expression.
@return this ExpressionBuilder.
496955
public ExpressionBuilder not(final ExpressionBuilder exp) {
		// Note - NOT Expressions are not added to the stack (like the other group expressions AND and OR) and are
		// treated the same as a "compare" expression.
		// It is expected a NOT Expression is used by itself or with an AND or NOT.
		GroupExpression not = new GroupExpression(Type.NOT);
		not.add(exp.expression.getExpression());

		appendExpression(not);

		return this;
	}
1026580
protected void generateExpressionBuilderImpl() {
		final TypeReference builderInterface = getExpressionBuilderInterface();
		final TypeReference builder = getExpressionBuilderImpl();
		final StringConcatenationClient content = new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				it.append("/** Builder of a " + getLanguageName() //$NON-NLS-1$
						+ " XExpression."); //$NON-NLS-1$
				it.newLine();
				it.append(" */"); //$NON-NLS-1$
				it.newLine();
				it.append("@SuppressWarnings(\"all\")"); //$NON-NLS-1$
				it.newLine();
				it.append("public class "); //$NON-NLS-1$
				it.append(builder.getSimpleName());
				it.append(" extends "); //$NON-NLS-1$
				it.append(getAbstractBuilderImpl());
				it.append(" implements "); //$NON-NLS-1$
				it.append(builderInterface);
				it.append(" {"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append(generateMembers(false, false));
				it.append("}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
			}
		};
		final JavaFileAccess javaFile = getFileAccessFactory().createJavaFile(builder, content);
		javaFile.writeTo(getSrcGen());
	}
560241
public Expr call(String method, Expr argument1) {
      return new Expr(
        expr + "." + method + "(" + argument1.toSwiftCode() + ")",
        false,
        containsThrow || argument1.containsThrow,
        false);
    }
736375
private void _buildNotBinding(
                    final NotBinding binding,
                    final StringBuilder stmt,
                    final List<Object> params
                    )
    {
        stmt.append( " NOT (" );
        _buildBinding( binding, stmt, params );
        stmt.append( ")" );
    }
1050434
@Override
  public void exitNotExpression(GDLParser.NotExpressionContext ctx) {
    if (!ctx.NOT().isEmpty()) {
      Predicate not = new Not(currentPredicates.pop());
      currentPredicates.add(not);
    }
  }
495324
@SuppressWarnings("null")
  public static
  @NonNull
  <T> T notNull(
    final @Nullable T x,
    final @NonNull String message)
  {
    if (x == null) {
      final StringBuilder text = new StringBuilder(32 + message.length());
      text.append("Expression evaluated to null: ");
      text.append(message);
      throw new NullCheckException(text.toString());
    }
    return x;
  }
807698
public static function not(Expr $operand) : Expr
    {
        if ($operand instanceof self) {
            if ($operand->getOperator() === self::IS_NULL) {
                return self::isNotNull($operand->getOperand());
            } elseif ($operand->getOperator() === self::IS_NOT_NULL) {
                return self::isNull($operand->getOperand());
            } elseif ($operand->getOperator() === self::NOT) {
                return $operand->getOperand();
            }
        }

        return new self(self::NOT, $operand, new Boolean());
    }
408027
public Formula not(final Formula operand) {
    if (operand.type() == LITERAL || operand.type() == FALSE || operand.type() == TRUE || operand.type() == NOT)
      return operand.negate();
    Not not = this.nots.get(operand);
    if (not == null) {
      not = new Not(operand, this);
      this.nots.put(operand, not);
    }
    return not;
  }
1142279
@Override
    public BooleanExpression not() {
        if (not == null) {
            // uses this, because it makes unwrapping easier
            not = Expressions.booleanOperation(Ops.NOT, this);
        }
        return not;
    }
795288
public static ExprViewItem not( ViewItemBuilder<?> expression, ViewItemBuilder<?>... expressions) {
        return new ExistentialExprViewItem( Condition.Type.NOT, and( expression, expressions) );
    }
1090484
@SuppressWarnings("unchecked")
    public static Expression<String> likeToRegex(Expression<String> expr, boolean matchStartAndEnd) {
        // TODO : this should take the escape character into account
        if (expr instanceof Constant<?>) {
            final String like = expr.toString();
            final StringBuilder rv = new StringBuilder(like.length() + 4);
            if (matchStartAndEnd && !like.startsWith("%")) {
                rv.append('^');
            }
            for (int i = 0; i < like.length(); i++) {
                char ch = like.charAt(i);
                if (ch == '.' || ch == '*' || ch == '?') {
                    rv.append('\\');
                } else if (ch == '%') {
                    rv.append(".*");
                    continue;
                } else if (ch == '_') {
                    rv.append('.');
                    continue;
                }
                rv.append(ch);
            }
            if (matchStartAndEnd && !like.endsWith("%")) {
                rv.append('$');
            }
            if (!like.equals(rv.toString())) {
                return ConstantImpl.create(rv.toString());
            }
        } else if (expr instanceof Operation<?>) {
            Operation<?> o = (Operation<?>) expr;
            if (o.getOperator() == Ops.CONCAT) {
                Expression<String> lhs = likeToRegex((Expression<String>) o.getArg(0), false);
                Expression<String> rhs = likeToRegex((Expression<String>) o.getArg(1), false);
                if (lhs != o.getArg(0) || rhs != o.getArg(1)) {
                    return operation(String.class, Ops.CONCAT, lhs, rhs);
                }
            }
        }
        return expr;
    }
1362669
@NonNull
    public Expression add(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new BinaryExpression(this, expression, BinaryExpression.OpType.Add);
    }
1011667
public static <T extends Enum<T>> EnumExpression<T> asEnum(Expression<T> expr) {
        Expression<T> underlyingMixin = ExpressionUtils.extract(expr);
        if (underlyingMixin instanceof PathImpl) {
            return new EnumPath<T>((PathImpl<T>) underlyingMixin);
        } else if (underlyingMixin instanceof OperationImpl) {
            return new EnumOperation<T>((OperationImpl<T>) underlyingMixin);
        } else if (underlyingMixin instanceof TemplateExpressionImpl) {
            return new EnumTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin);
        } else {
            return new EnumExpression<T>(underlyingMixin) {

                private static final long serialVersionUID = 949681836002045152L;

                @Override
                public <R, C> R accept(Visitor<R, C> v, C context) {
                    return this.mixin.accept(v, context);
                }

            };
        }

    }
963626
public void setExpression(Expression exp)
  {
  	if(null != m_mainExp)
    	exp.exprSetParent(m_mainExp.exprGetParent()); // a bit bogus
    m_mainExp = exp;
  }
1022363
public static Expression logicalNot(final Expression baseExpr) {
    baseExpr.checkAssignableTo(Type.BOOLEAN_TYPE);
    checkArgument(baseExpr.resultType().equals(Type.BOOLEAN_TYPE), "not a boolean expression");
    return new Expression(Type.BOOLEAN_TYPE, baseExpr.features()) {
      @Override
      protected void doGen(CodeBuilder mv) {
        baseExpr.gen(mv);
        // Surprisingly, java bytecode uses a branch (instead of 'xor 1' or something) to implement
        // this. This is most likely useful for allowing true to be represented by any non-zero
        // number.
        Label ifTrue = mv.newLabel();
        Label end = mv.newLabel();
        mv.ifZCmp(Opcodes.IFNE, ifTrue); // if not 0 goto ifTrue
        mv.pushBoolean(true);
        mv.goTo(end);
        mv.mark(ifTrue);
        mv.pushBoolean(false);
        mv.mark(end);
      }
    };
  }
122320
public static function fromExpression(ExpressionNode $expr) {
    $not = new static();
    $not->addChild(Token::not(), 'operator');
    /** @var \Pharborist\Node $expr */
    $not->addChild($expr->remove(), 'operand');
    return $not;
  }
813508
public static SoyExpression isNonNull(final Expression expr) {
    if (BytecodeUtils.isPrimitive(expr.resultType())) {
      return SoyExpression.TRUE;
    }
    return SoyExpression.forBool(
        new Expression(Type.BOOLEAN_TYPE, expr.features()) {
          @Override
          protected void doGen(CodeBuilder adapter) {
            expr.gen(adapter);
            Label isNull = new Label();
            adapter.ifNull(isNull);
            // non-null
            adapter.pushBoolean(true);
            Label end = new Label();
            adapter.goTo(end);
            adapter.mark(isNull);
            adapter.pushBoolean(false);
            adapter.mark(end);
          }
        });
  }