类 MathExpParser

java.lang.Object
com.sh.compile.express.MathExpParser

public class MathExpParser extends Object

Description:

Title:首亨软件 - TSS/CRM等

从以下版本开始:
2014年12月11日
  • 构造器详细资料

    • MathExpParser

      public MathExpParser()
  • 方法详细资料

    • addVariableCallback

      public void addVariableCallback(MathExpVariable_I mevCallback)
    • initSymTab

      public void initSymTab()
      Initializes the symbol table
    • initFunTab

      public void initFunTab()
      Initializes the function table
    • addStandardFunctions

      public void addStandardFunctions()
      Adds the standard functions to the parser. If this function is not called before parsing an expression, functions such as sin() or cos() would produce an "Unrecognized function..." error. In most cases, this method should be called immediately after the JEP object is created.
    • addStandardConstants

      public void addStandardConstants()
      Adds the constants pi and e to the parser. As addStandardFunctions(), this method should be called immediatly after the JEP object is created.
    • addFunction

      public void addFunction(String functionName, Object function)
    • addVariable

      public Double addVariable(String name, double value)
      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.
      参数:
      name - Name of the variable to be added
      value - Initial value or new value for the variable
      返回:
      Double object of the variable
    • getVarNode

      public ASTVarNode getVarNode(String var)
    • setVarNode

      public void setVarNode(String var, ASTVarNode node)
    • parseExpression

      public void parseExpression(String expression_in)
      Parses the expression
      参数:
      expression_in - The input expression string
    • getValue

      public double getValue() throws ParseException
      抛出:
      ParseException
    • getTopNode

      public SimpleNode getTopNode()
    • getValue

      public double getValue(DoubleStack evalStack) throws ParseException
      抛出:
      ParseException
    • hasError

      public boolean hasError()
      Reports whether there is an error in the expression
      返回:
      Returns true if the expression has an error
    • getErrorInfo

      public String getErrorInfo()
      Reports information on the error in the expression
      返回:
      Returns a string containing information on the error; null if no error has occured