public class ParseFunction extends ScanString implements Serializable
Known Bugs This class is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.
Modifier and Type | Field and Description |
---|---|
boolean |
debug
Debug variable.
|
Constructor and Description |
---|
ParseFunction()
Instantiate the class
|
ParseFunction(String s)
Instantiate the class and define the string to parse.
|
Modifier and Type | Method and Description |
---|---|
double |
getResult()
Return the solution of the function if it has no independent values
or they have already been set using the set methods
|
double |
getResult(double x)
Return the solution of the function given the independent values
|
double |
getResult(double x,
double y)
Return the solution of the function given the independent values
|
double |
getResult(double x,
double y,
double z)
Return the solution of the function given the independent values
|
double[] |
getResults(int n,
double[] x)
Return an array of solutions given an array of x values
|
double[] |
getResults(int n,
double[] x,
double[] y)
Return an array of solutions given an array of x values and y values
|
double[] |
getResults(int n,
double[] x,
double[] y,
double[] z)
Return an array of solutions given an array of x values, y values
and z values.
|
boolean[] |
getVariables()
Return a boolean array with index 0 true if the independent
variable x was found in the function, index 1 true if
y was found, and index 2 true if z was found.
|
boolean |
parse()
Parse the previously set string
|
boolean |
parse(String s)
Parse the string.
|
void |
setIndepVariables(boolean ix,
boolean iy,
boolean iz)
Set independent variables
|
void |
setX(double x)
Set the value of the independent variable X.
|
void |
setY(double y)
Set the value of the independent variable Y.
|
void |
setZ(double z)
Set the value of the independent variable Z.
|
addKeyWord, getKeyValue, nextWord, resetKeyWords, setString
public ParseFunction()
public ParseFunction(String s)
s
- The string to be parsed.public boolean parse(String s)
s
- The string to parsepublic boolean parse()
public double getResult(double x, double y, double z) throws Exception
x
- indpendent x valuey
- indpendent y valuez
- indpendent z valueException
public double getResult(double x, double y) throws Exception
x
- indpendent x valuey
- indpendent y valueException
public double getResult(double x) throws Exception
x
- indpendent x valueException
public double getResult() throws Exception
Exception
ParseFunction.setX()
,
ParseFunction.setY()
,
ParseFunction.setZ()
public double[] getResults(int n, double[] x) throws Exception
n
- number of values to process in the input arrayx
- Array containing the x values.Exception
- Generic exception if the array index n<=0, or x is null.public double[] getResults(int n, double[] x, double[] y) throws Exception
n
- number of values to process in the input arrayx
- Array containing the x values.y
- Array containing the y values.Exception
- Generic exception if the array index n<=0, or x is null, or y is null.public double[] getResults(int n, double[] x, double[] y, double[] z) throws Exception
n
- number of values to process in the input arrayx
- Array containing the x values.y
- Array containing the y values.Exception
- Generic exception if the array index n<=0, or x is null,
or y is null, or z is null.public boolean[] getVariables()
public void setX(double x)
public void setY(double y)
public void setZ(double z)
public void setIndepVariables(boolean ix, boolean iy, boolean iz)
Jas4pp 1.5 © Java Analysis Studio for Particle Physics