Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 19265 invoked from network); 30 Apr 2006 03:14:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 Apr 2006 03:14:27 -0000 Received: (qmail 67620 invoked by uid 500); 30 Apr 2006 03:14:24 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 67544 invoked by uid 500); 30 Apr 2006 03:14:24 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 67533 invoked by uid 500); 30 Apr 2006 03:14:24 -0000 Received: (qmail 67528 invoked by uid 99); 30 Apr 2006 03:14:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Apr 2006 20:14:24 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 29 Apr 2006 20:14:23 -0700 Received: (qmail 19145 invoked by uid 65534); 30 Apr 2006 03:14:03 -0000 Message-ID: <20060430031403.19144.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r398272 - in /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser: ASTOrNode.java ASTReference.java Date: Sun, 30 Apr 2006 03:14:02 -0000 To: commons-cvs@jakarta.apache.org From: dion@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: dion Date: Sat Apr 29 20:14:01 2006 New Revision: 398272 URL: http://svn.apache.org/viewcvs?rev=398272&view=rev Log: Checkstyle Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java?rev=398272&r1=398271&r2=398272&view=diff ============================================================================== --- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java (original) +++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java Sat Apr 29 20:14:01 2006 @@ -25,19 +25,31 @@ * @version $Id$ */ public class ASTOrNode extends SimpleNode { + /** + * Create the node given an id. + * + * @param id node id. + */ public ASTOrNode(int id) { super(id); } + /** + * Create a node with the given parser and id. + * + * @param p a parser. + * @param id node id. + */ public ASTOrNode(Parser p, int id) { super(p, id); } - /** Accept the visitor. * */ + /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } + /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); boolean leftValue = Coercion.coerceBoolean(left).booleanValue(); Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java?rev=398272&r1=398271&r2=398272&view=diff ============================================================================== --- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java (original) +++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java Sat Apr 29 20:14:01 2006 @@ -24,29 +24,54 @@ * @version $Id$ */ public class ASTReference extends SimpleNode { - SimpleNode root; + /** first variable in the expression. */ + protected SimpleNode root; + /** + * Create the node given an id. + * + * @param id node id. + */ public ASTReference(int id) { super(id); } + /** + * Create a node with the given parser and id. + * + * @param p a parser. + * @param id node id. + */ public ASTReference(Parser p, int id) { super(p, id); } - /** Accept the visitor. * */ + /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } + /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return execute(null, jc); } + /** Store the first child as {@link ASTReference#root root}. */ public void jjtClose() { root = (SimpleNode) jjtGetChild(0); } + /** + * evaluate each piece of the reference. + * + * e.g. foo.bar.woogie[2].name, foo is our 'root', and we need to + * evaluate 'bar.woogie[2].name' relative to foo. + * + * @param jc the {@link JexlContext} to evaluate against. + * @param obj not used. root.value(jc) is used instead. + * @return the value of the array expression. + * @throws Exception on any error + */ public Object execute(Object obj, JexlContext jc) throws Exception { Object o = root.value(jc); @@ -89,6 +114,13 @@ return varName.toString(); } + /** + * Gets the variable name of {@link ASTReference#root root}. + * @return the identifier. + * @throws Exception on any error + * @see ASTIdentifier#getIdentifierString() + * @see ASTArrayAccess#getIdentifierString() + */ public String getRootString() throws Exception { if (root instanceof ASTIdentifier) { return ((ASTIdentifier) root).getIdentifierString(); --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org