tokenizer
Class Token

java.lang.Object
  extended by tokenizer.Token

public class Token
extends java.lang.Object

Version:
February 14, 2010
Author:
David Matuszek

Constructor Summary
Token(TokenType type, java.lang.String value)
          Creates a token.
 
Method Summary
 boolean equals(java.lang.Object o)
          Tests whether this Token equals the input.
 TokenType getType()
          Returns the type of this Token.
 java.lang.String getValue()
          Returns the value of this Token.
 int hashCode()
          Returns a hash code for this token.
static void includeType(boolean include)
          Specifies whether the type should be included in the result of toString().
 java.lang.String toString()
          Returns the string value of this Token, or (depending on the value of INCLUDE_TYPE_IN_PRINT_STRING), a string of the form type:value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Token

public Token(TokenType type,
             java.lang.String value)
Creates a token.

Parameters:
type - The type of this new Token.
value - The value of this new Token.
Method Detail

getType

public TokenType getType()
Returns the type of this Token.

Returns:
The type of this Token.

getValue

public java.lang.String getValue()
Returns the value of this Token.

Returns:
The value of this Token.

includeType

public static void includeType(boolean include)
Specifies whether the type should be included in the result of toString().

Parameters:
include - true if the type should be included in toString().

toString

public java.lang.String toString()
Returns the string value of this Token, or (depending on the value of INCLUDE_TYPE_IN_PRINT_STRING), a string of the form type:value.

Overrides:
toString in class java.lang.Object
Returns:
A representation of this Token.
See Also:
Object.toString()

equals

public boolean equals(java.lang.Object o)
Tests whether this Token equals the input. Two Tokens are equal if they have the same type and equal values.

Overrides:
equals in class java.lang.Object
Parameters:
o - The thing to be tested against this Token.
Returns:
true iff the argument equals this Token.
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns a hash code for this token.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this Token.
See Also:
Object.hashCode()