Class ASTAddNode
- java.lang.Object
-
- org.apache.velocity.runtime.parser.node.SimpleNode
-
- org.apache.velocity.runtime.parser.node.ASTBinaryOperator
-
- org.apache.velocity.runtime.parser.node.ASTMathNode
-
- org.apache.velocity.runtime.parser.node.ASTAddNode
-
- All Implemented Interfaces:
Cloneable,Node,Renderable
public class ASTAddNode extends ASTMathNode
Handles number addition of nodes.
Please look at the Parser.jjt file which is what controls the generation of this class.- Version:
- $Id$
- Author:
- Will Glass-Husain, Peter Romianowski, Jason van Zyl, Geir Magnusson Jr.
-
-
Field Summary
-
Fields inherited from class org.apache.velocity.runtime.parser.node.ASTMathNode
strictMode
-
-
Constructor Summary
Constructors Constructor Description ASTAddNode(int id)ASTAddNode(Parser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetLiteralOperator()get the string representing the mathematical operatorprotected ObjecthandleSpecial(Object left, Object right, InternalContextAdapter context)Extension hook to allow special behavior by subclasses If this method returns a non-null value, that is returned, rather than the result of the math operation.Numberperform(Number left, Number right, InternalContextAdapter context)Performs the math operation represented by this node.-
Methods inherited from class org.apache.velocity.runtime.parser.node.ASTMathNode
init, jjtAccept, value
-
Methods inherited from class org.apache.velocity.runtime.parser.node.ASTBinaryOperator
literal
-
Methods inherited from class org.apache.velocity.runtime.parser.node.SimpleNode
childrenAccept, cleanupParserAndTokens, clone, clone, dump, dump, dump, evaluate, execute, getColumn, getFirstToken, getFirstTokenImage, getInfo, getLastToken, getLastTokenImage, getLine, getLocation, getParser, getRuntimeServices, getTemplate, getTemplateName, getType, isInvalid, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, render, saveTokenImages, setFirstToken, setInfo, setInvalid, toString, toString
-
-
-
-
Constructor Detail
-
ASTAddNode
public ASTAddNode(int id)
- Parameters:
id-
-
ASTAddNode
public ASTAddNode(Parser p, int id)
- Parameters:
p-id-
-
-
Method Detail
-
handleSpecial
protected Object handleSpecial(Object left, Object right, InternalContextAdapter context)
Description copied from class:ASTMathNodeExtension hook to allow special behavior by subclasses If this method returns a non-null value, that is returned, rather than the result of the math operation.- Overrides:
handleSpecialin classASTMathNode- Returns:
- special value
- See Also:
handleSpecial(java.lang.Object, java.lang.Object, org.apache.velocity.context.InternalContextAdapter)
-
getLiteralOperator
public String getLiteralOperator()
Description copied from class:ASTBinaryOperatorget the string representing the mathematical operator- Specified by:
getLiteralOperatorin classASTBinaryOperator- Returns:
- operator string
-
perform
public Number perform(Number left, Number right, InternalContextAdapter context)
Description copied from class:ASTMathNodePerforms the math operation represented by this node.- Specified by:
performin classASTMathNode- Returns:
- computed value
- See Also:
perform(Number, Number, InternalContextAdapter)
-
-