ExpressionTreepublic interface Expressions
| Modifier and Type | Method | Description |
|---|---|---|
TreeNode |
buildTree(java.lang.String[] exp) |
Builds a tree to represent the expression using a String[], where each item
of the array is an element in an expression.
|
int |
evalTree() |
Evaluates the expression held in a tree in the class
|
int |
postfixEval(java.lang.String[] exp) |
Uses a stack to evaluate the expression given by exp, rather than building a tree
and evaluating the tree.
|
java.lang.String |
toInfixNotation() |
Converts the current expression into infix notation with parentheses to help show
the order of operations of infix notation
|
java.lang.String |
toPostfixNotation() |
Converts the current expression into postfix notation
|
java.lang.String |
toPrefixNotation() |
Converts the current expression into prefix notation
|
TreeNode buildTree(java.lang.String[] exp)
exp - the expression broken up into an arrayint evalTree()
java.lang.String toPrefixNotation()
java.lang.String toInfixNotation()
java.lang.String toPostfixNotation()
int postfixEval(java.lang.String[] exp)
exp - the expression to be evaluated where each item of the String[] represents
an item in the expression