|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--edu.buffalo.fs7.mathlib.Tokenizer
This class is one of the central classes for the parsing process. It analyzes a Java String object and extracts tokens from the string for which corresponding MathObject are created. The Tokenizer class is working in close connection to the Parse class, in which the identified MathObjects are further processed.
The parsing process is usually done after the preprocessing stage of the Parse class and identifies all objects in the string. It therefore is responsible for the semantics of the Mathlib parsing method.
There are two general modi, in which the Tokenizer class can be run: (a) assignments within the expression are allowed (b) assignments are not allowed.
Parse,
Mathlib| Constructor Summary | |
Tokenizer(java.lang.String str,
boolean assignmentAllowed)
creates a Tokenizer object for the given string. |
|
| Method Summary | |
java.lang.String |
getAnswerVar()
returns the name of the answer variable in case of an assignment |
java.lang.String |
getNextTokenName()
returns the name of the next token if available. |
java.lang.String |
getTokenName()
returns the name of the current token if available. |
boolean |
hasMoreTokens()
returns whether or not there are more tokens. |
MathObject |
nextToken()
returns the next token, returns null if there are no more tokens |
MathObject |
nextToken(java.lang.String errorMsg)
returns the next token and generates an error message in case there are no more tokens. |
void |
pushBack()
goes back one token. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Tokenizer(java.lang.String str,
boolean assignmentAllowed)
str - string to work onassignmentAllowed - switch whether or not assignments are allowed| Method Detail |
public java.lang.String getAnswerVar()
public java.lang.String getTokenName()
Commandpublic java.lang.String getNextTokenName()
Commandpublic boolean hasMoreTokens()
public MathObject nextToken()
public MathObject nextToken(java.lang.String errorMsg)
errorMsg - string to display if there are no more tokenspublic void pushBack()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||