de.dante.extex.scanner.type.token
Interface TokenFactory

All Known Implementing Classes:
TokenFactoryImpl

public interface TokenFactory

This is the interface for the token factory. The token factory is the only instance to deliver new tokens. It is up to the implementation of the factory to create new tokens or to cache some of them and deliver the same token several times.

Version:
$Revision: 1.4 $
Author:
Gerd Neugebauer

Method Summary
 Token createToken(Catcode code, int c, java.lang.String namespace)
          Create a new Token of the appropriate kind.
 Token createToken(Catcode code, UnicodeChar c, java.lang.String namespace)
          Get an instance of a token with a given Catcode and Unicode character value.
 Token createToken(Catcode code, UnicodeChar esc, java.lang.String value, java.lang.String namespace)
          Get an instance of a token with a given Catcode and value.
 

Method Detail

createToken

public Token createToken(Catcode code,
                         UnicodeChar esc,
                         java.lang.String value,
                         java.lang.String namespace)
                  throws CatcodeException
Get an instance of a token with a given Catcode and value.

Parameters:
code - the catcode
esc - the Unicode character value of the escape character
value - the value
namespace - the name space for the token. This is relevant for ACTIVE and ESCAPE catcodes only.
Returns:
the appropriate token
Throws:
CatcodeException - in case of an error

createToken

public Token createToken(Catcode code,
                         int c,
                         java.lang.String namespace)
                  throws CatcodeException
Create a new Token of the appropriate kind. Tokens are immutable (no setters) thus the factory pattern can be applied.

Parameters:
code - the category code
c - the character value
namespace - the name space to use
Returns:
the new token
Throws:
CatcodeException - in case of an error

createToken

public Token createToken(Catcode code,
                         UnicodeChar c,
                         java.lang.String namespace)
                  throws CatcodeException
Get an instance of a token with a given Catcode and Unicode character value.

Parameters:
code - the catcode
c - the Unicode character value
namespace - the name space for the token. This is relevant for ACTIVE and ESCAPE catcodes only.
Returns:
the appropriate token
Throws:
CatcodeException - in case of an error