jwo.utils.expression
Class Tokenizer

java.lang.Object
  |
  +--jwo.utils.expression.Tokenizer

public class Tokenizer
extends Object

A tokenizer that uses regular expressions to parse text. Modified from original code described at www.devx.com/premier/mgznarch/javapro/2001/05may01/ps0105/ps0105.asp.

Version:
1.4, 15th February, 2001, modified 10th April, 2002.
Author:
Daniel Savarese, modified by Jo Wood.

Field Summary
static String DEFAULT_SEPARATOR
           
 
Constructor Summary
Tokenizer()
           
Tokenizer(String input)
           
 
Method Summary
 void addToken(String lexeme, Object token)
           
 Token nextToken()
          Returns the next token in the input.
 void reset()
           
 void setInput(String input)
           
 void setSeparator(String pattern)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final String DEFAULT_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

Tokenizer

public Tokenizer()

Tokenizer

public Tokenizer(String input)
Method Detail

setInput

public void setInput(String input)

setSeparator

public void setSeparator(String pattern)
                  throws org.apache.oro.text.regex.MalformedPatternException
org.apache.oro.text.regex.MalformedPatternException

addToken

public void addToken(String lexeme,
                     Object token)
              throws org.apache.oro.text.regex.MalformedPatternException
org.apache.oro.text.regex.MalformedPatternException

reset

public void reset()

nextToken

public Token nextToken()
                throws TokenNotFoundException
Returns the next token in the input. If at end of input returns null. If no token is found, throws an exception.

TokenNotFoundException