Class Token
java.lang.Object
org.openoffice.da.comp.w2lcommon.tex.tokenizer.Token
- All Implemented Interfaces:
Cloneable
This class represent a token in TeX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddChar(char c) Append a character to the character content of this tokenprotected voidDelete the character content of this tokenclone()chargetChar()Get the first character in this tokenGet the character content of this token as a stringgetType()Get theTokenTypeof this tokenbooleanTest wether this token is a character token of the given type (that is, a single character with a token type that is neitherCOMMAND_SEQUENCEnorENDINPUT)booleanTest wether this token is aCOMMAND_SEQUENCEtoken with a given nameprotected voidSet this token as a character token with a specificTokenTypeprotected voidsetChar(char c) Set the character content of this token to a single character (the type of the token is not changed)protected voidSet the type of this token to a specificTokenType(the character content is not changed)toString()
-
Constructor Details
-
Token
public Token()Construct a newToken, initialized as aTokenTYPE.ENDINPUT-token
-
-
Method Details
-
setType
Set the type of this token to a specificTokenType(the character content is not changed)- Parameters:
type- the newTokenType
-
setChar
protected void setChar(char c) Set the character content of this token to a single character (the type of the token is not changed)- Parameters:
c- the character
-
set
Set this token as a character token with a specificTokenType- Parameters:
c- the charactertype- theTokenTypeto use
-
clearChars
protected void clearChars()Delete the character content of this token -
addChar
protected void addChar(char c) Append a character to the character content of this token- Parameters:
c- the character to be appended
-
is
Test wether this token is a character token of the given type (that is, a single character with a token type that is neitherCOMMAND_SEQUENCEnorENDINPUT)- Parameters:
c- the character to testtype- theTokenTypeto test- Returns:
- true if the test was successful
-
isCS
Test wether this token is aCOMMAND_SEQUENCEtoken with a given name- Parameters:
sName- the name of the command sequence- Returns:
- true if the test was successful
-
getType
Get theTokenTypeof this token- Returns:
- the type
-
getChar
public char getChar()Get the first character in this token- Returns:
- the character or U+FFFF is no characters exist
-
getString
Get the character content of this token as a string- Returns:
- the character content
-
toString
-
clone
-