public abstract class ASTMathNode extends ASTBinaryOperator
Modifier and Type | Field and Description |
---|---|
protected boolean |
strictMode |
Constructor and Description |
---|
ASTMathNode(int id) |
ASTMathNode(Parser p,
int id) |
Modifier and Type | Method and Description |
---|---|
protected 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.
|
Object |
init(InternalContextAdapter context,
Object data) |
Object |
jjtAccept(ParserVisitor visitor,
Object data) |
abstract Number |
perform(Number left,
Number right,
InternalContextAdapter context)
Performs the math operation represented by this node.
|
Object |
value(InternalContextAdapter context)
gets the two args and performs the operation on them
|
getLiteralOperator, literal
childrenAccept, cleanupParserAndTokens, 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
public ASTMathNode(int id)
public ASTMathNode(Parser p, int id)
public Object init(InternalContextAdapter context, Object data) throws TemplateInitException
init
in interface Node
init
in class ASTBinaryOperator
TemplateInitException
Node.init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
public Object jjtAccept(ParserVisitor visitor, Object data)
jjtAccept
in interface Node
jjtAccept
in class SimpleNode
Node.jjtAccept(org.apache.velocity.runtime.parser.node.ParserVisitor, java.lang.Object)
public Object value(InternalContextAdapter context) throws MethodInvocationException
value
in interface Node
value
in class SimpleNode
context
- MethodInvocationException
Node.value(org.apache.velocity.context.InternalContextAdapter)
protected Object handleSpecial(Object left, Object right, InternalContextAdapter context)
left
- right
- context
- ASTAddNode.handleSpecial(java.lang.Object, java.lang.Object, org.apache.velocity.context.InternalContextAdapter)
public abstract Number perform(Number left, Number right, InternalContextAdapter context)
left
- right
- context
- ASTAddNode.perform(Number, Number, InternalContextAdapter)
Copyright © 2000–2021 The Apache Software Foundation. All rights reserved.