org.apache.commons.jexl.parser

## Class SimpleNode

- java.lang.Object
- - org.apache.commons.jexl.parser.SimpleNode

All Implemented Interfaces:
  Node

Direct Known Subclasses:
  ASTAddNode, ASTAndNode, ASTArrayAccess, ASTArrayLiteral, ASTAssignment, ASTBitwiseAndNode, ASTBitwiseComplNode, ASTBitwiseOrNode, ASTBitwiseXorNode, ASTBlock, ASTDivNode, ASTElvisNode, ASTEmptyFunction, ASTEQNode, ASTExpression, ASTExpressionExpression, ASTFalseNode, ASTFloatLiteral, ASTForeachStatement, ASTGENode, ASTGTNode, ASTIdentifier, ASTIfStatement, ASTIntegerLiteral, ASTJexlScript, ASTLENode, ASTLTNode, ASTMapEntry, ASTMapLiteral, ASTMethod, ASTModNode, ASTMulNode, ASTNENode, ASTNotNode, ASTNullLiteral, ASTOrNode, ASTReference, ASTReferenceExpression, ASTSizeFunction, ASTSizeMethod, ASTStatementExpression, ASTStringLiteral, ASTSubtractNode, ASTTernaryNode, ASTTrueNode, ASTUnaryMinusNode, ASTWhileStatement

    public class SimpleNode
    extends java.lang.Object
    implements Node

A Useful implementation of `Node`. Mostly autogenerated by javacc

Version:
  $Id: SimpleNode.java 548229 2007-06-18 06:11:32Z dion $
Author:
  Geir Magnusson Jr.

### Field Summary

Fields
`protected Node[]` `children` children of this node.
`protected int` `id` id of the node.
`protected Node` `parent` parent node.
`protected org.apache.commons.jexl.parser.Parser` `parser` parser that created the node.

### Constructor Summary

Constructors
Constructor and Description
`SimpleNode(int i)` Create the node given an id.
`SimpleNode(org.apache.commons.jexl.parser.Parser p, int i)` Create a node with the given parser and id.

### Method Summary

Methods
`java.lang.Object` `childrenAccept(org.apache.commons.jexl.parser.ParserVisitor visitor, java.lang.Object data)` Visit all children.
`void` `dump(java.lang.String prefix)` Dump the node and all children.
`java.lang.Object` `execute(java.lang.Object o, JexlContext ctx)` Used to let a node calcuate it's value..
`protected Uberspect` `getUberspect()`
`boolean` `interpret(JexlContext pc)` basic interpret - just invoke interpret on all children.
`java.lang.Object` `jjtAccept(org.apache.commons.jexl.parser.ParserVisitor visitor, java.lang.Object data)` Accept the visitor.
`void` `jjtAddChild(Node n, int i)` This method tells the node to add its argument to the node's list of children.
`void` `jjtClose()` End of the node.
`Node` `jjtGetChild(int i)` This method returns a child node.
`int` `jjtGetNumChildren()` Gets the number of children the node has.
`Node` `jjtGetParent()` Gets the parent node.
`void` `jjtOpen()` Start of the node.
`void` `jjtSetParent(Node n)` This pair of methods are used to inform the node of its parent.
`java.lang.Object` `setValue(JexlContext context, java.lang.Object value)` Sets the value for the node - again, only makes sense for some nodes but lazyness tempts me to put it here.
`java.lang.String` `toString()` Gets a string representation of the node.
`java.lang.String` `toString(java.lang.String prefix)` Used during dumping to output the node with a prefix.
`java.lang.Object` `value(JexlContext context)` Gets the value of this node.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### parent

    protected Node parent

parent node.

#### children

    protected Node[] children

children of this node.

#### id

    protected int id

id of the node.

#### parser

    protected org.apache.commons.jexl.parser.Parser parser

parser that created the node.

### Constructor Detail

#### SimpleNode

    public SimpleNode(int i)

Create the node given an id.

Parameters:
  `i` - node id.

#### SimpleNode

    public SimpleNode(org.apache.commons.jexl.parser.Parser p,
              int i)

Create a node with the given parser and id.

Parameters:
  `p` - a parser.
  `i` - node id.

### Method Detail

