public static Object not (Object a) { return !isTrue(a); }
private Object booleanExecute(JtwigContext resolver) throws CalculateException { switch (operator) { case AND: return BooleanOperations.and(left.calculate(resolver), right.calculate(resolver)); case OR: return BooleanOperations.or(left.calculate(resolver), right.calculate(resolver)); } throw new CalculateException("Unknown operator " + operator.toString()); }
@Override public Object calculate(JtwigContext context) throws CalculateException { switch (operator) { case NOT: return BooleanOperations.not(operand.calculate(context)); case SUB: return MathOperations.mul(-1, operand.calculate(context)); } throw new CalculateException("Unknown operator "+operator); } }
private Object booleanExecute(JtwigContext resolver) throws CalculateException { switch (operator) { case AND: return BooleanOperations.and(left.calculate(resolver), right.calculate(resolver)); case OR: return BooleanOperations.or(left.calculate(resolver), right.calculate(resolver)); } throw new CalculateException("Unknown operator " + operator.toString()); }
@Override public Object calculate(JtwigContext context) throws CalculateException { switch (operator) { case NOT: return BooleanOperations.not(operand.calculate(context)); case SUB: return MathOperations.mul(-1, operand.calculate(context)); } throw new CalculateException("Unknown operator "+operator); } }
public static Object not (Object a) { return !isTrue(a); }
@Override public Object calculate(JtwigContext context) throws CalculateException { if (isTrue(booleanExpression.calculate(context))) return ifTrueExpression.calculate(context); else return ifFalseExpression.calculate(context); } }
@Override public boolean render(OutputStream outputStream, JtwigContext context) throws RenderException { try { if (isTrue(condition.calculate(context))) { return content.render(outputStream, context); } return false; } catch (CalculateException e) { throw new RenderException(e); } }
@Override public Object calculate(JtwigContext context) throws CalculateException { if (isTrue(booleanExpression.calculate(context))) return ifTrueExpression.calculate(context); else return ifFalseExpression.calculate(context); } }
@Override public boolean render(OutputStream outputStream, JtwigContext context) throws RenderException { try { if (isTrue(condition.calculate(context))) { return content.render(outputStream, context); } return false; } catch (CalculateException e) { throw new RenderException(e); } }
@Override public boolean render(OutputStream outputStream, JtwigContext context) throws RenderException { try { if (isTrue(conditionalExpression.calculate(context))) { return content.render(outputStream, context); } else { for (ElseIfExpression exp : elseIfExpressions) { if (exp.render(outputStream, context)) return true; } if (elseExpression != null) { return elseExpression.render(outputStream, context); } return true; } } catch (CalculateException e) { throw new RenderException(e); } }
@Override public boolean render(OutputStream outputStream, JtwigContext context) throws RenderException { try { if (isTrue(conditionalExpression.calculate(context))) { return content.render(outputStream, context); } else { for (ElseIfExpression exp : elseIfExpressions) { if (exp.render(outputStream, context)) return true; } if (elseExpression != null) { return elseExpression.render(outputStream, context); } return true; } } catch (CalculateException e) { throw new RenderException(e); } }