/* Generated By:JJTree: Do not edit this line. ASTUserDefinedFunctionDef.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package org.openntf.formula.ast;
import org.openntf.formula.FormulaContext;
import org.openntf.formula.FormulaReturnException;
import org.openntf.formula.ValueHolder;
import org.openntf.formula.impl.UserDefinedFunction;
import org.openntf.formula.parse.AtFormulaParserImpl;
import org.openntf.formula.parse.ParseException;
public class ASTUserDefinedFunctionDef extends SimpleNode {
private UserDefinedFunction function;
private String functionName;
public ASTUserDefinedFunctionDef(final AtFormulaParserImpl p, final int id) {
super(p, id);
}
@Override
public ValueHolder evaluate(final FormulaContext ctx) throws FormulaReturnException {
// This node is parent of ASTUserDefinedFunction and should never be evaluated
throw new UnsupportedOperationException();
}
public void init(final String image) throws ParseException {
functionName = image;
int functionParameters = 0;
if (children != null) {
functionParameters = children.length;
}
ASTUserDefinedFunctionParameter[] parameter = new ASTUserDefinedFunctionParameter[functionParameters];
for (int i = 0; i < functionParameters; i++) {
parameter[i] = (ASTUserDefinedFunctionParameter) children[i];
}
function = new UserDefinedFunction(functionName, parameter, parser);
parser.declareFunction(function);
}
public UserDefinedFunction getFunction() {
return function;
}
}
/* JavaCC - OriginalChecksum=b974eb6e2d91a4ef4e4bfaceab9a9b58 (do not edit this line) */