jET
1.0beta1


prv.doman.util
Class Token

java.lang.Object
  |
  +--prv.doman.util.Token
Direct Known Subclasses:
NumberToken

public class Token
extends java.lang.Object

The Token class defines a token used by stream tokenizer. Token contains a word and its type (integer value).

See Also:
Tokenizer

Field Summary
static int TOKEN_EOF
          Token type when a token is end-of-file.
static int TOKEN_EOL
          Token type when a token is end-of-line.
static int TOKEN_NUMBER
          Token type when a token is a number.
static int TOKEN_WORD
          Token type when a token is regular word.
 
Constructor Summary
Token()
           
 
Method Summary
 int getColumn()
          Gets an offset from beginning of line to the first character of the token.
 int getLine()
          Gets the line of source where the token resides.
 int getType()
          Gets type of this token.
 java.lang.String getWord()
          Gets a token's word.
 void setColumn(int offset)
          Sets an offset for this token from beginning of line.
 void setLine(int line)
          Sets the line number for this token.
 void setType(int type)
          Sets the type of token.
 void setWord(java.lang.String word)
          Sets a word tothe token.
 java.lang.String toString()
          Gets string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOKEN_EOL

public static final int TOKEN_EOL
Token type when a token is end-of-line.

See Also:
Constant Field Values

TOKEN_WORD

public static final int TOKEN_WORD
Token type when a token is regular word.

See Also:
Constant Field Values

TOKEN_NUMBER

public static final int TOKEN_NUMBER
Token type when a token is a number.

See Also:
Constant Field Values

TOKEN_EOF

public static final int TOKEN_EOF
Token type when a token is end-of-file.

See Also:
Constant Field Values
Constructor Detail

Token

public Token()
Method Detail

getWord

public java.lang.String getWord()
Gets a token's word. The word it is that what was read by tokenizer.

Returns:
The word.

setWord

public void setWord(java.lang.String word)
Sets a word tothe token. param word A word.


getType

public int getType()
Gets type of this token.

Returns:
Type of the token.

setType

public void setType(int type)
Sets the type of token.

Parameters:
type - Type of the token.

toString

public java.lang.String toString()
Gets string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation.

getLine

public int getLine()
Gets the line of source where the token resides.


setLine

public void setLine(int line)
Sets the line number for this token.

Parameters:
line - Line number.

getColumn

public int getColumn()
Gets an offset from beginning of line to the first character of the token.

Returns:
Offset of token within a line.

setColumn

public void setColumn(int offset)
Sets an offset for this token from beginning of line.

Parameters:
offset - Offset.

jET
1.0beta1