org.jscience.physics.fluids.dynamics.util
Class EvaluateExpression

java.lang.Object
  extended by java.io.StreamTokenizer
      extended by org.jscience.physics.fluids.dynamics.util.EvaluateExpression

public class EvaluateExpression
extends java.io.StreamTokenizer

This class is used to interprete mathematical expressions. The code is mostly from the Aray v7.0 programed by myself. The possibilities of the interpreter are infinite, you can introduce new functions and interconect them with other parts of the program.


Field Summary
 java.lang.String VERSION
          version of the class
 
Fields inherited from class java.io.StreamTokenizer
nval, sval, TT_EOF, TT_EOL, TT_NUMBER, TT_WORD, ttype
 
Constructor Summary
EvaluateExpression(java.lang.String expression)
          Constructor of the class.
 
Method Summary
 void assignsVariable(java.lang.String name, double value)
          Introduce a new variable in the list of variables of the user.
 double result()
          Returns the value of the expression.
 double result(double xv, double yv)
          Returns the result of a expression type F(x,y).
 double result(double xv, double yv, double zv)
          Returns the result of a expression type F(x,y,z).
 
Methods inherited from class java.io.StreamTokenizer
commentChar, eolIsSignificant, lineno, lowerCaseMode, nextToken, ordinaryChar, ordinaryChars, parseNumbers, pushBack, quoteChar, resetSyntax, slashSlashComments, slashStarComments, toString, whitespaceChars, wordChars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public final java.lang.String VERSION
version of the class

See Also:
Constant Field Values
Constructor Detail

EvaluateExpression

public EvaluateExpression(java.lang.String expression)
Constructor of the class. Takes a argument the string that contains the mathematical formula to be evaluated.

Parameters:
expression -
Method Detail

assignsVariable

public void assignsVariable(java.lang.String name,
                            double value)
Introduce a new variable in the list of variables of the user.

Parameters:
name - string with the name of the variable.
value - numerical value to be assigned.

result

public double result()
Returns the value of the expression. The mathematical formula would have been passed to the constructor and the value of the variables would be definided in the function assignsVariable.

Returns:
DOCUMENT ME!

result

public double result(double xv,
                     double yv)
Returns the result of a expression type F(x,y). It is an abreviated form of invocation, as this method calls automatically assignsVariable for the indicated values of x and y.

Parameters:
xv - DOCUMENT ME!
yv - DOCUMENT ME!
Returns:
DOCUMENT ME!

result

public double result(double xv,
                     double yv,
                     double zv)
Returns the result of a expression type F(x,y,z). It is an abreviated form of invocation, as this method calls automatically assignsVariable for the indicated values of x and yz.

Parameters:
xv -
yv -
zv -
Returns: