org.apache.commons.jexl.parser

Class SimpleNode

public class SimpleNode extends Object implements Node

A Useful implementation of Node. Mostly autogenerated by javacc

Version: $Id: SimpleNode.java 398328 2006-04-30 12:46:59Z dion $

Field Summary
protected Node[]children
children of this node.
protected intid
id of the node.
protected Nodeparent
parent node.
protected Parserparser
parser that created the node.
Constructor Summary
SimpleNode(int i)
Create the node given an id.
SimpleNode(Parser p, int i)
Create a node with the given parser and id.
Method Summary
ObjectchildrenAccept(ParserVisitor visitor, Object data)
Visit all children.
voiddump(String prefix)
Dump the node and all children.
Objectexecute(Object o, JexlContext ctx)
Used to let a node calcuate it's value..
booleaninterpret(JexlContext pc)
basic interpret - just invoke interpret on all children.
ObjectjjtAccept(ParserVisitor visitor, Object data)
Accept the visitor.
voidjjtAddChild(Node n, int i)
voidjjtClose()
End of the node.
NodejjtGetChild(int i)
intjjtGetNumChildren()
NodejjtGetParent()
voidjjtOpen()
Start of the node.
voidjjtSetParent(Node n)
ObjectsetValue(JexlContext context, Object value)
Sets the value for the node - again, only makes sense for some nodes but lazyness tempts me to put it here.
StringtoString()
Gets a string representation of the node.
StringtoString(String prefix)
Used during dumping to output the node with a prefix.
Objectvalue(JexlContext context)
Gets the value of this node.

Field Detail

children

protected Node[] children
children of this node.

id

protected int id
id of the node.

parent

protected Node parent
parent node.

parser

protected 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(Parser p, int i)
Create a node with the given parser and id.

Parameters: p a parser. i node id.

Method Detail

childrenAccept

public Object childrenAccept(ParserVisitor visitor, 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

dump

public void dump(String prefix)
Dump the node and all children.

Parameters: prefix text to prefix the node output.

execute

public Object execute(Object o, JexlContext ctx)
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: Exception when calculating the value fails.

interpret

public boolean interpret(JexlContext pc)
basic interpret - just invoke interpret on all children.

Parameters: pc the context to interpret against.

Returns: true if interpretation worked.

Throws: Exception on any error.

jjtAccept

public Object jjtAccept(ParserVisitor visitor, Object data)
Accept the visitor.

Parameters: visitor a ParserVisitor. data data to be passed along to the visitor.

Returns: the value from visiting.

See Also: ParserVisitor

jjtAddChild

public void jjtAddChild(Node n, int i)
{@inheritDoc }

jjtClose

public void jjtClose()
End of the node.

jjtGetChild

public Node jjtGetChild(int i)
{@inheritDoc }

jjtGetNumChildren

public int jjtGetNumChildren()
{@inheritDoc }

jjtGetParent

public Node jjtGetParent()
{@inheritDoc }

jjtOpen

public void jjtOpen()
Start of the node.

jjtSetParent

public void jjtSetParent(Node n)
{@inheritDoc }

setValue

public Object setValue(JexlContext context, Object value)
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: Exception when evaluating the operands fails.

toString

public String toString()
Gets a string representation of the node.

Returns: the node name.

toString

public String toString(String prefix)
Used during dumping to output the node with a prefix.

Parameters: prefix text to prefix toString

Returns: text.

value

public Object value(JexlContext context)
Gets the value of this node.

Parameters: context the context to retrieve values from.

Returns: the value of the node.

Throws: Exception when evaluating the operands fails.

Copyright © 2003-2010 The Apache Software Foundation. All Rights Reserved.