📄 graph.parsefunction.html
字号:
<!--NewPage--><html><head><!-- Generated by javadoc on Wed Oct 23 13:30:49 EST 1996 --><a name="_top_"></a><title> Class graph.ParseFunction</title></head><body><pre><a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-graph.html">This Package</a> <a href="graph.Markers.html#_top_">Previous</a> <a href="graph.RTextLine.html#_top_">Next</a> <a href="AllNames.html">Index</a></pre><hr><h1> Class graph.ParseFunction</h1><pre><a href="java.lang.Object.html#_top_">java.lang.Object</a> | +----<a href="graph.ScanString.html#_top_">graph.ScanString</a> | +----graph.ParseFunction</pre><hr><dl> <dt> public class <b>ParseFunction</b> <dt> extends <a href="graph.ScanString.html#_top_">ScanString</a></dl>This class will parse a function definition and solve it returning thevalue. The function may have upto 3 independent variables in it(x,y,z). <p><b>Known Bugs</B> This class is not fool proof. If the answer is wrongthen use the parenthesis to force the order of evaluation. The mostlikely place this will be needed is in the use of the power command.The exponent is not evaluated correctly if it begins with aunary operator.<h3>List of recognised commands</h3><ul> <li> ( ) parenthesis , comma <li> +, -, unary -, unary + <li> *, / <li> ^ (raise to a power) <li> pi, e, All the constants in class SpecialFunction <li> log <li> sin, cos, tan <li> asin, acos, atan <li> sqrt <li> rand <li> exp <li> remainder <li> atan2 <li> All the functions in class SpecialFunction <li> Independent variables x,y,z <li> Scientific notation using "e", "E", "d", "D".</ul><dl> <dt> <b>Version:</b> <dd> 1.8, 1996/08/12 23:37:08 <dt> <b>Author:</b> <dd> Leigh Brookshaw</dl><hr><a name="index"></a><h2> <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index"></h2><dl> <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o "> <a href="#debug"><b>debug</b></a> <dd> Debug variable.</dl><h2> <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index"></h2><dl> <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o "> <a href="#ParseFunction()"><b>ParseFunction</b></a>() <dd> Instantiate the class <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o "> <a href="#ParseFunction(java.lang.String)"><b>ParseFunction</b></a>(String) <dd> Instantiate the class and define the string to parse.</dl><h2> <img src="images/method-index.gif" width=207 height=38 alt="Method Index"></h2><dl> <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResult()"><b>getResult</b></a>() <dd> Return the solution of the function if it has no independent valuesor they have already been set using the set methods <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResult(double)"><b>getResult</b></a>(double) <dd> Return the solution of the function given the independent values <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResult(double, double)"><b>getResult</b></a>(double, double) <dd> Return the solution of the function given the independent values <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResult(double, double, double)"><b>getResult</b></a>(double, double, double) <dd> Return the solution of the function given the independent values <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResults(int, double[])"><b>getResults</b></a>(int, double[]) <dd> Return an array of solutions given an array of x values <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResults(int, double[], double[])"><b>getResults</b></a>(int, double[], double[]) <dd> Return an array of solutions given an array of x values and y values <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getResults(int, double[], double[], double[])"><b>getResults</b></a>(int, double[], double[], double[]) <dd> Return an array of solutions given an array of x values, y valuesand z values. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getVariables()"><b>getVariables</b></a>() <dd> Return a boolean array with index 0 true if the independentvariable x was found in the function, index 1 true ify was found, and index 2 true if z was found. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#parse()"><b>parse</b></a>() <dd> Parse the previously set string <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#parse(java.lang.String)"><b>parse</b></a>(String) <dd> Parse the string. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setX(double)"><b>setX</b></a>(double) <dd> Set the value of the independent variable X. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setY(double)"><b>setY</b></a>(double) <dd> Set the value of the independent variable Y. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setZ(double)"><b>setZ</b></a>(double) <dd> Set the value of the independent variable Z.</dl><a name="variables"></a><h2> <img src="images/variables.gif" width=153 height=38 alt="Variables"></h2><a name="debug"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a><b>debug</b><pre> public boolean debug</pre><dl> <dd> Debug variable. If set true debug output is printed.</dl><a name="constructors"></a><h2> <img src="images/constructors.gif" width=231 height=38 alt="Constructors"></h2><a name="ParseFunction"></a><a name="ParseFunction()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>ParseFunction</b><pre> public ParseFunction()</pre><dl> <dd> Instantiate the class</dl><a name="ParseFunction(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>ParseFunction</b><pre> public ParseFunction(<a href="java.lang.String.html#_top_">String</a> s)</pre><dl> <dd> Instantiate the class and define the string to parse. <dl> <dt> <b>Parameters:</b> <dd> s - The string to be parsed. </dl></dl><a name="methods"></a><h2> <img src="images/methods.gif" width=151 height=38 alt="Methods"></h2><a name="parse(java.lang.String)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="parse"><b>parse</b></a><pre> public boolean parse(<a href="java.lang.String.html#_top_">String</a> s)</pre><dl> <dd> Parse the string. <dl> <dt> <b>Parameters:</b> <dd> s - The string to parse <dt> <b>Returns:</b> <dd> true if it was successful, false otherwise. </dl></dl><a name="parse()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="parse"><b>parse</b></a><pre> public boolean parse()</pre><dl> <dd> Parse the previously set string <dl> <dt> <b>Returns:</b> <dd> true if it was successful, false otherwise. </dl></dl><a name="getResult(double, double, double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResult"><b>getResult</b></a><pre> public double getResult(double x, double y, double z) throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return the solution of the function given the independent values <dl> <dt> <b>Parameters:</b> <dd> x - indpendent x value <dd> y - indpendent y value <dd> z - indpendent z value <dt> <b>Returns:</b> <dd> solution of the function </dl></dl><a name="getResult(double, double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResult"><b>getResult</b></a><pre> public double getResult(double x, double y) throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return the solution of the function given the independent values <dl> <dt> <b>Parameters:</b> <dd> x - indpendent x value <dd> y - indpendent y value <dt> <b>Returns:</b> <dd> solution of the function </dl></dl><a name="getResult(double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResult"><b>getResult</b></a><pre> public double getResult(double x) throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return the solution of the function given the independent values <dl> <dt> <b>Parameters:</b> <dd> x - indpendent x value <dt> <b>Returns:</b> <dd> solution of the function </dl></dl><a name="getResult()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResult"><b>getResult</b></a><pre> public double getResult() throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return the solution of the function if it has no independent valuesor they have already been set using the set methods <dl> <dt> <b>Returns:</b> <dd> solution of the function <dt> <b>See Also:</b> <dd> <a href="ParseFunction.setX().html#_top_">setX()</a>, <a href="ParseFunction.setY().html#_top_">setY()</a>, <a href="ParseFunction.setZ().html#_top_">setZ()</a> </dl></dl><a name="getResults(int, double[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResults"><b>getResults</b></a><pre> public double[] getResults(int n, double x[]) throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return an array of solutions given an array of x values <dl> <dt> <b>Parameters:</b> <dd> n - number of values to process in the input array <dd> x - Array containing the x values. <dt> <b>Returns:</b> <dd> Array containing the solutions. <dt> <b>Throws:</b> <a href="Exception.html#_top_">Exception</a> <dd> Generic exception if the array index n<=0, or x is null. </dl></dl><a name="getResults(int, double[], double[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResults"><b>getResults</b></a><pre> public double[] getResults(int n, double x[], double y[]) throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return an array of solutions given an array of x values and y values <dl> <dt> <b>Parameters:</b> <dd> n - number of values to process in the input array <dd> x - Array containing the x values. <dd> y - Array containing the y values. <dt> <b>Returns:</b> <dd> Array containing the solutions. <dt> <b>Throws:</b> <a href="Exception.html#_top_">Exception</a> <dd> Generic exception if the array index n<=0, or x is null, or y is null. </dl></dl><a name="getResults(int, double[], double[], double[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getResults"><b>getResults</b></a><pre> public double[] getResults(int n, double x[], double y[], double z[]) throws <a href="java.lang.Exception.html#_top_">Exception</a></pre><dl> <dd> Return an array of solutions given an array of x values, y valuesand z values. <dl> <dt> <b>Parameters:</b> <dd> n - number of values to process in the input array <dd> x - Array containing the x values. <dd> y - Array containing the y values. <dt> <b>Returns:</b> <dd> Array containing the solutions. <dt> <b>Throws:</b> <a href="Exception.html#_top_">Exception</a> <dd> Generic exception if the array index n<=0, or x is null, or y is null, or z is null. </dl></dl><a name="getVariables()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getVariables"><b>getVariables</b></a><pre> public boolean[] getVariables()</pre><dl> <dd> Return a boolean array with index 0 true if the independentvariable x was found in the function, index 1 true ify was found, and index 2 true if z was found.</dl><a name="setX(double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setX"><b>setX</b></a><pre> public void setX(double x)</pre><dl> <dd> Set the value of the independent variable X.</dl><a name="setY(double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setY"><b>setY</b></a><pre> public void setY(double y)</pre><dl> <dd> Set the value of the independent variable Y.</dl><a name="setZ(double)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setZ"><b>setZ</b></a><pre> public void setZ(double z)</pre><dl> <dd> Set the value of the independent variable Z.</dl><hr><pre><a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-graph.html">This Package</a> <a href="graph.Markers.html#_top_">Previous</a> <a href="graph.RTextLine.html#_top_">Next</a> <a href="AllNames.html">Index</a></pre></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -