|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFEJDMath.FctParser
Used to evaluate a function given as a string in the data file, the parser understands tan, sin, cos, exp, ln, log, sqrt, pi, X, Y
Field Summary | |
private int |
arraySize
The size of the array containing the tokens |
private java.lang.String |
function
The string representing the function |
private Token[] |
liste
The token list on which we work |
private int |
maxToken
The maximum numbr of token that the string may have (all symbols including spaces are considered tokens) |
private Token[] |
originalListe
The original token list |
private double |
x
The coordinates at which the function is calculated |
private double |
y
The coordinates at which the function is calculated |
Constructor Summary | |
FctParser(java.lang.String s)
Creates a new parser and loads the string s |
Method Summary | |
private void |
caculToken(int deb,
int fin)
Computes each token which represents an operation (+ * - /) |
double |
calcFctAt(double x,
double y)
Computes the loaded function at the point (x,y) |
void |
dispToken()
Displays the list of tokens |
private int |
findNext(int z,
int fin)
Finds the following non empty token in liste |
private int |
findPrec(int z,
int deb)
Finds the preceding non empty token in liste |
java.lang.String |
getFunction()
Returns the string representing the function |
private void |
replaceMFct(int deb,
int fin)
Computes the math functions |
private void |
splitPar(int deb,
int fin)
Splits the string according to parentheses and calls calculToken to compute each token |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final int maxToken
private Token[] liste
private Token[] originalListe
private java.lang.String function
private int arraySize
private double x
private double y
Constructor Detail |
public FctParser(java.lang.String s)
Method Detail |
public double calcFctAt(double x, double y)
private void splitPar(int deb, int fin)
private void caculToken(int deb, int fin)
private void replaceMFct(int deb, int fin)
private int findPrec(int z, int deb)
private int findNext(int z, int fin)
public void dispToken()
public java.lang.String getFunction()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |