Esempio n. 1
0
 /**
  * Adds a new complex variable to the parser, or updates the value of an existing variable. This
  * must be done before parsing an expression so the parser is aware that the new variable may be
  * contained in the expression.
  *
  * @param name Name of the variable to be added
  * @param re Initial real value or new real value for the variable
  * @param im Initial imaginary value or new imaginary value for the variable
  * @return Complex object of the variable
  */
 public Complex addVariable(String name, double re, double im) {
   Complex object = new Complex(re, im);
   symTab.makeVarIfNeeded(name, object);
   return object;
 }
Esempio n. 2
0
 /**
  * Adds a new variable to the parser as an object, or updates the value of an existing variable.
  * This must be done before parsing an expression so the parser is aware that the new variable may
  * be contained in the expression.
  *
  * @param name Name of the variable to be added
  * @param object Initial value or new value for the variable
  */
 public void addVariable(String name, Object object) {
   symTab.makeVarIfNeeded(name, object);
 }
Esempio n. 3
0
 /**
  * Adds a new variable to the parser, or updates the value of an existing variable. This must be
  * done before parsing an expression so the parser is aware that the new variable may be contained
  * in the expression.
  *
  * @param name Name of the variable to be added
  * @param value Initial value or new value for the variable
  * @return Double object of the variable
  */
 public Double addVariable(String name, double value) {
   Double object = new Double(value);
   symTab.makeVarIfNeeded(name, object);
   return object;
 }