public class ExpressionParser
extends java.lang.Object
Constructor and Description |
---|
ExpressionParser() |
ExpressionParser(java.lang.String expr,
java.util.Map<java.lang.String,java.lang.String> vars)
Creates a new parser
|
Modifier and Type | Method and Description |
---|---|
double |
evaluate()
Evaluates a previously added expression
|
double |
evaluate(java.lang.String expr)
Evaluates an expression
|
static void |
main(java.lang.String[] args)
Unit tests the class with expressions entered from the command line
|
void |
setExpression(java.lang.String expr)
Sets the primary expression for this parser
|
void |
setVariables(java.util.Map<java.lang.String,java.lang.String> vars)
sets the map of variables and their values for this parser
|
public ExpressionParser()
public ExpressionParser(java.lang.String expr, java.util.Map<java.lang.String,java.lang.String> vars)
expr
- the expression to parsevars
- a set of variables and their valuespublic void setVariables(java.util.Map<java.lang.String,java.lang.String> vars)
vars
- the map of variables and their valuespublic void setExpression(java.lang.String expr)
expr
- the expression to parsepublic double evaluate()
java.lang.NumberFormatException
- if the expression is malformedpublic double evaluate(java.lang.String expr)
expr
- the expression to evaluatejava.lang.NumberFormatException
- if the expression is malformedpublic static void main(java.lang.String[] args)
args
- runtime arguments - none requiredCopyright © 2004-2014 The YAWL Foundation.