Author: dion Date: Wed Apr 26 18:08:05 2006 New Revision: 397350 URL: http://svn.apache.org/viewcvs?rev=397350&view=rev Log: Checkstyle
Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleNode.java Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleNode.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleNode.java?rev=397350&r1=397349&r2=397350&view=diff ============================================================================== --- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleNode.java (original) +++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/SimpleNode.java Wed Apr 26 18:08:05 2006 @@ -19,24 +19,27 @@ import org.apache.commons.jexl.JexlContext; /** - * A Useful implementation of [EMAIL PROTECTED] Node}. - * Mostly autogenerated by javacc - * - * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a> - * @version $Id$ + * A Useful implementation of [EMAIL PROTECTED] Node}. Mostly autogenerated by javacc + * + * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a> + * @version $Id$ */ public class SimpleNode implements Node { /** parent node. */ protected Node parent; + /** children of this node. */ protected Node[] children; + /** id of the node. */ protected int id; + /** parser that created the node. */ protected Parser parser; /** * Create the node given an id. + * * @param i node id. */ public SimpleNode(int i) { @@ -45,6 +48,7 @@ /** * Create a node with the given parser and id. + * * @param p a parser. * @param i node id. */ @@ -59,25 +63,19 @@ public void jjtClose() { } - public void jjtSetParent(Node n) - { + public void jjtSetParent(Node n) { parent = n; } - public Node jjtGetParent() - { + public Node jjtGetParent() { return parent; } - public void jjtAddChild(Node n, int i) - { - if (children == null) - { + public void jjtAddChild(Node n, int i) { + if (children == null) { children = new Node[i + 1]; - } - else if (i >= children.length) - { - Node c[] = new Node[i + 1]; + } else if (i >= children.length) { + Node[] c = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } @@ -85,64 +83,52 @@ children[i] = n; } - public Node jjtGetChild(int i) - { - return children[i]; + public Node jjtGetChild(int i) { + return children[i]; } - public int jjtGetNumChildren() - { + public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } - /** + /** * Accept the visitor. + * * @param visitor a [EMAIL PROTECTED] ParserVisitor}. * @param data data to be passed along to the visitor. * @return the value from visiting. - * @see ParserVisitor#visit + * @see ParserVisitor#visit */ - public Object jjtAccept(ParserVisitor visitor, Object data) - { + public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } - /** Accept the visitor. **/ - public Object childrenAccept(ParserVisitor visitor, Object data) - { - if (children != null) - { - for (int i = 0; i < children.length; ++i) - { + /** Accept the visitor. * */ + public Object childrenAccept(ParserVisitor visitor, Object data) { + if (children != null) { + for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } - - public String toString() - { + public String toString() { return ParserTreeConstants.jjtNodeName[id]; } - public String toString(String prefix) - { + public String toString(String prefix) { return prefix + toString(); } - public void dump(String prefix) - { + public void dump(String prefix) { System.out.println(toString(prefix)); - if (children != null) - { - for (int i = 0; i < children.length; ++i) - { - SimpleNode n = (SimpleNode)children[i]; + if (children != null) { + for (int i = 0; i < children.length; ++i) { + SimpleNode n = (SimpleNode) children[i]; - if (n != null) - { + if (n != null) { n.dump(prefix + " "); } } @@ -150,24 +136,22 @@ } /** - * basic interpret - just invoke interpret on all children + * basic interpret - just invoke interpret on all children */ - public boolean interpret(JexlContext pc) - throws Exception - { - for (int i=0; i<jjtGetNumChildren();i++) - { + public boolean interpret(JexlContext pc) throws Exception { + for (int i = 0; i < jjtGetNumChildren(); i++) { SimpleNode node = (SimpleNode) jjtGetChild(i); - if (!node.interpret(pc)) + if (!node.interpret(pc)) { return false; + } } return true; } - /** * Gets the value of this node. + * * @param context the context to retrieve values from. * @return the result of addition. * @throws Exception when evaluating the operands fails. @@ -177,22 +161,17 @@ } /** - * Sets the value for the node - again, only makes sense for some nodes - * but lazyness tempts me to put it here. Keeps things simple. + * Sets the value for the node - again, only makes sense for some nodes but + * lazyness tempts me to put it here. Keeps things simple. */ - public Object setValue(JexlContext context, Object value) - throws Exception - { + public Object setValue(JexlContext context, Object value) throws Exception { return null; } /** - * Used to let a node calcuate it's value.. + * Used to let a node calcuate it's value.. */ - public Object execute(Object o, JexlContext ctx) - throws Exception - { + public Object execute(Object o, JexlContext ctx) throws Exception { return null; } } - --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]