Author: dion
Date: Sun Apr 30 05:20:24 2006
New Revision: 398324
URL: http://svn.apache.org/viewcvs?rev=398324&view=rev
Log:
Checkstyle
Modified:
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
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=398324&r1=398323&r2=398324&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
Sun Apr 30 05:20:24 2006
@@ -21,22 +21,31 @@
* variable; A reference by itself.
*/
public class ASTReferenceExpression extends SimpleNode {
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
public ASTReferenceExpression(int id) {
super(id);
}
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
public ASTReferenceExpression(Parser p, int id) {
super(p, id);
}
- /** Accept the visitor. * */
+ /** [EMAIL PROTECTED] */
public Object jjtAccept(ParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
- /**
- * @return the value of the expression
- */
+ /** [EMAIL PROTECTED] */
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=398324&r1=398323&r2=398324&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
Sun Apr 30 05:20:24 2006
@@ -15,16 +15,15 @@
*/
package org.apache.commons.jexl.parser;
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.Map;
+
import org.apache.commons.jexl.JexlContext;
import org.apache.commons.jexl.util.Introspector;
import org.apache.commons.jexl.util.introspection.Info;
import org.apache.commons.jexl.util.introspection.VelMethod;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.lang.reflect.Array;
-
/**
* generalized size() function for all classes we can think of.
*
@@ -33,19 +32,31 @@
* @version $Id$
*/
public class ASTSizeFunction extends SimpleNode {
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
public ASTSizeFunction(int id) {
super(id);
}
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
public ASTSizeFunction(Parser p, int id) {
super(p, id);
}
- /** Accept the visitor. * */
+ /** [EMAIL PROTECTED] */
public Object jjtAccept(ParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+ /** [EMAIL PROTECTED] */
public Object value(JexlContext jc) throws Exception {
SimpleNode arg = (SimpleNode) jjtGetChild(0);
@@ -58,17 +69,23 @@
return new Integer(ASTSizeFunction.sizeOf(val));
}
+ /**
+ * Calculate the <code>size</code> of various types: Collection, Array,
Map, String,
+ * and anything that has a int size() method.
+ *
+ * @param val the object to get the size of.
+ * @return the size of val
+ * @throws Exception if the size cannot be determined.
+ */
public static int sizeOf(Object val) throws Exception {
- if (val instanceof List) {
- return ((List) val).size();
+ if (val instanceof Collection) {
+ return ((Collection) 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
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=398324&r1=398323&r2=398324&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
Sun Apr 30 05:20:24 2006
@@ -24,22 +24,39 @@
* @version $Id$
*/
public class ASTSizeMethod extends SimpleNode {
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
public ASTSizeMethod(int id) {
super(id);
}
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
public ASTSizeMethod(Parser p, int id) {
super(p, id);
}
- /** Accept the visitor. * */
+ /** [EMAIL PROTECTED] */
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)
+ * evaluate size as part of an expression on a base object.
+ *
+ * foo.bar.size
+ *
+ * @param jc the [EMAIL PROTECTED] JexlContext} to evaluate against.
+ * @param obj not used.
+ * @return the value of the array expression.
+ * @throws Exception on any error
*/
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=398324&r1=398323&r2=398324&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
Sun Apr 30 05:20:24 2006
@@ -21,21 +21,32 @@
* Assignment as an expression.
*/
public class ASTStatementExpression extends SimpleNode {
- public ASTStatementExpression(int id) {
- super(id);
- }
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
+ public ASTStatementExpression(int id) {
+ super(id);
+ }
- public ASTStatementExpression(Parser p, int id) {
- super(p, id);
- }
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
+ public ASTStatementExpression(Parser p, int id) {
+ super(p, id);
+ }
+ /** [EMAIL PROTECTED] */
+ 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 context) throws Exception {
- return ((SimpleNode) jjtGetChild(0)).value(context);
- }
+ /** [EMAIL PROTECTED] */
+ 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/ASTStringLiteral.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.java?rev=398324&r1=398323&r2=398324&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
Sun Apr 30 05:20:24 2006
@@ -24,21 +24,34 @@
* @version $Id$
*/
public class ASTStringLiteral extends SimpleNode {
+ /** the parsed literal. */
protected String literal;
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
public ASTStringLiteral(int id) {
super(id);
}
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
public ASTStringLiteral(Parser p, int id) {
super(p, id);
}
- /** Accept the visitor. * */
+ /** [EMAIL PROTECTED] */
public Object jjtAccept(ParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+ /** [EMAIL PROTECTED] */
public Object value(JexlContext jc) throws Exception {
return literal;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]