org.apache.velocity.runtime.parser.node
Class SimpleNode

java.lang.Object
  extended by org.apache.velocity.runtime.parser.node.SimpleNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
ASTAddNode, ASTAndNode, ASTAssignment, ASTBlock, ASTComment, ASTDirective, ASTDivNode, ASTElseIfStatement, ASTElseStatement, ASTEQNode, ASTEscape, ASTEscapedDirective, ASTExpression, ASTFalse, ASTFloatingPointLiteral, ASTGENode, ASTGTNode, ASTIdentifier, ASTIfStatement, ASTIncludeStatement, ASTIntegerLiteral, ASTIntegerRange, ASTLENode, ASTLTNode, ASTMap, ASTMethod, ASTModNode, ASTMulNode, ASTNENode, ASTNotNode, ASTObjectArray, ASTOrNode, ASTParameters, ASTprocess, ASTReference, ASTSetDirective, ASTStop, ASTStringLiteral, ASTSubtractNode, ASTText, ASTTrue, ASTVariable, ASTWord

public class SimpleNode
extends Object
implements Node


Field Summary
protected  Node[] children
           
protected  Token first
           
protected  int id
           
protected  int info
           
protected  boolean invalid
           
protected  Token last
           
protected  Log log
           
protected  Node parent
           
protected  Parser parser
           
protected  RuntimeServices rsvc
           
 boolean state
           
 
Constructor Summary
SimpleNode(int i)
           
SimpleNode(Parser p, int i)
           
 
Method Summary
 Object childrenAccept(ParserVisitor visitor, Object data)
           
 void dump(String prefix)
          Override this method if you want to customize how the node dumps out its children.
 boolean evaluate(InternalContextAdapter context)
           
 Object execute(Object o, InternalContextAdapter context)
           
 int getColumn()
           
 Token getFirstToken()
           
 int getInfo()
           
 Token getLastToken()
           
 int getLine()
           
 int getType()
           
 Object init(InternalContextAdapter context, Object data)
           
 boolean isInvalid()
           
 Object jjtAccept(ParserVisitor visitor, Object data)
           
 void jjtAddChild(Node n, int i)
          This method tells the node to add its argument to the node's list of children.
 void jjtClose()
          This method is called after all the child nodes have been added.
 Node jjtGetChild(int i)
          This method returns a child node.
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
           
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtSetParent(Node n)
          This pair of methods are used to inform the node of its parent.
 String literal()
           
 boolean render(InternalContextAdapter context, Writer writer)
           
 void setFirstToken(Token t)
           
 void setInfo(int info)
           
 void setInvalid()
          Mark the node as invalid.
 String toString()
           
 String toString(String prefix)
           
 Object value(InternalContextAdapter context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rsvc

protected RuntimeServices rsvc

log

protected Log log

parent

protected Node parent

children

protected Node[] children

id

protected int id

parser

protected Parser parser

info

protected int info

state

public boolean state

invalid

protected boolean invalid

first

protected Token first

last

protected Token last
Constructor Detail

SimpleNode

public SimpleNode(int i)
Parameters:
i -

SimpleNode

public SimpleNode(Parser p,
                  int i)
Parameters:
p -
i -
Method Detail

jjtOpen

public void jjtOpen()
Description copied from interface: Node
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.

Specified by:
jjtOpen in interface Node
See Also:
Node.jjtOpen()

jjtClose

public void jjtClose()
Description copied from interface: Node
This method is called after all the child nodes have been added.

Specified by:
jjtClose in interface Node
See Also:
Node.jjtClose()

setFirstToken

public void setFirstToken(Token t)
Parameters:
t -

getFirstToken

public Token getFirstToken()
Specified by:
getFirstToken in interface Node
Returns:
The first token.
See Also:
Node.getFirstToken()

getLastToken

public Token getLastToken()
Specified by:
getLastToken in interface Node
Returns:
The last token.
See Also:
Node.getLastToken()

jjtSetParent

public void jjtSetParent(Node n)
Description copied from interface: Node
This pair of methods are used to inform the node of its parent.

Specified by:
jjtSetParent in interface Node
See Also:
Node.jjtSetParent(org.apache.velocity.runtime.parser.node.Node)

jjtGetParent

public Node jjtGetParent()
Specified by:
jjtGetParent in interface Node
Returns:
The node parent.
See Also:
Node.jjtGetParent()

jjtAddChild

public void jjtAddChild(Node n,
                        int i)
Description copied from interface: Node
This method tells the node to add its argument to the node's list of children.

Specified by:
jjtAddChild in interface Node
See Also:
Node.jjtAddChild(org.apache.velocity.runtime.parser.node.Node, int)

jjtGetChild

public Node jjtGetChild(int i)
Description copied from interface: Node
This method returns a child node. The children are numbered from zero, left to right.

Specified by:
jjtGetChild in interface Node
Returns:
A child node.
See Also:
Node.jjtGetChild(int)

jjtGetNumChildren

public int jjtGetNumChildren()
Description copied from interface: Node
Return the number of children the node has.

Specified by:
jjtGetNumChildren in interface Node
Returns:
The number of children of this node.
See Also:
Node.jjtGetNumChildren()

jjtAccept

public Object jjtAccept(ParserVisitor visitor,
                        Object data)
Specified by:
jjtAccept in interface Node
Returns:
The Node execution result object.
See Also:
Node.jjtAccept(org.apache.velocity.runtime.parser.ParserVisitor, java.lang.Object)

childrenAccept

public Object childrenAccept(ParserVisitor visitor,
                             Object data)
Specified by:
childrenAccept in interface Node
Returns:
The node execution result.
See Also:
Node.childrenAccept(org.apache.velocity.runtime.parser.ParserVisitor, java.lang.Object)

toString

public String toString(String prefix)
Parameters:
prefix -
Returns:
String representation of this node.

dump

public void dump(String prefix)
Override this method if you want to customize how the node dumps out its children.

Parameters:
prefix -

literal

public String literal()
Specified by:
literal in interface Node
Returns:
A literal.
See Also:
Node.literal()

init

public Object init(InternalContextAdapter context,
                   Object data)
            throws TemplateInitException
Specified by:
init in interface Node
Returns:
The init result.
Throws:
TemplateInitException
See Also:
Node.init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)

