You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2006/04/29 18:15:02 UTC

svn commit: r398194 - in /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser: ASTFalseNode.java ASTFloatLiteral.java ASTForeachStatement.java

Author: dion
Date: Sat Apr 29 09:14:58 2006
New Revision: 398194

URL: http://svn.apache.org/viewcvs?rev=398194&view=rev
Log:
CheckStyle ASTF*

Modified:
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java?rev=398194&r1=398193&r2=398194&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java Sat Apr 29 09:14:58 2006
@@ -25,10 +25,21 @@
  */
 public class ASTFalseNode extends SimpleNode {
 
+    /**
+     * Create the node given an id.
+     * 
+     * @param id node id.
+     */
     public ASTFalseNode(int id) {
         super(id);
     }
 
+    /**
+     * Create a node with the given parser and id.
+     * 
+     * @param p a parser.
+     * @param id node id.
+     */
     public ASTFalseNode(Parser p, int id) {
         super(p, id);
     }

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.java?rev=398194&r1=398193&r2=398194&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.java Sat Apr 29 09:14:58 2006
@@ -25,21 +25,34 @@
  * @version $Id$
  */
 public class ASTFloatLiteral extends SimpleNode {
+    /** the value of the literal. */
     protected Float val;
 
+    /**
+     * Create the node given an id.
+     * 
+     * @param id node id.
+     */
     public ASTFloatLiteral(int id) {
         super(id);
     }
 
+    /**
+     * Create a node with the given parser and id.
+     * 
+     * @param p a parser.
+     * @param id node id.
+     */
     public ASTFloatLiteral(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 val;
     }

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java?rev=398194&r1=398193&r2=398194&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.java Sat Apr 29 09:14:58 2006
@@ -31,29 +31,48 @@
 public class ASTForeachStatement extends SimpleNode {
     /** dummy velocity info. */
     private static final Info DUMMY = new Info("", 1, 1);
+    /** index of the loop variable. */
+    private static final int VAR_INDEX = 0;
+    /** index of the items. */
+    private static final int ITEMS_INDEX = 1;
+    /** index of the code to execute. */
+    private static final int STATEMENT_INDEX = 2;
 
+
+    /**
+     * Create the node given an id.
+     * 
+     * @param id node id.
+     */
     public ASTForeachStatement(int id) {
         super(id);
     }
 
+    /**
+     * Create a node with the given parser and id.
+     * 
+     * @param p a parser.
+     * @param id node id.
+     */
     public ASTForeachStatement(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 result = null;
         /* first child is the loop variable */
-        ASTReference loopVariable = (ASTReference) jjtGetChild(0);
+        ASTReference loopVariable = (ASTReference) jjtGetChild(VAR_INDEX);
         /* second child is the variable to iterate */
-        SimpleNode iterable = (SimpleNode) jjtGetChild(1);
+        SimpleNode iterable = (SimpleNode) jjtGetChild(ITEMS_INDEX);
         Object iterableValue = iterable.value(jc);
         // make sure there is a value to iterate on and a statement to execute
-        if (iterableValue != null && jjtGetNumChildren() >= 3) {
+        if (iterableValue != null && jjtGetNumChildren() >= (STATEMENT_INDEX + 1)) {
             /* third child is the statement to execute */
             SimpleNode statement = (SimpleNode) jjtGetChild(2);
             // get an iterator for the collection/array etc via the



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org