|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.MathematicalExpression.TreeNode
public static class MathematicalExpression.TreeNode
Tree Node of MathematicalExpression
Field Summary | |
---|---|
static int[] |
arity
The arity of the known functions |
static java.lang.String[] |
funs
The known functions |
Constructor Summary | |
---|---|
MathematicalExpression.TreeNode(double v)
Construct a constant node |
|
MathematicalExpression.TreeNode(int t,
java.util.Vector ops)
Construct an operator node |
|
MathematicalExpression.TreeNode(MathematicalExpression.TreeNode n)
Construct a constant node |
|
MathematicalExpression.TreeNode(java.lang.String v)
Construct a variable node |
|
MathematicalExpression.TreeNode(java.lang.String f,
java.util.Vector ops)
Construct a function node |
|
MathematicalExpression.TreeNode(java.util.Vector p)
Construct an ifelse node |
Method Summary | |
---|---|
double |
eval(java.util.Map symbols)
Evaluate the tree with for specific values of the variables |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String[] funs
public static int[] arity
Constructor Detail |
---|
public MathematicalExpression.TreeNode(double v)
v
- the value of the constantpublic MathematicalExpression.TreeNode(MathematicalExpression.TreeNode n)
n
- the value of the constantpublic MathematicalExpression.TreeNode(java.lang.String v)
v
- the name of the variablepublic MathematicalExpression.TreeNode(java.util.Vector p)
p
- parameters of the ifelsepublic MathematicalExpression.TreeNode(java.lang.String f, java.util.Vector ops) throws java.lang.Exception
f
- the name of the functionops
- the operands of the function
java.lang.Exception
- if function is unknown or wrong aritypublic MathematicalExpression.TreeNode(int t, java.util.Vector ops) throws java.lang.Exception
t
- the operator '+','-','*','/'ops
- the operands of the operator
java.lang.Exception
- is something goes wrongMethod Detail |
---|
public double eval(java.util.Map symbols) throws java.lang.Exception
symbols
- a map associating a Double value to each variable name
java.lang.Exception
- if a symbol, function or node type is unknown
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |