|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.statcato.calculator.TokenScanner
public class TokenScanner
A scanner that read Tokens from a string representing a mathematical expression.
Token
Field Summary | |
---|---|
java.lang.String |
error
|
Constructor Summary | |
---|---|
TokenScanner(java.lang.String expr,
Spreadsheet spreadsheet)
Constructor. |
Method Summary | |
---|---|
int |
consumeColumn()
Consumes the column at the next scan position. |
double |
consumeConstant()
Consumes the constant at the next scan position. |
int |
consumeFunction()
Consumes the function at the next scan position. |
double |
consumeNumber()
Consumes the number at the next scan position. |
void |
consumeToken()
Consumes the current token by advancing the index to the next position. |
void |
error(java.lang.String msg)
Adds the given string to the error string. |
boolean |
expect(java.lang.String name)
|
int |
getColumn()
Attempts to parse a column label and returns the column number if successful. |
double |
getConstant()
Attempts to parse a constant name and returns the constant if successful. |
double |
getDecimal()
Returns the double value that begins with '.' at the current scan position. |
int |
getFunction()
Attempts to parse a function name and returns the function number if successful. |
int |
getInteger()
Returns the integer value at the current scan position. |
double |
getNumber()
Returns the double value at the current scan position. |
java.lang.String |
getString()
Returns the next string (delimited by single quotes) |
int |
getToken()
Returns the type of the next token. |
void |
printRemaining()
Prints the string remaining to be scanned. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.lang.String error
Constructor Detail |
---|
public TokenScanner(java.lang.String expr, Spreadsheet spreadsheet)
expr
- string of mathematical expressionMethod Detail |
---|
public void printRemaining()
public double consumeNumber()
public int consumeColumn()
public int consumeFunction()
public double consumeConstant()
public int getToken()
public void consumeToken()
public int getColumn()
public int getFunction()
public double getConstant()
public boolean expect(java.lang.String name)
public java.lang.String getString()
public double getNumber()
public int getInteger()
public double getDecimal()
public void error(java.lang.String msg)
msg
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |