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/27 07:56:25 UTC

svn commit: r397429 - in /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser: ASTFloatLiteral.java ASTForeachStatement.java ASTGENode.java ASTGTNode.java ASTIdentifier.java ASTIfStatement.java

Author: dion
Date: Wed Apr 26 22:56:24 2006
New Revision: 397429

URL: http://svn.apache.org/viewcvs?rev=397429&view=rev
Log:
More checkstyle

Modified:
    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
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGENode.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGTNode.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java

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=397429&r1=397428&r2=397429&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 Wed Apr 26 22:56:24 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,35 +19,28 @@
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  represents an float
- *
- *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- *  @version $Id$
+ * represents a float point number.
+ * 
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ * @version $Id$
  */
-public class ASTFloatLiteral extends SimpleNode
-{
+public class ASTFloatLiteral extends SimpleNode {
     protected Float val;
 
-    public ASTFloatLiteral(int id)
-    {
+    public ASTFloatLiteral(int id) {
         super(id);
     }
 
-    public ASTFloatLiteral(Parser p, int id)
-    {
+    public ASTFloatLiteral(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 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=397429&r1=397428&r2=397429&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 Wed Apr 26 22:56:24 2006
@@ -1,4 +1,18 @@
-/* Generated By:JJTree: Do not edit this line. ASTForeachStatement.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;
 
@@ -9,9 +23,8 @@
 import org.apache.commons.jexl.util.introspection.Info;
 
 /**
- * ForEach statement.
- * Syntax:
- *      foreach (var in iterable) Statement()
+ * ForEach statement. Syntax: foreach (var in iterable) Statement()
+ * 
  * @author Dion Gillard
  * @since 1.1
  */
@@ -27,16 +40,15 @@
         super(p, id);
     }
 
-
-    /** Accept the visitor. **/
+    /** Accept the visitor. * */
     public Object jjtAccept(ParserVisitor visitor, Object data) {
         return visitor.visit(this, data);
     }
-  
+
     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(0);
         /* second child is the variable to iterate */
         SimpleNode iterable = (SimpleNode) jjtGetChild(1);
         Object iterableValue = iterable.value(jc);
@@ -44,10 +56,11 @@
         if (iterableValue != null && jjtGetNumChildren() >= 3) {
             /* third child is the statement to execute */
             SimpleNode statement = (SimpleNode) jjtGetChild(2);
-            // get an iterator for the collection/array etc via the introspector.
-            Iterator itemsIterator = Introspector.getUberspect().getIterator(iterableValue, DUMMY);
-            while (itemsIterator.hasNext())
-            {
+            // get an iterator for the collection/array etc via the
+            // introspector.
+            Iterator itemsIterator = Introspector.getUberspect().getIterator(
+                    iterableValue, DUMMY);
+            while (itemsIterator.hasNext()) {
                 // set loopVariable to value of iterator
                 Object value = itemsIterator.next();
                 jc.getVars().put(loopVariable.getRootString(), value);

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGENode.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGENode.java?rev=397429&r1=397428&r2=397429&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGENode.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGENode.java Wed Apr 26 22:56:24 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,89 +19,63 @@
 import org.apache.commons.jexl.util.Coercion;
 
 /**
- *  GE : a >= b
- *
- *  Follows A.3.6.1 of the JSTL 1.0 specification
- *
- *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- *  @author <a href="mailto:proyal@apache.org">Peter Royal</a>
- *  @version $Id$
+ * GE : a >= b.
+ * 
+ * Follows A.3.6.1 of the JSTL 1.0 specification
+ * 
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ * @author <a href="mailto:proyal@apache.org">Peter Royal</a>
+ * @version $Id$
  */
-public class ASTGENode extends SimpleNode
-{
-    public ASTGENode(int id)
-    {
+public class ASTGENode extends SimpleNode {
+    public ASTGENode(int id) {
         super(id);
     }
 
-    public ASTGENode(Parser p, int id)
-    {
+    public ASTGENode(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 {
         /*
          * now get the values
          */
 
-        Object left = ( (SimpleNode) jjtGetChild(0)).value(jc);
-        Object right = ( (SimpleNode) jjtGetChild(1)).value(jc);
+        Object left = ((SimpleNode) jjtGetChild(0)).value(jc);
+        Object right = ((SimpleNode) jjtGetChild(1)).value(jc);
 
-        if( left == right )
-        {
+        if (left == right) {
             return Boolean.TRUE;
-        }
-        else if ( ( left == null ) || ( right == null ) )
-        {
+        } else if ((left == null) || (right == null)) {
             return Boolean.FALSE;
-        }
-        else if( Coercion.isFloatingPoint( left ) || Coercion.isFloatingPoint( right ) )
-        {
-            double leftDouble = Coercion.coerceDouble( left ).doubleValue();
-            double rightDouble = Coercion.coerceDouble( right ).doubleValue();
-
-            return leftDouble >= rightDouble
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( Coercion.isNumberable( left ) || Coercion.isNumberable( right ) )
-        {
-            long leftLong = Coercion.coerceLong( left ).longValue();
-            long rightLong = Coercion.coerceLong( right ).longValue();
-
-            return leftLong >= rightLong
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( left instanceof String || right instanceof String )
-        {
+        } else if (Coercion.isFloatingPoint(left)
+                || Coercion.isFloatingPoint(right)) {
+            double leftDouble = Coercion.coerceDouble(left).doubleValue();
+            double rightDouble = Coercion.coerceDouble(right).doubleValue();
+
+            return leftDouble >= rightDouble ? Boolean.TRUE : Boolean.FALSE;
+        } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) {
+            long leftLong = Coercion.coerceLong(left).longValue();
+            long rightLong = Coercion.coerceLong(right).longValue();
+
+            return leftLong >= rightLong ? Boolean.TRUE : Boolean.FALSE;
+        } else if (left instanceof String || right instanceof String) {
             String leftString = left.toString();
             String rightString = right.toString();
 
-            return leftString.compareTo( rightString ) >= 0
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( left instanceof Comparable )
-        {
-            return ( (Comparable)left ).compareTo( right ) >= 0
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( right instanceof Comparable )
-        {
-            return ( (Comparable)right ).compareTo( left ) <= 0
-                ? Boolean.TRUE
-                : Boolean.FALSE;
+            return leftString.compareTo(rightString) >= 0 ? Boolean.TRUE
+                    : Boolean.FALSE;
+        } else if (left instanceof Comparable) {
+            return ((Comparable) left).compareTo(right) >= 0 ? Boolean.TRUE
+                    : Boolean.FALSE;
+        } else if (right instanceof Comparable) {
+            return ((Comparable) right).compareTo(left) <= 0 ? Boolean.TRUE
+                    : Boolean.FALSE;
         }
 
         throw new Exception("Invalid comparison : GE ");

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGTNode.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGTNode.java?rev=397429&r1=397428&r2=397429&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGTNode.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTGTNode.java Wed Apr 26 22:56:24 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,86 +19,63 @@
 import org.apache.commons.jexl.util.Coercion;
 
 /**
- *  GT : a > b
- *
- *  Follows A.3.6.1 of the JSTL 1.0 specification
- *
- *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- *  @author <a href="mailto:proyal@apache.org">Peter Royal</a>
- *  @version $Id$
+ * GT : a > b.
+ * 
+ * Follows A.3.6.1 of the JSTL 1.0 specification
+ * 
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ * @author <a href="mailto:proyal@apache.org">Peter Royal</a>
+ * @version $Id$
  */
-public class ASTGTNode extends SimpleNode
-{
-    public ASTGTNode( int id )
-    {
-        super( id );
+public class ASTGTNode extends SimpleNode {
+    public ASTGTNode(int id) {
+        super(id);
     }
 
-    public ASTGTNode( Parser p, int id )
-    {
-        super( p, id );
+    public ASTGTNode(Parser p, int id) {
+        super(p, id);
     }
 
-    /** Accept the visitor. **/
-    public Object jjtAccept( ParserVisitor visitor, Object data )
-    {
-        return visitor.visit( this, 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 {
         /*
          * now get the values
          */
 
-        Object left = ( (SimpleNode)jjtGetChild( 0 ) ).value( jc );
-        Object right = ( (SimpleNode)jjtGetChild( 1 ) ).value( jc );
+        Object left = ((SimpleNode) jjtGetChild(0)).value(jc);
+        Object right = ((SimpleNode) jjtGetChild(1)).value(jc);
 
-        if( ( left == right ) || ( left == null ) || ( right == null ) )
-        {
+        if ((left == right) || (left == null) || (right == null)) {
             return Boolean.FALSE;
-        }
-        else if( Coercion.isFloatingPoint( left ) || Coercion.isFloatingPoint( right ) )
-        {
-            double leftDouble = Coercion.coerceDouble( left ).doubleValue();
-            double rightDouble = Coercion.coerceDouble( right ).doubleValue();
-
-            return leftDouble > rightDouble
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( Coercion.isNumberable( left ) || Coercion.isNumberable( right ) )
-        {
-            long leftLong = Coercion.coerceLong( left ).longValue();
-            long rightLong = Coercion.coerceLong( right ).longValue();
-
-            return leftLong > rightLong
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( left instanceof String || right instanceof String )
-        {
+        } else if (Coercion.isFloatingPoint(left)
+                || Coercion.isFloatingPoint(right)) {
+            double leftDouble = Coercion.coerceDouble(left).doubleValue();
+            double rightDouble = Coercion.coerceDouble(right).doubleValue();
+
+            return leftDouble > rightDouble ? Boolean.TRUE : Boolean.FALSE;
+        } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) {
+            long leftLong = Coercion.coerceLong(left).longValue();
+            long rightLong = Coercion.coerceLong(right).longValue();
+
+            return leftLong > rightLong ? Boolean.TRUE : Boolean.FALSE;
+        } else if (left instanceof String || right instanceof String) {
             String leftString = left.toString();
             String rightString = right.toString();
 
-            return leftString.compareTo( rightString ) > 0
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( left instanceof Comparable )
-        {
-            return ( (Comparable)left ).compareTo( right ) > 0
-                ? Boolean.TRUE
-                : Boolean.FALSE;
-        }
-        else if( right instanceof Comparable )
-        {
-            return ( (Comparable)right ).compareTo( left ) < 0
-                ? Boolean.TRUE
-                : Boolean.FALSE;
+            return leftString.compareTo(rightString) > 0 ? Boolean.TRUE
+                    : Boolean.FALSE;
+        } else if (left instanceof Comparable) {
+            return ((Comparable) left).compareTo(right) > 0 ? Boolean.TRUE
+                    : Boolean.FALSE;
+        } else if (right instanceof Comparable) {
+            return ((Comparable) right).compareTo(left) < 0 ? Boolean.TRUE
+                    : Boolean.FALSE;
         }
 
-        throw new Exception( "Invalid comparison : GT " );
+        throw new Exception("Invalid comparison : GT ");
     }
 }

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java?rev=397429&r1=397428&r2=397429&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java Wed Apr 26 22:56:24 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.
@@ -14,57 +14,45 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.jexl.parser;
 
 import org.apache.commons.jexl.JexlContext;
 
 /**
- *  Simple identifier -
- *     $foo  or $foo.bar (both parts are identifiers...)
- *
- *  @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- *  @version $Id$
+ * Simple identifier - $foo or $foo.bar (both parts are identifiers).
+ * 
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ * @version $Id$
  */
-public class ASTIdentifier extends SimpleNode
-{
+public class ASTIdentifier extends SimpleNode {
     protected String val;
 
-    public ASTIdentifier(int id)
-    {
+    public ASTIdentifier(int id) {
         super(id);
     }
 
-    public ASTIdentifier(Parser p, int id)
-    {
+    public ASTIdentifier(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 jc.getVars().get(val);
     }
 
     /**
-     *  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 ASTArrayAccess.evaluateExpr(obj, val);
     }
 
-    public String getIdentifierString()
-    {
+    public String getIdentifierString() {
         return val;
     }
 }

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java?rev=397429&r1=397428&r2=397429&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTIfStatement.java Wed Apr 26 22:56:24 2006
@@ -1,6 +1,5 @@
-/* Generated By:JJTree: Do not edit this line. ASTIfStatement.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.
@@ -21,7 +20,7 @@
 import org.apache.commons.jexl.util.Coercion;
 
 /**
- * if ( expression ) statement [else statement]
+ * if ( expression ) statement [else statement].
  * 
  * @author Dion Gillard
  * @since 1.1



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