|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.scijava.sjep.ExpressionParser
public class ExpressionParser
A parser for mathematical expressions, using Dijkstra's famous shunting-yard algorithm.
It is important to note that this parser does not attempt to evaluate the expression in any way; rather, it only provides the parsed tree according to the desired operators.
| Constructor Summary | |
|---|---|
ExpressionParser()
Creates an expression parser with the default set of operators. |
|
ExpressionParser(Collection<? extends Operator> operators)
Creates an expression parser with the given set of operators. |
|
| Method Summary | |
|---|---|
LinkedList<Object> |
parsePostfix(String expression)
Parses the given mathematical expression into a queue in Reverse Polish notation (i.e., postfix notation). |
SyntaxTree |
parseTree(String expression)
Parses the given mathematical expression into a syntax tree. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExpressionParser()
public ExpressionParser(Collection<? extends Operator> operators)
operators - The collection of operators available to expressions.| Method Detail |
|---|
public SyntaxTree parseTree(String expression)
expression - The mathematical expression to parse.
IllegalArgumentException - if the syntax of the expression is
incorrect.public LinkedList<Object> parsePostfix(String expression)
expression - The mathematical expression to parse.
IllegalArgumentException - if the syntax of the expression is
incorrect.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||