net.sf.jett.parser
Class FormulaScanner

java.lang.Object
  extended by net.sf.jett.parser.FormulaScanner

public class FormulaScanner
extends java.lang.Object

A FormulaScanner scans formula text and returns tokens.

Author:
Randy Gettman

Nested Class Summary
static class FormulaScanner.Token
          Enumeration for the different types of Tokens in Formulas.
 
Constructor Summary
FormulaScanner()
          Construct a FormulaScanner object, with empty input.
FormulaScanner(java.lang.String formulaText)
          Construct a FormulaScanner object, with the given input.
 
Method Summary
 java.lang.String getCurrLexeme()
          Returns the current lexeme after a call to getNextToken.
 FormulaScanner.Token getNextToken()
          Returns the Token.
 void reset()
          Resets the scanner to the beginning of the formula text.
 void setFormulaText(java.lang.String formulaText)
          Give the FormulaScanner another formula text to scan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormulaScanner

public FormulaScanner()
Construct a FormulaScanner object, with empty input.


FormulaScanner

public FormulaScanner(java.lang.String formulaText)
Construct a FormulaScanner object, with the given input.

Parameters:
formulaText - The formula text to scan.
Method Detail

getNextToken

public FormulaScanner.Token getNextToken()
Returns the Token. After this call completes, the current lexeme is available via a call to getCurrLexeme. Starts looking at the current offset, and once the token is found, then the offset is advanced to the start of the next token.

Returns:
A Token.
See Also:
getCurrLexeme()

getCurrLexeme

public java.lang.String getCurrLexeme()
Returns the current lexeme after a call to getNextToken.

Returns:
The current lexeme, or null if getNextToken hasn't been called yet after a reset.
See Also:
getNextToken(), reset()

reset

public void reset()
Resets the scanner to the beginning of the formula text.


setFormulaText

public void setFormulaText(java.lang.String formulaText)
Give the FormulaScanner another formula text to scan. Resets to the beginning of the string.

Parameters:
formulaText - The formula text to scan.


Copyright © 2012-2013 Jett Team. All Rights Reserved.