class NegationExpression extends ComplexExpression {

    
    private static final long serialVersionUID = -7131967162611145337L;


    private static final Logger logger = LoggerFactory.getLogger(NegationExpression.class);

    
    private static final String OPERATOR_1 = "!";
    private static final String OPERATOR_2 = "not";
    // Future proof, just in case in the future we add "not" as an operator
    static final String[] OPERATORS = new String[] {OPERATOR_1, OPERATOR_2};

    
    private final Expression operand;

    
    public NegationExpression(final Expression operand) {
        super();
        Validate.notNull(operand, "Operand cannot be null");
        this.operand = operand;
    }
    
    public Expression getOperand() {
        return this.operand;
    }

    
    
    @Override
    public String getStringRepresentation() {
        final StringBuilder sb = new StringBuilder();
        sb.append(OPERATOR_1);
        if (this.operand instanceof ComplexExpression) {
            sb.append(Expression.NESTING_START_CHAR);
            sb.append(this.operand);
            sb.append(Expression.NESTING_END_CHAR);
        } else {
            sb.append(this.operand);
        }
        return sb.toString();
    }
    
    
    
    
    public static ExpressionParsingState composeNegationExpression(
            final ExpressionParsingState state, final int nodeIndex) {<FILL_FUNCTION_BODY>}
    
    

    static Object executeNegation(
            final IExpressionContext context,
            final NegationExpression expression, final StandardExpressionExecutionContext expContext) {

        if (logger.isTraceEnabled()) {
            logger.trace("[THYMELEAF][{}] Evaluating negation expression: \"{}\"", TemplateEngine.threadIndex(), expression.getStringRepresentation());
        }

        final Object operandValue = expression.getOperand().execute(context, expContext);

        final boolean operandBooleanValue = EvaluationUtils.evaluateAsBoolean(operandValue);
        
        return Boolean.valueOf(!operandBooleanValue);
        
    }

    
}


        // Returning "state" means "try next in chain" or "success"
        // Returning "null" means parsing error

        final String input = state.get(nodeIndex).getInput();

        if (StringUtils.isEmptyOrWhitespace(input)) {
            return null;
        }

        final String trimmedInput = input.trim(); 
        
        // Trying to fail quickly...
        String operatorFound = null;
        int operatorPos = trimmedInput.lastIndexOf(OPERATOR_1);
        if (operatorPos == -1) {
            operatorPos = trimmedInput.lastIndexOf(OPERATOR_2);
            if (operatorPos == -1) {
                return state;
            }
            operatorFound = OPERATOR_2;
        } else {
            operatorFound = OPERATOR_1;
        }

        if (operatorPos != 0) {
            // The operator (any of them) should be at the first character, after trimming.
            return state;
        }
        
        final String operandStr = trimmedInput.substring(operatorFound.length());

        final Expression operandExpr = ExpressionParsingUtil.parseAndCompose(state, operandStr);
        if (operandExpr == null) {
            return null;
        }

        final NegationExpression minusExpression = new NegationExpression(operandExpr);
        state.setNode(nodeIndex, minusExpression);
        
        return state;
        
    
<methods><variables>private static final long serialVersionUID