1 package org.apache.velocity.runtime.parser.node; 2 3 18 19 import org.apache.velocity.runtime.parser.Parser; 20 import org.apache.velocity.context.InternalContextAdapter; 21 22 import org.apache.velocity.exception.MethodInvocationException; 23 24 32 public class ASTOrNode extends SimpleNode 33 { 34 public ASTOrNode(int id) 35 { 36 super(id); 37 } 38 39 public ASTOrNode(Parser p, int id) 40 { 41 super(p, id); 42 } 43 44 45 public Object jjtAccept(ParserVisitor visitor, Object data) 46 { 47 return visitor.visit(this, data); 48 } 49 50 55 public Object value(InternalContextAdapter context ) 56 throws MethodInvocationException 57 { 58 return new Boolean ( evaluate( context ) ); 59 } 60 61 69 public boolean evaluate( InternalContextAdapter context) 70 throws MethodInvocationException 71 { 72 Node left = jjtGetChild(0); 73 Node right = jjtGetChild(1); 74 75 78 79 if (left != null && left.evaluate( context ) ) 80 return true; 81 82 85 86 if ( right != null && right.evaluate( context ) ) 87 return true; 88 89 return false; 90 } 91 } 92 93 94 95 96 97 | Popular Tags |