public class ExpressionTreeExpanded extends ExpressionTree
garethhalladay on 10/25/17ATree.Node| Constructor and Description |
|---|
ExpressionTreeExpanded(SymbolTable st)
Creates an instance of ExpressionTreeExpanded.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.lang.String> |
convert(java.util.Queue<java.lang.String> infix)
Same as the convert method from the previous assignment - but not the convert method doesn't just
check if the leaf node is an integer.
|
(package private) static int |
evaluateInContext(SymbolTable context,
java.lang.String exp)
Similar to the TestingProgram from the first part.
|
int |
evaluateRecursive(ATree.Node current)
Evaluate method from above.
|
(package private) static int |
performOperation(java.lang.String operator,
int lhs,
int rhs)
A helper method for evaluate recursive.
|
int |
valueOfExpanded(java.lang.String token)
If the token is an integer, return the integer value.
|
build, buildRecursive, evaluate, infix, infixRecursive, parse, postfix, postfixRecursive, prefix, prefixRecursivedisplay, displayRecursive, isInteger, isOperator, precedence, valueOfpublic ExpressionTreeExpanded(SymbolTable st)
st - a reference to the SymbolTablepublic java.util.List<java.lang.String> convert(java.util.Queue<java.lang.String> infix)
convert in class ExpressionTreeinfix - the inorder expressionpublic int evaluateRecursive(ATree.Node current)
evaluateRecursive in class ExpressionTreestatic int performOperation(java.lang.String operator,
int lhs,
int rhs)
operator - a valid operator for this assignmentlhs - the left hand operandrhs - the right hand operandlhs operator rhsjava.lang.UnsupportedOperationException - if the operator is not validpublic int valueOfExpanded(java.lang.String token)
token - a string representing a number or variablestatic int evaluateInContext(SymbolTable context, java.lang.String exp)
context - a reference to the symbol tableexp - the expression