blob: 50f622fa6aa79dc837c793ec21afe2f20a9c3b5e [file] [log] [blame]
package org.apache.velocity.runtime.parser.node;
import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.exception.TemplateInitException;
import org.apache.velocity.runtime.parser.Parser;
public abstract class ASTBinaryOperator extends SimpleNode
{
public ASTBinaryOperator(int id)
{
super(id);
}
public ASTBinaryOperator(Parser p, int id)
{
super(p, id);
}
/**
* @throws TemplateInitException
* @see org.apache.velocity.runtime.parser.node.Node#init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)
*/
public Object init( InternalContextAdapter context, Object data) throws TemplateInitException
{
Object obj = super.init(context, data);
cleanupParserAndTokens(); // drop reference to Parser and all JavaCC Tokens
return obj;
}
/**
* get the string representing the mathematical operator
* @return operator string
*/
public abstract String getLiteralOperator();
@Override
public String literal()
{
StringBuilder builder = new StringBuilder();
builder.append(jjtGetChild(0).literal());
builder.append(' ');
builder.append(getLiteralOperator());
builder.append(' ');
return builder.toString();
}
}