#### jjtOpen

    public void jjtOpen()

Start of the node.

Specified by:
  `jjtOpen` in interface `Node`

#### jjtClose

    public void jjtClose()

End of the node.

Specified by:
  `jjtClose` in interface `Node`

#### jjtSetParent

    public void jjtSetParent(Node n)

This pair of methods are used to inform the node of its parent.

Specified by:
  `jjtSetParent` in interface `Node`
Parameters:
  `n` - the parent node.

#### jjtGetParent

    public Node jjtGetParent()

Gets the parent node.

Specified by:
  `jjtGetParent` in interface `Node`
Returns:
  the parent to this node.

#### jjtAddChild

    public void jjtAddChild(Node n,
                   int i)

This method tells the node to add its argument to the node's list of children.

Specified by:
  `jjtAddChild` in interface `Node`
Parameters:
  `n` - the child node to add
  `i` - the index to add it at.

#### jjtGetChild

    public Node jjtGetChild(int i)

This method returns a child node. The children are numbered from zero, left to right.

Specified by:
  `jjtGetChild` in interface `Node`
Parameters:
  `i` - the index of the child to get.
Returns:
  the child at the given index.

#### jjtGetNumChildren

    public int jjtGetNumChildren()

Gets the number of children the node has.

Specified by:
  `jjtGetNumChildren` in interface `Node`
Returns:
  the number of children the node has.

#### jjtAccept

    public java.lang.Object jjtAccept(org.apache.commons.jexl.parser.ParserVisitor visitor,
                             java.lang.Object data)

Accept the visitor.

Specified by:
  `jjtAccept` in interface `Node`
Parameters:
  `visitor` - a `ParserVisitor`.
  `data` - data to be passed along to the visitor.
Returns:
  the value from visiting.
See Also:
  `ParserVisitor.visit(org.apache.commons.jexl.parser.SimpleNode, java.lang.Object)`

#### childrenAccept

    public java.lang.Object childrenAccept(org.apache.commons.jexl.parser.ParserVisitor visitor,
                                  java.lang.Object data)

Visit all children.

Parameters:
  `visitor` - a `ParserVisitor`.
  `data` - data to be passed along to the visitor.
Returns:
  the value from visiting.
See Also:
  `ParserVisitor.visit(org.apache.commons.jexl.parser.SimpleNode, java.lang.Object)`

#### toString

    public java.lang.String toString()

Gets a string representation of the node.

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  the node name.

#### toString

    public java.lang.String toString(java.lang.String prefix)

Used during dumping to output the node with a prefix.

Parameters:
  `prefix` - text to prefix `toString()`
Returns:
  text.

#### dump

    public void dump(java.lang.String prefix)

Dump the node and all children.

Parameters:
  `prefix` - text to prefix the node output.

#### interpret

    public boolean interpret(JexlContext pc)
                      throws java.lang.Exception

basic interpret - just invoke interpret on all children.

Parameters:
  `pc` - the `context` to interpret against.
Returns:
  true if interpretation worked.
Throws:
  `java.lang.Exception` - on any error.

#### value

    public java.lang.Object value(JexlContext context)
                           throws java.lang.Exception

Gets the value of this node.

Parameters:
  `context` - the context to retrieve values from.
Returns:
  the value of the node.
Throws:
  `java.lang.Exception` - when evaluating the operands fails.

#### setValue

    public java.lang.Object setValue(JexlContext context,
                            java.lang.Object value)
                              throws java.lang.Exception

Sets the value for the node - again, only makes sense for some nodes but lazyness tempts me to put it here. Keeps things simple.

Parameters:
  `context` - the context to retrieve values from.
  `value` - the value.
Returns:
  the result.
Throws:
  `java.lang.Exception` - when evaluating the operands fails.

#### execute

    public java.lang.Object execute(java.lang.Object o,
                           JexlContext ctx)
                             throws java.lang.Exception

Used to let a node calcuate it's value..

Parameters:
  `o` - the object to calculate with.
  `ctx` - the context to retrieve values from.
Returns:
  the result of the calculation.
Throws:
  `java.lang.Exception` - when calculating the value fails.

#### getUberspect

    protected Uberspect getUberspect()