org.opensourcephysics.numerics
Class MathExpParser

java.lang.Object
  extended by org.opensourcephysics.numerics.MathExpParser
All Implemented Interfaces:
Function, MultiVarFunction
Direct Known Subclasses:
SuryonoParser

public abstract class MathExpParser
extends java.lang.Object
implements Function, MultiVarFunction

MathExpParser defines an abstract super class for mathematical expression parsers.


Field Summary
static int NO_ERROR
          No error.
static int SYNTAX_ERROR
          Syntax error.
 
Constructor Summary
MathExpParser()
           
 
Method Summary
static MathExpParser createParser()
           
abstract  java.lang.String getFunction()
          Gets the function string.
abstract  java.lang.String[] getFunctionNames()
          Returns names of functions recognized by the parser.
abstract  void setFunction(java.lang.String funcStr)
          Parses the function string using existing variable names.
abstract  void setFunction(java.lang.String funcStr, java.lang.String[] vars)
          Parses the function string using existing variable names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.numerics.Function
evaluate
 
Methods inherited from interface org.opensourcephysics.numerics.MultiVarFunction
evaluate
 

Field Detail

NO_ERROR

public static final int NO_ERROR
No error.

See Also:
Constant Field Values

SYNTAX_ERROR

public static final int SYNTAX_ERROR
Syntax error.

See Also:
Constant Field Values
Constructor Detail

MathExpParser

public MathExpParser()
Method Detail

setFunction

public abstract void setFunction(java.lang.String funcStr)
                          throws ParserException
Parses the function string using existing variable names.

Parameters:
funcStr - the function to be parsed
Throws:
ParserException

setFunction

public abstract void setFunction(java.lang.String funcStr,
                                 java.lang.String[] vars)
                          throws ParserException
Parses the function string using existing variable names.

Parameters:
funcStr - the function to be parsed
vars - the function's variables
Throws:
ParserException

getFunction

public abstract java.lang.String getFunction()
Gets the function string.


createParser

public static MathExpParser createParser()

getFunctionNames

public abstract java.lang.String[] getFunctionNames()
Returns names of functions recognized by the parser.

Returns:
array of function names