|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.bliki.wiki.template.expr.eval.DoubleEvaluator
public class DoubleEvaluator
Evaluate math expressions to double
numbers.
Use the expression syntax describe here: http://meta.wikimedia.org/wiki/Help:ParserFunctions#.23expr:
Field Summary | |
---|---|
static double |
EPSILON
A "close to zero" double epsilon value for use to compare with 0.0 |
static double |
EPSILON_ROUND
A "close to zero" double epsilon value for use in the Round function |
Constructor Summary | |
---|---|
DoubleEvaluator()
|
|
DoubleEvaluator(ASTNode node)
|
Method Summary | |
---|---|
double |
evaluate()
Reevaluate the expression (possibly after a new Variable
assignment) |
double |
evaluate(java.lang.String expression)
Parse the given expression String and evaluate it to a
double value |
double |
evaluateFunction(FunctionNode functionNode)
Evaluate an already parsed in FunctionNode into a
souble number value. |
boolean |
evaluateFunctionLogical(FunctionNode functionNode)
|
double |
evaluateNode(ASTNode node)
Evaluate an already parsed in abstract syntax tree node into a double number value. |
boolean |
evaluateNodeLogical(ASTNode node)
|
ASTNode |
optimizeFunction(FunctionNode functionNode)
Optimize an already parsed in functionNode into an
ASTNode . |
ASTNode |
parse(java.lang.String expression)
Parse the given expression String and store the resulting
ASTNode in this DoubleEvaluator |
static ASTNode |
parseNode(java.lang.String expression)
Parse the given expression String and return the resulting
ASTNode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static double EPSILON
public static double EPSILON_ROUND
Constructor Detail |
---|
public DoubleEvaluator()
public DoubleEvaluator(ASTNode node)
Method Detail |
---|
public ASTNode parse(java.lang.String expression)
expression String
and store the resulting
ASTNode in this DoubleEvaluator
expression
-
SyntaxError
public static ASTNode parseNode(java.lang.String expression)
expression String
and return the resulting
ASTNode
expression
-
SyntaxError
public double evaluate(java.lang.String expression)
expression String
and evaluate it to a
double value
expression
-
SyntaxError
public double evaluate()
expression
(possibly after a new Variable
assignment)
expression
-
SyntaxError
public double evaluateNode(ASTNode node)
double
number value.
node
- abstract syntax tree node
java.lang.ArithmeticException
- if the node
cannot be evaluated.public double evaluateFunction(FunctionNode functionNode)
FunctionNode
into a
souble
number value.
functionNode
-
java.lang.ArithmeticException
- if the functionNode
cannot be evaluated.public boolean evaluateNodeLogical(ASTNode node)
public boolean evaluateFunctionLogical(FunctionNode functionNode)
public ASTNode optimizeFunction(FunctionNode functionNode)
functionNode
into an
ASTNode
.
functionNode
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |