scanner
Class TokenEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byscanner.TokenEvent
All Implemented Interfaces:
PositionableInCharStream, java.io.Serializable
Direct Known Subclasses:
InvalidTokenEvent

public class TokenEvent
extends java.util.EventObject
implements PositionableInCharStream

This event is thrown when a new token has been detected.

See Also:
Serialized Form

Constructor Summary
TokenEvent(java.lang.Object source, Token token)
          Creates a new token event.
 
Method Summary
 int getLength()
          Returns the length of this positionable object.
 CharStreamPosition getPosition()
          Returns the start position.
 Token getToken()
          Returns the found token.
 java.lang.String toString()
          Returns a string representation of this token event.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TokenEvent

public TokenEvent(java.lang.Object source,
                  Token token)
Creates a new token event.

Parameters:
source - The source that has detected the new token.
token - The detected token.
Method Detail

getPosition

public CharStreamPosition getPosition()
Description copied from interface: PositionableInCharStream
Returns the start position.

Specified by:
getPosition in interface PositionableInCharStream
Returns:
The start position.

getLength

public int getLength()
Description copied from interface: PositionableInCharStream
Returns the length of this positionable object.

Specified by:
getLength in interface PositionableInCharStream
Returns:
The length of this positionable object.

getToken

public Token getToken()
Returns the found token.

Returns:
The found token.

toString

public java.lang.String toString()
Returns a string representation of this token event.

Returns:
A string representation of this token event.