| Author | Topic |
Posts: 273
Registered: June 2006
|
|
Re: Arguments to FunctionDefinitions
|
03 Mar '12 10:25

|
 |
|
Hi JavaBob,
> Andreas, Nicolas--
>
> Thanks very much for your suggestions!
>
> 1. I can't find the ASTNode.Type of LAMBDA in my download of JSBML.
>
Please look again, it is in this class. See also the JavaDoc:
http://sbml.org/Special/Software/JSBML/build/apidocs/org/sbml/jsbml/ASTNode.Type.html#LAMBDA
> 2. Actually, I was looking for a way to take an input string such as "k1 * S1 * 2" such as might be entered into a text field and passing it to a form of the setMath( ) function in order to get it into the FunctionDefinition.
>
> However, in the absence of such a direct method, a workaround might perhaps take the form of code (I've found it in JigCell) that can convert a String such as this into MathML that I could pass to the setFormula(String formula) method.
>
As Nico explained, there is a method that you need: You can directly
pass such a formula String to the FunctionDefinition object (I cite a
previous e-mail):
fd2.setFormula("lambda(x,y,z,2)");
(where fd2 is your function definition). In order to parse the formual
above, you would have to write
fd2.setFormula("lambda(k1, S1, k1 * S1 * 2)");
That's it.
> 3. As for working with arguments: I've found that the following code fragment
>
> FormulaCompiler fc = new FormulaCompiler( );
> fc.function( fd, (java.util.List) paramList );
>
> where paramList is an ArrayList of ASTNodes of arguments would seem to be able to pass arguments into the function definition. Not sure how this would relate to the body of the formula, though.
>
The purpose of the FormulaCompiler is precisely the opposit of what you
are interested in: It generates infix formula strings from ASTNode
objects, but you want to parse these. Therefore, this method won't be
useful for your purpose.
I hope this helps clarifying FunctionDefinitions a bit.
> --JavaBob
Cheers
Andreas
--
Dr. Andreas Dräger
University of Tuebingen
Center for Bioinformatics Tuebingen (ZBIT)
Sand 1
72076 Tübingen
Germany
Phone: +49-7071-29-78982
Fax: +49-7071-29-5091
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|
|
|