1 package org.apache.velocity.runtime.parser.node; 2 3 18 19 20 28 29 30 import java.io.Writer ; 31 import java.io.IOException ; 32 33 import org.apache.velocity.context.InternalContextAdapter; 34 import org.apache.velocity.runtime.parser.*; 35 36 import org.apache.velocity.exception.MethodInvocationException; 37 import org.apache.velocity.exception.ParseErrorException; 38 import org.apache.velocity.exception.ResourceNotFoundException; 39 40 41 public class ASTIfStatement extends SimpleNode 42 { 43 public ASTIfStatement(int id) 44 { 45 super(id); 46 } 47 48 public ASTIfStatement(Parser p, int id) 49 { 50 super(p, id); 51 } 52 53 54 public Object jjtAccept(ParserVisitor visitor, Object data) 55 { 56 return visitor.visit(this, data); 57 } 58 59 public boolean render( InternalContextAdapter context, Writer writer) 60 throws IOException ,MethodInvocationException, 61 ResourceNotFoundException, ParseErrorException 62 { 63 68 if (jjtGetChild(0).evaluate(context)) 69 { 70 jjtGetChild(1).render(context, writer); 71 return true; 72 } 73 74 int totalNodes = jjtGetNumChildren(); 75 76 85 for (int i = 2; i < totalNodes; i++) 86 { 87 if (jjtGetChild(i).evaluate(context)) 88 { 89 jjtGetChild(i).render(context, writer); 90 return true; 91 } 92 } 93 94 99 return true; 100 } 101 102 public void process( InternalContextAdapter context, ParserVisitor visitor) 103 { 104 } 105 } 106 107 108 109 110 111 112 | Popular Tags |