private static void printFunctionDefinition(int n, FunctionDefinition fd)
{
ASTNode math;
string formula;
if (fd.isSetMath())
{
Console.Write("FunctionDefinition " + n + ", " + fd.getId());
math = fd.getMath();
/* Print function arguments. */
if (math.getNumChildren() > 1)
{
Console.Write("(" + (math.getLeftChild()).getName());
for (n = 1; n < math.getNumChildren() - 1; ++n)
{
Console.Write(", " + (math.getChild(n)).getName());
}
}
Console.Write(") := ");
/* Print function body. */
if (math.getNumChildren() == 0)
{
Console.Write("(no body defined)");
}
else
{
math = math.getChild(math.getNumChildren() - 1);
formula = libsbml.formulaToString(math);
Console.Write(formula + Environment.NewLine);
}
}
}