public class AttributeExpression extends Object implements 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(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.
|
String |
getPostFixExpression()
Return the postfix expression
|
String |
getRevision()
Returns the revision string.
|
String |
toString() |
public void convertInfixToPostfix(String infixExp) throws Exception
infixExp
- the infix expression to convertException
- if something goes wrong during the conversionpublic double evaluateExpression(Instance instance) throws Exception
instance
- the Instance containing values to apply
the expression toException
- if something goes wrongpublic void evaluateExpression(double[] vals) throws Exception
vals
- the values to apply the expression toException
- if something goes wrongpublic String getPostFixExpression()
public String getRevision()
getRevision
in interface RevisionHandler
Copyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.