provided.token
Class TokenFactory

java.lang.Object
  extended by provided.token.TokenFactory
All Implemented Interfaces:
ITokenFactory

public class TokenFactory
extends java.lang.Object
implements ITokenFactory

Concrete factory to create tokens


Field Summary
static TokenFactory Singleton
          Singleton instance of this class
 
Constructor Summary
private TokenFactory()
          private constructor needed for singleton
 
Method Summary
 Token makeToken(java.lang.String name, java.lang.String lexeme)
          Creates Tokens from the given name and lexeme.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Singleton

public static final TokenFactory Singleton
Singleton instance of this class

Constructor Detail

TokenFactory

private TokenFactory()
private constructor needed for singleton

Method Detail

makeToken

public Token makeToken(java.lang.String name,
                       java.lang.String lexeme)
Creates Tokens from the given name and lexeme. The returned tokens will call the case in their visitors corresponding to their *name*. For many tokens the name and lexeme are the same, but for some, it is not, e.g. an Quote token, where the name is "Quote", but the lexeme is the string value of the quoted text.

Specified by:
makeToken in interface ITokenFactory
Parameters:
name - The name of the token
lexeme - The lexeme value for the token
Returns:
An Token instance with the given name and lexeme which calls the named case of its visitors.