Package com.google.template.soy.exprtree

Examples of com.google.template.soy.exprtree.BooleanNode


  public static PrimitiveNode convertPrimitiveDataToExpr(PrimitiveData primitiveData) {

    if (primitiveData instanceof StringData) {
      return new StringNode(primitiveData.stringValue());
    } else if (primitiveData instanceof BooleanData) {
      return new BooleanNode(primitiveData.booleanValue());
    } else if (primitiveData instanceof IntegerData) {
      return new IntegerNode(primitiveData.integerValue());
    } else if (primitiveData instanceof FloatData) {
      return new FloatNode(primitiveData.floatValue());
    } else if (primitiveData instanceof NullData) {
View Full Code Here


   */
  private static class ReplaceHasDataFunctionInExprVisitor extends AbstractExprNodeVisitor<Void> {

    @Override protected void visitFunctionNode(FunctionNode node) {
      if (node.getFunctionName().equals("hasData")) {
        node.getParent().replaceChild(node, new BooleanNode(true));
      }
    }
View Full Code Here

      return// cannot simplify
    }

    ExprNode replacementNode;
    if (operand0 != null && operand1 != null) {
      replacementNode = new BooleanNode(operand0.toBoolean() && operand1.toBoolean());
    } else if (operand0 != null) {
      replacementNode = operand0.toBoolean() ? node.getChild(1) : new BooleanNode(false);
    } else /*(operand1 != null)*/ {
      replacementNode = operand1.toBoolean() ? node.getChild(0) : new BooleanNode(false);
    }

    node.getParent().replaceChild(node, replacementNode);
  }
View Full Code Here

      return// cannot simplify
    }

    ExprNode replacementNode;
    if (operand0 != null && operand1 != null) {
      replacementNode = new BooleanNode(operand0.toBoolean() || operand1.toBoolean());
    } else if (operand0 != null) {
      replacementNode = operand0.toBoolean() ? new BooleanNode(true) : node.getChild(1);
    } else /*(operand1 != null)*/ {
      replacementNode = operand1.toBoolean() ? new BooleanNode(true) : node.getChild(0);
    }

    node.getParent().replaceChild(node, replacementNode);
  }
View Full Code Here

TOP

Related Classes of com.google.template.soy.exprtree.BooleanNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.