org.jmat.function.expressionParser
Class Evaluator

java.lang.Object
  |
  +--org.jmat.function.expressionParser.Evaluator

public class Evaluator
extends java.lang.Object

Expresion parser based on The-Son LAI MathEvaluator class : Lts@writeme.com

Titre : Mathematic expression evaluator

Copyright : LGPL


Nested Class Summary
protected  class Evaluator.Node
           
protected  class Evaluator.Operator
           
 
Field Summary
protected static Evaluator.Operator[] operators
           
 
Constructor Summary
Evaluator()
          creates an empty MathEvaluator.
Evaluator(java.lang.String s)
          creates a MathEvaluator and assign the math expression string.
 
Method Summary
protected static void _D(java.lang.String s)
           
 void addVariable(java.lang.String v, double val)
          adds a variable and its value in the MathEvaluator
 void addVariable(java.lang.String v, java.lang.Double val)
          adds a variable and its value in the MathEvaluator
 void addVariable(java.lang.String v, Matrix val)
          adds a variable and its value in the MathEvaluator
protected  Evaluator.Operator[] getOperators()
           
 java.lang.Object getValue()
          evaluates and returns the value of the expression
 java.lang.Object getVariable(java.lang.String s)
          gets the variable's value that was assigned previously
 void reset()
          resets the evaluator
 void setExpression(java.lang.String s)
          sets the expression
 void trace()
          trace the binary tree for debug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operators

protected static Evaluator.Operator[] operators
Constructor Detail

Evaluator

public Evaluator()
creates an empty MathEvaluator. You need to use setExpression(String s) to assign a math expression string to it.


Evaluator

public Evaluator(java.lang.String s)
creates a MathEvaluator and assign the math expression string.

Method Detail

addVariable

public void addVariable(java.lang.String v,
                        Matrix val)
adds a variable and its value in the MathEvaluator


addVariable

public void addVariable(java.lang.String v,
                        double val)
adds a variable and its value in the MathEvaluator


addVariable

public void addVariable(java.lang.String v,
                        java.lang.Double val)
adds a variable and its value in the MathEvaluator


setExpression

public void setExpression(java.lang.String s)
sets the expression


reset

public void reset()
resets the evaluator


trace

public void trace()
trace the binary tree for debug


getValue

public java.lang.Object getValue()
evaluates and returns the value of the expression


getVariable

public java.lang.Object getVariable(java.lang.String s)
gets the variable's value that was assigned previously


getOperators

protected Evaluator.Operator[] getOperators()

_D

protected static void _D(java.lang.String s)