Class DerivativeScanner
java.lang.Object
math.differentialcalculus.DerivativeScanner
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
boolean
private static boolean
static void
private void
Scans the list and arranges scattered parts of a single number token.void
setExpression
(String expression) void
setScanner
(ArrayList<String> scanner) void
setSyntaxValid
(boolean syntaxValid) private boolean
-
Field Details
-
expression
String expression -
scanner
-
syntaxValid
private boolean syntaxValid
-
-
Constructor Details
-
DerivativeScanner
-
-
Method Details
-
isNumber
- Parameters:
token
- The token to examine.- Returns:
- true if it is found to be a number.
-
isValidOperatorOrMethod
- Parameters:
op
- The token to examine.- Returns:
- true if it a valid operator or method in a differentiable function.
-
syntaxAnalyzer
- Returns:
- true if the tokens found in the array are either of type operator,variable,number or method...e.g sin,cos... At this stage also, we disallow the user from using inbuilt method names in user-defined variable names.
- Throws:
Exception
- if an invalid token is found during scanning,
-
setSyntaxValid
public void setSyntaxValid(boolean syntaxValid) -
isSyntaxValid
public boolean isSyntaxValid() -
setScanner
-
getScanner
-
setExpression
-
getExpression
-
orderNumberTokens
private void orderNumberTokens()Scans the list and arranges scattered parts of a single number token. CustomScanner is not built to leave numbers intact..but rather splits according to the supplied tokens. So since - and + were supplied as splitting tokens here, a number such as 3.2E9 would be left intact, whereas 3.2E-9 would be split into 3.2E,-,9 -
main
-