Author: dion
Date: Thu Apr 27 06:42:09 2006
New Revision: 397541

URL: http://svn.apache.org/viewcvs?rev=397541&view=rev
Log:
More 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
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java
    
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.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=397541&r1=397540&r2=397541&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
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,42 +19,34 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  || and 'or'
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- *  @version $Id$
+ * || and 'or'.
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @version $Id$
  */
-public class ASTOrNode extends SimpleNode
-{
-    public ASTOrNode(int id)
-    {
+public class ASTOrNode extends SimpleNode {
+    public ASTOrNode(int id) {
         super(id);
     }
 
-    public ASTOrNode(Parser p, int id)
-    {
+    public ASTOrNode(Parser p, int id) {
         super(p, id);
     }
 
-
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
-    public Object value(JexlContext jc)
-        throws Exception
-    {
+    public Object value(JexlContext jc) throws Exception {
         Object left = ((SimpleNode) jjtGetChild(0)).value(jc);
-        boolean leftValue = Coercion.coerceBoolean(left).booleanValue(); 
+        boolean leftValue = Coercion.coerceBoolean(left).booleanValue();
 
         /*
          * coercion rules
          */
-        return (leftValue
-                || Coercion.coerceBoolean(((SimpleNode) 
jjtGetChild(1)).value(jc))
-                                       .booleanValue()) ?
-            Boolean.TRUE : Boolean.FALSE;
+        return (leftValue || Coercion.coerceBoolean(((SimpleNode) 
jjtGetChild(1)).value(jc)).booleanValue()) 
+            ? Boolean.TRUE
+            : Boolean.FALSE;
     }
 }

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=397541&r1=397540&r2=397541&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
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,97 +18,86 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  reference - any variable expression
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- *  @version $Id$
+ * reference - any variable expression.
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @version $Id$
  */
-public class ASTReference extends SimpleNode
-{
+public class ASTReference extends SimpleNode {
     SimpleNode root;
 
-    public ASTReference(int id)
-    {
+    public ASTReference(int id) {
         super(id);
     }
 
-    public ASTReference(Parser p, int id)
-    {
+    public ASTReference(Parser p, int id) {
         super(p, id);
     }
 
-
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
-    public Object value(JexlContext jc)
-        throws Exception
-    {
-        return  execute(null,jc);
+    public Object value(JexlContext jc) throws Exception {
+        return execute(null, jc);
     }
 
-    public void jjtClose()
-    {
+    public void jjtClose() {
         root = (SimpleNode) jjtGetChild(0);
     }
 
-    public Object execute(Object obj, JexlContext jc)
-             throws Exception
-     {
-         Object o = root.value(jc);
-
-         /*
-          * ignore the first child - it's our identifier
-          */
-         for(int i=1; i<jjtGetNumChildren(); i++)
-         {
-             o = ( (SimpleNode) jjtGetChild(i)).execute(o,jc);
-
-             // check for a variable in the context named
-             // child0.child1.child2 etc
-             if(o == null) {
-                 String varName = getIdentifierToDepth(i);
-                 o = jc.getVars().get(varName);
-             }
-         }
+    public Object execute(Object obj, JexlContext jc) throws Exception {
+        Object o = root.value(jc);
 
-         return o;
-     }
+        /*
+         * ignore the first child - it's our identifier
+         */
+        for (int i = 1; i < jjtGetNumChildren(); i++) {
+            o = ((SimpleNode) jjtGetChild(i)).execute(o, jc);
+
+            // check for a variable in the context named
+            // child0.child1.child2 etc
+            if (o == null) {
+                String varName = getIdentifierToDepth(i);
+                o = jc.getVars().get(varName);
+            }
+        }
+
+        return o;
+    }
 
     /**
-     * This method returns a variable from this identifier and
-     * it's children. For an expression like 'a.b.c', a is child
-     * zero, b is child 1 and c is child 2.
-     *  
+     * This method returns a variable from this identifier and it's children.
+     * For an expression like 'a.b.c', a is child zero, b is child 1 and c is
+     * child 2.
+     * 
      * @param i the depth of the child nodes to go to
-     * @return the a dotted variable from this identifier and it's
-     *    child nodes.
+     * @return the a dotted variable from this identifier and it's child nodes.
      */
     private String getIdentifierToDepth(int i) {
         StringBuffer varName = new StringBuffer();
-         for (int j = 0; j <=i; j++) {
-             SimpleNode node = (SimpleNode) jjtGetChild(j);
-             if (node instanceof ASTIdentifier) {
-               varName.append(((ASTIdentifier)node).getIdentifierString());
-               if (j != i) varName.append('.');
-             }
-         }
+        for (int j = 0; j <= i; j++) {
+            SimpleNode node = (SimpleNode) jjtGetChild(j);
+            if (node instanceof ASTIdentifier) {
+                varName.append(((ASTIdentifier) node).getIdentifierString());
+                if (j != i) {
+                    varName.append('.');
+                }
+            }
+        }
         return varName.toString();
     }
 
-    public String getRootString()
-        throws Exception
-    {
-        if ( root instanceof ASTIdentifier)
+    public String getRootString() throws Exception {
+        if (root instanceof ASTIdentifier) {
             return ((ASTIdentifier) root).getIdentifierString();
+        }
 
-        if (root instanceof ASTArrayAccess)
+        if (root instanceof ASTArrayAccess) {
             return ((ASTArrayAccess) root).getIdentifierString();
+        }
 
-        throw new Exception("programmer error : ASTReference : root not known"
-                    + root );
+        throw new Exception("programmer error : ASTReference : root not known" 
+ root);
     }
 }

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.java
 Thu Apr 27 06:42:09 2006
@@ -1,5 +1,18 @@
-/* Generated By:JJTree: Do not edit this line. ASTReferenceExpression.java */
-
+/*
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.commons.jexl.parser;
 
 import org.apache.commons.jexl.JexlContext;
@@ -8,25 +21,23 @@
  * variable; A reference by itself.
  */
 public class ASTReferenceExpression extends SimpleNode {
-  public ASTReferenceExpression(int id) {
-    super(id);
-  }
-
-  public ASTReferenceExpression(Parser p, int id) {
-    super(p, id);
-  }
-
-
-  /** Accept the visitor. **/
-  public Object jjtAccept(ParserVisitor visitor, Object data) {
-    return visitor.visit(this, data);
-  }
-  
-  /**
-   * @return the value of the expression 
-   */
-  public Object value(JexlContext context) throws Exception
-  {
-      return ((SimpleNode) jjtGetChild(0)).value(context);
-  }
+    public ASTReferenceExpression(int id) {
+        super(id);
+    }
+
+    public ASTReferenceExpression(Parser p, int id) {
+        super(p, id);
+    }
+
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
+        return visitor.visit(this, data);
+    }
+
+    /**
+     * @return the value of the expression
+     */
+    public Object value(JexlContext context) throws Exception {
+        return ((SimpleNode) jjtGetChild(0)).value(context);
+    }
 }

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.java
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002-2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,80 +26,59 @@
 import java.lang.reflect.Array;
 
 /**
- *  generalized size() function for all classes we can think of
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- *  @author <a href="[EMAIL PROTECTED]">Mark H. Wilkinson</a>
- *  @version $Id$
+ * generalized size() function for all classes we can think of
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @author <a href="[EMAIL PROTECTED]">Mark H. Wilkinson</a>
+ * @version $Id$
  */
-public class ASTSizeFunction extends SimpleNode
-{
-    public ASTSizeFunction(int id)
-    {
+public class ASTSizeFunction extends SimpleNode {
+    public ASTSizeFunction(int id) {
         super(id);
     }
 
-    public ASTSizeFunction(Parser p, int id)
-    {
+    public ASTSizeFunction(Parser p, int id) {
         super(p, id);
     }
 
-
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
-
-    public Object value(JexlContext jc)
-        throws Exception
-    {
+    public Object value(JexlContext jc) throws Exception {
         SimpleNode arg = (SimpleNode) jjtGetChild(0);
 
         Object val = arg.value(jc);
 
-        if (val == null)
-        {
+        if (val == null) {
             throw new Exception("size() : null arg");
         }
-        
+
         return new Integer(ASTSizeFunction.sizeOf(val));
     }
-    
-    public static int sizeOf(Object val)
-        throws Exception
-    {
-        if (val instanceof List)
-        {
-            return ((List)val).size();
-        }
-        else if (val.getClass().isArray())
-        {
+
+    public static int sizeOf(Object val) throws Exception {
+        if (val instanceof List) {
+            return ((List) val).size();
+        } else if (val.getClass().isArray()) {
             return Array.getLength(val);
-        }
-        else if (val instanceof Map)
-        {
-            return ((Map)val).size();
-        }
-        else if (val instanceof String)
-        {
-            return ((String)val).length();
-        }
-        else if (val instanceof Set)
-        {
-            return ((Set)val).size();
-        }
-        else {
-               // check if there is a size method on the object that returns 
an integer
-               // and if so, just use it
-               Object[] params = new Object[0];
-               Info velInfo = new Info("",1,1);
+        } else if (val instanceof Map) {
+            return ((Map) val).size();
+        } else if (val instanceof String) {
+            return ((String) val).length();
+        } else if (val instanceof Set) {
+            return ((Set) val).size();
+        } else {
+            // check if there is a size method on the object that returns an
+            // integer
+            // and if so, just use it
+            Object[] params = new Object[0];
+            Info velInfo = new Info("", 1, 1);
             VelMethod vm = Introspector.getUberspect().getMethod(val, "size", 
params, velInfo);
-            if (vm != null && vm.getReturnType() == Integer.TYPE)
-            {
-               Integer result = (Integer)vm.invoke(val, params);
-               return result.intValue();
+            if (vm != null && vm.getReturnType() == Integer.TYPE) {
+                Integer result = (Integer) vm.invoke(val, params);
+                return result.intValue();
             }
             throw new Exception("size() : unknown type : " + val.getClass());
         }

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java
 Thu Apr 27 06:42:09 2006
@@ -18,36 +18,30 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  Simple testcases
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Wilkinson</a>
- *  @version $Id$
+ * Size Method, e.g. size().
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Wilkinson</a>
+ * @version $Id$
  */
-public class ASTSizeMethod extends SimpleNode
-{
-    public ASTSizeMethod(int id)
-    {
+public class ASTSizeMethod extends SimpleNode {
+    public ASTSizeMethod(int id) {
         super(id);
     }
 
-    public ASTSizeMethod(Parser p, int id)
-    {
+    public ASTSizeMethod(Parser p, int id) {
         super(p, id);
     }
 
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
     /**
-     *  returns the value of itself applied to the object.
-     *   We assume that an identifier can be gotten via a get(String)
+     * returns the value of itself applied to the object. We assume that an
+     * identifier can be gotten via a get(String)
      */
-    public Object execute(Object obj, JexlContext jc)
-        throws Exception
-    {
+    public Object execute(Object obj, JexlContext jc) throws Exception {
         return new Integer(ASTSizeFunction.sizeOf(obj));
     }
 

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.java
 Thu Apr 27 06:42:09 2006
@@ -1,5 +1,18 @@
-/* Generated By:JJTree: Do not edit this line. ASTStatementExpression.java */
-
+/*
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.commons.jexl.parser;
 
 import org.apache.commons.jexl.JexlContext;

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,34 +18,28 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  represents an string
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- *  @version $Id$
+ * represents an string
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @version $Id$
  */
-public class ASTStringLiteral extends SimpleNode
-{
+public class ASTStringLiteral extends SimpleNode {
     protected String literal;
 
-    public ASTStringLiteral(int id)
-    {
+    public ASTStringLiteral(int id) {
         super(id);
     }
 
-    public ASTStringLiteral(Parser p, int id)
-    {
+    public ASTStringLiteral(Parser p, int id) {
         super(p, id);
     }
 
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
-    public Object value(JexlContext jc)
-        throws Exception
-    {
+    public Object value(JexlContext jc) throws Exception {
         return literal;
     }
 }

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.java
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,54 +20,48 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  Subtraction
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- *  @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Wilkinson</a>
- *  @version $Id$
+ * Subtraction.
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Wilkinson</a>
+ * @version $Id$
  */
-public class ASTSubtractNode extends SimpleNode
-{
-    public ASTSubtractNode(int id)
-    {
+public class ASTSubtractNode extends SimpleNode {
+    public ASTSubtractNode(int id) {
         super(id);
     }
 
-    public ASTSubtractNode(Parser p, int id)
-    {
+    public ASTSubtractNode(Parser p, int id) {
         super(p, id);
     }
 
-    public Object value(JexlContext context)
-        throws Exception
-    {
+    public Object value(JexlContext context) throws Exception {
         Object left = ((SimpleNode) jjtGetChild(0)).value(context);
         Object right = ((SimpleNode) jjtGetChild(1)).value(context);
 
         /*
-         *  the spec says 'and', I think 'or'
+         * the spec says 'and', I think 'or'
          */
-        if (left == null && right == null)
-            return new Byte((byte)0);
+        if (left == null && right == null) {
+            return new Byte((byte) 0);
+        }
 
         /*
-         *  if anything is float, double or string with ( "." | "E" | "e")
-         *  coerce all to doubles and do it
+         * if anything is float, double or string with ( "." | "E" | "e") 
coerce
+         * all to doubles and do it
          */
-        if ( left instanceof Float || left instanceof Double
-            || right instanceof Float || right instanceof Double
-            || (  left instanceof String
-                 && (  ((String) left).indexOf(".") != -1 ||
-                    ((String) left).indexOf("e") != -1 ||
-                    ((String) left).indexOf("E") != -1 )
-            )
-            || (  right instanceof String
-                && (  ((String) right).indexOf(".") != -1 ||
-                ((String) right).indexOf("e") != -1 ||
-                ((String) right).indexOf("E") != -1 )
-               )
-        )
-        {
+        if (left instanceof Float
+            || left instanceof Double
+            || right instanceof Float
+            || right instanceof Double
+            || (left instanceof String 
+                && (((String) left).indexOf(".") != -1 
+                    || ((String) left).indexOf("e") != -1 
+                    || ((String) left).indexOf("E") != -1))
+            || (right instanceof String 
+                && (((String) right).indexOf(".") != -1 
+                    || ((String) right).indexOf("e") != -1 
+                    || ((String) right).indexOf("E") != -1))) {
             Double l = Coercion.coerceDouble(left);
             Double r = Coercion.coerceDouble(right);
 
@@ -83,10 +77,10 @@
 
         return new Long(l.longValue() - r.longValue());
 
-     }
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    }
+
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 }

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,36 +16,29 @@
 
 package org.apache.commons.jexl.parser;
 
-
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  represents Boolean true
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- *  @version $Id$
+ * represents Boolean true.
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @version $Id$
  */
-public class ASTTrueNode extends SimpleNode
-{
-    public ASTTrueNode(int id)
-    {
+public class ASTTrueNode extends SimpleNode {
+    public ASTTrueNode(int id) {
         super(id);
     }
 
-    public ASTTrueNode(Parser p, int id)
-    {
+    public ASTTrueNode(Parser p, int id) {
         super(p, id);
     }
 
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
-    public Object value(JexlContext jc)
-        throws Exception
-    {
+    public Object value(JexlContext jc) throws Exception {
         return Boolean.TRUE;
     }
 }

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.java
 Thu Apr 27 06:42:09 2006
@@ -1,12 +1,12 @@
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,77 +20,54 @@
 
 import org.apache.commons.jexl.JexlContext;
 
-
 /**
- *  -
- *
- *  @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Wilkinson</a>
- *  @version $Id$
+ * - (unary minus).
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Wilkinson</a>
+ * @version $Id$
  */
-public class ASTUnaryMinusNode extends SimpleNode 
-{
-    public ASTUnaryMinusNode(int id)
-    {
+public class ASTUnaryMinusNode extends SimpleNode {
+    public ASTUnaryMinusNode(int id) {
         super(id);
     }
 
-    public ASTUnaryMinusNode(Parser p, int id)
-    {
+    public ASTUnaryMinusNode(Parser p, int id) {
         super(p, id);
     }
 
-    /** Accept the visitor. **/
-    public Object jjtAccept(ParserVisitor visitor, Object data)
-    {
+    /** Accept the visitor. * */
+    public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
 
-    public Object value(JexlContext jc)
-        throws Exception
-    {
+    public Object value(JexlContext jc) throws Exception {
         Object val = ((SimpleNode) jjtGetChild(0)).value(jc);
 
-        if (val instanceof Byte)
-        {
-               byte valueAsByte = ((Byte) val).byteValue();
+        if (val instanceof Byte) {
+            byte valueAsByte = ((Byte) val).byteValue();
             return new Byte((byte) -valueAsByte);
-        } 
-        else if (val instanceof Short)
-        {
-               short valueAsShort = ((Short) val).shortValue(); 
+        } else if (val instanceof Short) {
+            short valueAsShort = ((Short) val).shortValue();
             return new Short((short) -valueAsShort);
-        }
-        else if (val instanceof Integer)
-        {
-               int valueAsInt = ((Integer) val).intValue();
+        } else if (val instanceof Integer) {
+            int valueAsInt = ((Integer) val).intValue();
             return new Integer(-valueAsInt);
-        }
-        else if (val instanceof Long)
-        {
-               long valueAsLong = ((Long) val).longValue();
+        } else if (val instanceof Long) {
+            long valueAsLong = ((Long) val).longValue();
             return new Long(-valueAsLong);
-        }
-        else if (val instanceof Float)
-        {
-               float valueAsFloat = ((Float) val).floatValue(); 
-               return new Float( -valueAsFloat  );
-        }
-        else if (val instanceof Double)
-        {
-               double valueAsDouble = ((Double) val).doubleValue();  
-               return new Double( -valueAsDouble );
-        }
-        else if (val instanceof BigDecimal)
-        {
-               BigDecimal valueAsBigD = (BigDecimal)val;
-               return valueAsBigD.negate();
-        }
-        else if (val instanceof BigInteger)
-        {
-               BigInteger valueAsBigI = (BigInteger)val;
-               return valueAsBigI.negate();
+        } else if (val instanceof Float) {
+            float valueAsFloat = ((Float) val).floatValue();
+            return new Float(-valueAsFloat);
+        } else if (val instanceof Double) {
+            double valueAsDouble = ((Double) val).doubleValue();
+            return new Double(-valueAsDouble);
+        } else if (val instanceof BigDecimal) {
+            BigDecimal valueAsBigD = (BigDecimal) val;
+            return valueAsBigD.negate();
+        } else if (val instanceof BigInteger) {
+            BigInteger valueAsBigI = (BigInteger) val;
+            return valueAsBigI.negate();
         }
         throw new Exception("expression not a number");
     }
 }
-

Modified: 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.java?rev=397541&r1=397540&r2=397541&view=diff
==============================================================================
--- 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.java
 (original)
+++ 
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.java
 Thu Apr 27 06:42:09 2006
@@ -1,13 +1,12 @@
-/* Generated By:JJTree: Do not edit this line. ASTWhileStatement.java */
 /*
- * Copyright 2002,2004 The Apache Software Foundation.
- * 
+ * Copyright 2002-2006 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,9 +20,7 @@
 import org.apache.commons.jexl.util.Coercion;
 
 /**
- * A while loop.
- * Syntax:
- *      while ( expression ) statement
+ * A while loop. Syntax: while ( expression ) statement
  * 
  * @author Dion Gillard
  * @since 1.1
@@ -45,7 +42,7 @@
     public Object value(JexlContext jc) throws Exception {
         Object result = null;
         /* first child is the expression */
-        SimpleNode expressionNode = (SimpleNode) jjtGetChild(0); 
+        SimpleNode expressionNode = (SimpleNode) jjtGetChild(0);
         while 
(Coercion.coerceBoolean(expressionNode.value(jc)).booleanValue()) {
             // execute statement
             result = ((SimpleNode) jjtGetChild(1)).value(jc);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to