public class Expression extends Object
Class provides easy way to define multivariate arithmetic expression.
Constructor and Description |
---|
Expression(String expressionString)
Constructor - creates new expression from expression string.
|
Modifier and Type | Method and Description |
---|---|
double |
calculate()
Calculates the expression value
|
boolean |
checkSyntax()
Checks syntax of the expression string.
|
protected Expression |
clone()
Expression cloning.
|
double |
getComputingTime()
Gets computing time.
|
List<Token> |
getCopyOfInitialTokens()
Tokenizes expression string and returns tokens list, including: string, type,
level.
|
String |
getDescription()
Gets expression description.
|
String |
getErrorMessage()
Method return error message after calling checkSyntax() method or
calculate().
|
String |
getExpressionString()
Returns expression string
|
String |
getHelp()
Gets help content.
|
String |
getHelp(String word)
Searching help content.
|
List<KeyWord> |
getKeyWords()
Returns list of key words known to the parser
|
List<KeyWord> |
getKeyWords(String query)
Returns list of key words known to the parser
|
String[] |
getMissingUserDefinedArguments()
Returns missing user defined arguments names, i.e. sin(x) + cos(y) where x
and y are not defined function will return x and y.
|
String[] |
getMissingUserDefinedFunctions()
Returns missing user defined functions names, i.e. sin(x) + fun(x,y) where
fun is not defined function will return fun.
|
String[] |
getMissingUserDefinedUnits()
Returns missing user defined units names, i.e. 2*[w] + [q] where [w] and [q]
are not defined function will return [w] and [q].
|
boolean |
getRecursiveMode()
Gets recursive mode status
|
boolean |
getSyntaxStatus()
Gets syntax status of the expression.
|
boolean |
getVerboseMode()
Returns verbose mode status.
|
void |
setDescription(String description)
Sets expression description.
|
void |
setExpressionString(String expressionString)
Sets (modifies expression) expression string.
|
void |
setSilentMode()
Disables verbose mode (default silent mode).
|
void |
setVerboseMode()
Enables verbose mode.
|
public Expression(String expressionString)
expressionString
- definition of the expressionpublic String getErrorMessage()
public boolean getSyntaxStatus()
public void setExpressionString(String expressionString)
expressionString
- the expression stringpublic String getExpressionString()
public void setDescription(String description)
description
- the description stringpublic String getDescription()
public void setVerboseMode()
public void setSilentMode()
public boolean getVerboseMode()
public boolean getRecursiveMode()
public double getComputingTime()
public boolean checkSyntax()
public double calculate()
public List<Token> getCopyOfInitialTokens()
Token
public String[] getMissingUserDefinedArguments()
public String[] getMissingUserDefinedUnits()
public String[] getMissingUserDefinedFunctions()
public String getHelp()
public String getHelp(String word)
word
- searching key wordpublic List<KeyWord> getKeyWords()
KeyWord
,
KeyWord.wordTypeId
,
getHelp()
public List<KeyWord> getKeyWords(String query)
query
- Give any string to filter list of key words against this string.
User more precise syntax: str=tokenString, desc=tokenDescription,
syn=TokenSyntax, sin=tokenSince, wid=wordId, tid=wordTypeId to
narrow the result.KeyWord
,
KeyWord.wordTypeId
,
getHelp(String)
protected Expression clone()