de.dante.extex.scanner.type.token
Class AbstractToken

java.lang.Object
  extended byde.dante.extex.scanner.type.token.AbstractToken
All Implemented Interfaces:
java.io.Serializable, Token
Direct Known Subclasses:
ActiveCharacterToken, ControlSequenceToken, CrToken, LeftBraceToken, LetterToken, MacroParamToken, MathShiftToken, OtherToken, RightBraceToken, SpaceToken, SubMarkToken, SupMarkToken, TabMarkToken

public abstract class AbstractToken
extends java.lang.Object
implements Token, java.io.Serializable

This is the abstract base class for all Tokens.

Version:
$Revision: 1.6 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Constructor Summary
protected AbstractToken(UnicodeChar uc)
          Creates a new object for a Unicode character.
 
Method Summary
 boolean equals(Catcode cc, char c)
          Compare the current token with a pair of catcode and character value.
 boolean equals(Catcode cc, java.lang.String s)
          Compare the current token with a pair of catcode and String value.
 boolean equals(char c)
          Compare the current token with a character value.
 boolean equals(java.lang.Object t)
          Compare the current token to another token.
abstract  Catcode getCatcode()
          This is the getter for the catcode of this token.
 UnicodeChar getChar()
          Getter for the value.
protected  Localizer getLocalizer()
          Getter for localizer.
 int hashCode()
           
 boolean isa(Catcode cc)
          Check if the current token has a specified catcode.
 java.lang.String toString()
          Return the printable representation of this object.
 java.lang.String toText()
          Return the text representation of this object.
 java.lang.String toText(UnicodeChar esc)
          Return the printable representation of this token as it can be read back in.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.dante.extex.scanner.type.token.Token
toString, visit
 

Constructor Detail

AbstractToken

protected AbstractToken(UnicodeChar uc)
Creates a new object for a Unicode character.

Parameters:
uc - the value of the token
Method Detail

equals

public boolean equals(Catcode cc,
                      char c)
Description copied from interface: Token
Compare the current token with a pair of catcode and character value. This pair constitutes a virtual token. They are the same if the catcode and the value are the same.

Specified by:
equals in interface Token
Parameters:
cc - the catcode
c - the value
Returns:
true iff the tokens are equal
See Also:
Token.equals( de.dante.extex.scanner.type.Catcode, char)

equals

public boolean equals(Catcode cc,
                      java.lang.String s)
Description copied from interface: Token
Compare the current token with a pair of catcode and String value. This pair constitutes a virtual token. They are the same if the catcode and the value are the same.

Specified by:
equals in interface Token
Parameters:
cc - the catcode
s - the value
Returns:
true iff the tokens are equal
See Also:
Token.equals( de.dante.extex.scanner.type.Catcode, java.lang.String)

equals

public boolean equals(char c)
Description copied from interface: Token
Compare the current token with a character value. They are the same if the values are the same.

Specified by:
equals in interface Token
Parameters:
c - the value
Returns:
true iff the tokens are equal
See Also:
Token.equals(char)

equals

public boolean equals(java.lang.Object t)
Description copied from interface: Token
Compare the current token to another token. They are the same if the catcode and the value are the same.

Specified by:
equals in interface Token
See Also:
Object.equals(java.lang.Object)

getCatcode

public abstract Catcode getCatcode()
This is the getter for the catcode of this token.

Specified by:
getCatcode in interface Token
Returns:
the catcode
See Also:
Token.getCatcode()

getChar

public final UnicodeChar getChar()
Description copied from interface: Token
Getter for the value.

Specified by:
getChar in interface Token
Returns:
the value
See Also:
Token.getChar()

getLocalizer

protected Localizer getLocalizer()
Getter for localizer.

Returns:
the localizer.

hashCode

public int hashCode()
See Also:
Object.hashCode()

isa

public boolean isa(Catcode cc)
Description copied from interface: Token
Check if the current token has a specified catcode.

Specified by:
isa in interface Token
Parameters:
cc - the catcode to compare against
Returns:
true iff the catcodes coincide
See Also:
Token.isa( de.dante.extex.scanner.type.Catcode)

toString

public java.lang.String toString()
Return the printable representation of this object.

Returns:
the printable representation

toText

public java.lang.String toText()
Return the text representation of this object.

Specified by:
toText in interface Token
Returns:
the text representation

toText

public java.lang.String toText(UnicodeChar esc)
Description copied from interface: Token
Return the printable representation of this token as it can be read back in.

Specified by:
toText in interface Token
Parameters:
esc - the escape character
Returns:
the printable representation
See Also:
Token.toText( de.dante.util.UnicodeChar)