org.apache.velocity.runtime.parser.node
Interface Node

All Known Implementing Classes:
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, SimpleNode

public interface Node

All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes.


Method Summary
 Object childrenAccept(ParserVisitor visitor, Object data)
           
 boolean evaluate(InternalContextAdapter context)
           
 Object execute(Object o, InternalContextAdapter context)
           
 int getColumn()
           
 Token getFirstToken()
           
 int getInfo()
           
 Token getLastToken()
           
 int getLine()
           
 String getLocation(InternalContextAdapter ctx)
          Get the location of the node.
 String getLocation(String templateName)
          Get the location of the node.
 int getType()
           
 Object init(InternalContextAdapter context, Object data)
           
 boolean isInvalid()
           
 Object jjtAccept(ParserVisitor visitor, 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()
          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 setInfo(int info)
           
 void setInvalid()
           
 Object value(InternalContextAdapter context)
           
 

Method Detail

jjtOpen

void jjtOpen()
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.


jjtClose

void jjtClose()
This method is called after all the child nodes have been added.


jjtSetParent

void jjtSetParent(Node n)
This pair of methods are used to inform the node of its parent.


jjtGetParent

Node jjtGetParent()

jjtAddChild

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


jjtGetChild

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


jjtGetNumChildren

int jjtGetNumChildren()
Return the number of children the node has.


jjtAccept

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


childrenAccept

Object childrenAccept(ParserVisitor visitor,
                      Object data)

getFirstToken

Token getFirstToken()

getLastToken

Token getLastToken()

getType

int getType()

init

Object init(InternalContextAdapter context,
            Object data)
            throws Exception
Throws:
Exception

evaluate

boolean evaluate(InternalContextAdapter context)
                 throws MethodInvocationException
Throws:
MethodInvocationException

value

Object value(InternalContextAdapter context)
             throws MethodInvocationException
Throws:
MethodInvocationException

render

boolean render(InternalContextAdapter context,
               Writer writer)
               throws IOException,
                      MethodInvocationException,
                      ParseErrorException,
                      ResourceNotFoundException
Throws:
IOException
MethodInvocationException
ParseErrorException
ResourceNotFoundException

execute

Object execute(Object o,
               InternalContextAdapter context)
               throws MethodInvocationException
Throws:
MethodInvocationException

setInfo

void setInfo(int info)

getInfo

int getInfo()

literal

String literal()

setInvalid

void setInvalid()

isInvalid

boolean isInvalid()

getLine

int getLine()

getColumn

int getColumn()

getLocation

String getLocation(InternalContextAdapter ctx)
Get the location of the node. The given ctx is used to find out, which template contains this node.

Parameters:
ctx - the node context (the node itself does not know the name of the template, which contains it).
Returns:
a String in the format $templateName#$macroName [line $line, column $col]:

getLocation

String getLocation(String templateName)
Get the location of the node. Use the given templateName to indicate, which template contains this node.

Parameters:
templateName - template name to use (the node itself does not know the name of the template, which contains it).
Returns:
a String in the format $templateName#$macroName [line $line, column $col]:


Copyright © 2002 Apache Software Foundation. All Rights Reserved.