public class AttributeExpression extends java.lang.Object implements java.io.Serializable, RevisionHandler
Example expression: a1^2*a5/log(a7*4.0)Supported opperators: +, -, *, /, ^, log, abs, cos, exp, sqrt, floor, ceil, rint, tan, sin, (, ).
Constructor and Description |
---|
AttributeExpression() |
Modifier and Type | Method and Description |
---|---|
void |
convertInfixToPostfix(java.lang.String infixExp)
Converts a string containing a mathematical expression in infix form
to postfix form.
|
void |
evaluateExpression(double[] vals)
Evaluate the expression using the supplied array of attribute values.
|
double |
evaluateExpression(Instance instance)
Evaluate the expression using the supplied Instance.
|
java.lang.String |
getPostFixExpression()
Return the postfix expression
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.lang.String |
toString() |
public void convertInfixToPostfix(java.lang.String infixExp) throws java.lang.Exception
infixExp
- the infix expression to convertjava.lang.Exception
- if something goes wrong during the conversionpublic double evaluateExpression(Instance instance) throws java.lang.Exception
instance
- the Instance containing values to apply
the expression tojava.lang.Exception
- if something goes wrongpublic void evaluateExpression(double[] vals) throws java.lang.Exception
vals
- the values to apply the expression tojava.lang.Exception
- if something goes wrongpublic java.lang.String getPostFixExpression()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler