public class MathResolver extends Object
GroupingExpression
objects. To resolve an
operation simply push operator-expression pairs onto it, before calling resolve()
to retrieve the single
corresponding grouping expression object.Modifier and Type | Class and Description |
---|---|
private static class |
MathResolver.Item |
static class |
MathResolver.Type |
Modifier and Type | Field and Description |
---|---|
private List<MathResolver.Item> |
items |
Constructor and Description |
---|
MathResolver() |
Modifier and Type | Method and Description |
---|---|
private void |
pop(Stack<MathResolver.Item> stack) |
void |
push(MathResolver.Type type,
GroupingExpression exp)
Pushes the given operator-expression pair onto this math resolver.
|
GroupingExpression |
resolve()
Converts the internal list of operator-expression pairs into a corresponding combined grouping expression.
|
String |
toString() |
private final List<MathResolver.Item> items
public void push(MathResolver.Type type, GroupingExpression exp)
resolve()
to retrieve to combined grouping expression.type
- The operator that appears before the expression being pushed.exp
- The expression to push.public GroupingExpression resolve()
private void pop(Stack<MathResolver.Item> stack)
Copyright © 2018. All rights reserved.