code = indentedCode.toString();
if(code != ""){
py.insert(0, code);
}else{
throw new ScriptGenException("Trying to generate script of non user-defined function on an origin which is not supported.");
}
return absFun.getName();
}
for(Function f: fns)
{
String exp;
if(f instanceof PostfixFunction)
{
PostfixFunction pf = (PostfixFunction) f;
exp = pf.getExpression();
exp=exp.replaceAll("\\^","**");
exp=exp.replaceAll("!"," not ");
exp=exp.replaceAll("&"," and ");
exp=exp.replaceAll("\\|"," or ");
exp=exp.replaceAll("ln","log");
for(int j = 0; j < f.getDimension(); j++)
{
String find = "x"+ Integer.toString(j);
String replace = "x["+ Integer.toString(j) + "]";
exp=exp.replaceAll(find, replace);
}
}
else if(f instanceof IdentityFunction)
{
exp = "x[" + Integer.toString(((IdentityFunction) f).getIdentityDimension()) + "]";
}
else if(f instanceof ConstantFunction)
{
exp = Float.toString(((ConstantFunction) f).getValue());
}
else
{
throw new ScriptGenException("Trying to generate script of non user-defined function on an origin which is not supported.");
}
if (first)
{
funcString.append(exp);