Class ASTMathNode
java.lang.Object
org.apache.velocity.runtime.parser.node.SimpleNode
org.apache.velocity.runtime.parser.node.ASTBinaryOperator
org.apache.velocity.runtime.parser.node.ASTMathNode
- All Implemented Interfaces:
Cloneable
,Node
,Renderable
- Direct Known Subclasses:
ASTAddNode
,ASTDivNode
,ASTModNode
,ASTMulNode
,ASTSubtractNode
Helps handle math
Please look at the Parser.jjt file which is what controls the generation of this class.
Please look at the Parser.jjt file which is what controls the generation of this class.
- Version:
- $Id: ASTMathNode.java 517553 2007-03-13 06:09:58Z wglass $
- Author:
- Will Glass-Husain, Peter Romianowski, Jason van Zyl, Geir Magnusson Jr., Nathan Bubna
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
handleSpecial
(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.init
(InternalContextAdapter context, Object data) jjtAccept
(StandardParserVisitor visitor, Object data) abstract Number
perform
(Number left, Number right, InternalContextAdapter context) Performs the math operation represented by this node.value
(InternalContextAdapter context) gets the two args and performs the operation on themMethods inherited from class org.apache.velocity.runtime.parser.node.ASTBinaryOperator
getLiteralOperator, 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
-
Field Details
-
strictMode
protected boolean strictMode
-
-
Constructor Details
-
ASTMathNode
public ASTMathNode(int id) -
ASTMathNode
-
-
Method Details
-
init
- Specified by:
init
in interfaceNode
- Overrides:
init
in classASTBinaryOperator
- Parameters:
context
-data
-- Returns:
- The init result.
- Throws:
TemplateInitException
- See Also:
-
jjtAccept
- Specified by:
jjtAccept
in interfaceNode
- Overrides:
jjtAccept
in classSimpleNode
- Parameters:
visitor
-data
-- Returns:
- The Node execution result object.
- See Also:
-
value
gets the two args and performs the operation on them- Specified by:
value
in interfaceNode
- Overrides:
value
in classSimpleNode
- Parameters:
context
-- Returns:
- result or null
- Throws:
MethodInvocationException
- See Also:
-
handleSpecial
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.- Parameters:
left
-right
-context
-- Returns:
- special value
- See Also:
-
perform
Performs the math operation represented by this node.- Parameters:
left
-right
-context
-- Returns:
- computed value
- See Also:
-