MathExpParser defines an abstract super class for mathematical expression parsers.
| 11 | * MathExpParser defines an abstract super class for mathematical expression parsers. |
| 12 | */ |
| 13 | public abstract class MathExpParser implements Function, MultiVarFunction { |
| 14 | /** No error. */ |
| 15 | public static final int NO_ERROR = 0; |
| 16 | |
| 17 | /** Syntax error. */ |
| 18 | public static final int SYNTAX_ERROR = 1; |
| 19 | |
| 20 | /** |
| 21 | * Parses the function string using existing variable names. |
| 22 | * |
| 23 | * @param funcStr the function to be parsed |
| 24 | */ |
| 25 | public abstract void setFunction(String funcStr) throws ParserException; |
| 26 | |
| 27 | /** |
| 28 | * Parses the function string using existing variable names. |
| 29 | * |
| 30 | * @param funcStr the function to be parsed |
| 31 | * @param vars the function's variables |
| 32 | */ |
| 33 | public abstract void setFunction(String funcStr, String[] vars) throws ParserException; |
| 34 | |
| 35 | /** |
| 36 | * Gets the function string. |
| 37 | */ |
| 38 | public abstract String getFunction(); |
| 39 | |
| 40 | public static MathExpParser createParser() { |
| 41 | return new SuryonoParser(0); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Returns names of functions recognized by the parser. |
| 46 | * |
| 47 | * @return array of function names |
| 48 | */ |
| 49 | public abstract String[] getFunctionNames(); |
| 50 | |
| 51 | } |
| 52 | |
| 53 | /* |
| 54 | * Open Source Physics software is free software; you can redistribute |
nothing calls this directly
no outgoing calls
no test coverage detected