|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--freegraph.ExpressionItem
Instances of ExpressionItem are used internally by the package. The base class ExpressionItem's getAction() is used polymorphically when converting from infix to RPN. The method returns an integer corresponding to the operation code to perform when converting from infix to RPN. Each implementation is a simple class to hold an operator, number, variable, or parenthesis.
Although the base class is used polymorphically by ExpressionStack for conversion to RPN, the various ExpressionItems are downcast when evaluated by ExpressionEvaluator.
This class is used internally by the package. It was exposed as public so that classes outside of the package can use ExpressionStack, and so Applets such as ExpressionParsingApplet could be made outside the package.
The algorithm used is from: Tanenbaum, Andrew S. 1990. Structured Computer Organization, 3rd ed., New Jersey: Prentice Hall. (pp. 268-272)
ExpressionStack,
ExpressionEvaluator| Nested Class Summary | |
static class |
ExpressionItem.BiOperator
A BiOperator is an ExpressionItem used to hold a all binary operators. |
static class |
ExpressionItem.Number
NumberExpressionItem is an ExpressionItem to represent a literal Number. |
static class |
ExpressionItem.Parenthesis
A Parenthesis is an ExpressionItem used to hold a single parenthesis. |
static class |
ExpressionItem.UnOperator
A UnOperator is an ExpressionItem used to hold a all unary operators. |
static class |
ExpressionItem.Variable
A VariableExpressionItem is an ExpressionItem used to hold a single character variable. |
| Constructor Summary | |
ExpressionItem()
|
|
| Method Summary | |
abstract int |
getAction(ExpressionItem exprItem)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ExpressionItem()
| Method Detail |
public abstract int getAction(ExpressionItem exprItem)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||