evaluate

public boolean evaluate(InternalContextAdapter context)
                 throws MethodInvocationException
Specified by:
evaluate in interface Node
Returns:
The evaluation result.
Throws:
MethodInvocationException
See Also:
Node.evaluate(org.apache.velocity.context.InternalContextAdapter)

value

public Object value(InternalContextAdapter context)
             throws MethodInvocationException
Specified by:
value in interface Node
Returns:
The node value.
Throws:
MethodInvocationException
See Also:
Node.value(org.apache.velocity.context.InternalContextAdapter)

render

public boolean render(InternalContextAdapter context,
                      Writer writer)
               throws IOException,
                      MethodInvocationException,
                      ParseErrorException,
                      ResourceNotFoundException
Specified by:
render in interface Node
Returns:
True if the node rendered successfully.
Throws:
IOException
MethodInvocationException
ParseErrorException
ResourceNotFoundException
See Also:
Node.render(org.apache.velocity.context.InternalContextAdapter, java.io.Writer)

execute

public Object execute(Object o,
                      InternalContextAdapter context)
               throws MethodInvocationException
Specified by:
execute in interface Node
Returns:
The execution result.
Throws:
MethodInvocationException
See Also:
Node.execute(java.lang.Object, org.apache.velocity.context.InternalContextAdapter)

getType

public int getType()
Specified by:
getType in interface Node
Returns:
The NodeType.
See Also:
Node.getType()

setInfo

public void setInfo(int info)
Specified by:
setInfo in interface Node
See Also:
Node.setInfo(int)

getInfo

public int getInfo()
Specified by:
getInfo in interface Node
Returns:
The current node info.
See Also:
Node.getInfo()

setInvalid

public void setInvalid()
Description copied from interface: Node
Mark the node as invalid.

Specified by:
setInvalid in interface Node
See Also:
Node.setInvalid()

isInvalid

public boolean isInvalid()
Specified by:
isInvalid in interface Node
Returns:
True if the node is invalid.
See Also:
Node.isInvalid()

getLine

public int getLine()
Specified by:
getLine in interface Node
Returns:
The current line position.
See Also:
Node.getLine()

getColumn

public int getColumn()
Specified by:
getColumn in interface Node
Returns:
The current column position.
See Also:
Node.getColumn()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2007 The Apache Software Foundation. All Rights Reserved.