Package org.opensourcephysics.numerics
Class MathExpParser
java.lang.Object
org.opensourcephysics.numerics.MathExpParser
- All Implemented Interfaces:
Function
,MultiVarFunction
- Direct Known Subclasses:
SuryonoParser
MathExpParser defines an abstract super class for mathematical expression parsers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
No error.static final int
Syntax error. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MathExpParser
abstract String
Gets the function string.abstract String[]
Returns names of functions recognized by the parser.abstract void
setFunction
(String funcStr) Parses the function string using existing variable names.abstract void
setFunction
(String funcStr, 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.MultiVarFunction
evaluate
-
Field Details
-
NO_ERROR
public static final int NO_ERRORNo error.- See Also:
-
SYNTAX_ERROR
public static final int SYNTAX_ERRORSyntax error.- See Also:
-
-
Constructor Details
-
MathExpParser
public MathExpParser()
-
-
Method Details
-
setFunction
Parses the function string using existing variable names.- Parameters:
funcStr
- the function to be parsed- Throws:
ParserException
-
setFunction
Parses the function string using existing variable names.- Parameters:
funcStr
- the function to be parsedvars
- the function's variables- Throws:
ParserException
-
getFunction
Gets the function string. -
createParser
-
getFunctionNames
Returns names of functions recognized by the parser.- Returns:
- array of function names
-