|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface to specify the operations relating to the parsing and evaluation of expressions. Note that his interface is independent of any particular technologies. Note too that the (opaque) object returned from parse is supposed to be provided as a parameter to the evaluate method.
Method Summary | |
java.lang.Double |
addAlgebraicVariable(java.lang.String string,
double value)
Method to add a predefined variable to the expression parser. |
Presentable |
evaluate(java.lang.Object parseTree)
Method to evaluate a previously-parsed expression. |
java.util.Collection |
getExpressionVariables()
|
java.lang.Object |
parse(java.lang.String expression)
Method to parse an expression in the form of a String and to return a handle to the parse Tree. |
void |
resetAlgebraicVariables()
Method to remove all predefined variables from the expression parser. |
void |
setDebug(boolean debug)
Method to set the debug status for the expression parser. |
void |
setMillFactory(MillFactoryInterface millFactory)
Method to setup the mill factory for the evaluation of expressions, in particular monadic, dyadic operations, pushing and popping of values. |
void |
setVariables(Lookupable variables)
Method to setup the variables map for allowing variables to be dealt with in expressions. |
Methods inherited from interface com.rubecula.util.Identifiable |
getIdentifier |
Method Detail |
public java.lang.Object parse(java.lang.String expression)
expression
- A mathematical expression to be parsed.
public Presentable evaluate(java.lang.Object parseTree) throws PresentableException
parseTree
- An object previously returned from a call to
parse(String)
.
PresentableException
- A problem has occurred with parsing or evaluating
the expression.public void setMillFactory(MillFactoryInterface millFactory)
millFactory
- a factory for creating mills with which to evaluate
expressions.public void setVariables(Lookupable variables)
variables
- a map of variables, so that they can be looked up (may be null,
in which case undeclared variables are not enabled for this expression parser).public java.lang.Double addAlgebraicVariable(java.lang.String string, double value)
setVariables(com.rubecula.util.Lookupable)
.
string
- the name of the variablevalue
- the desired value of the variable.
public void resetAlgebraicVariables()
public void setDebug(boolean debug)
debug
- true or false.public java.util.Collection getExpressionVariables()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |