org.basex.util
Class TokenParser

java.lang.Object
  extended by org.basex.util.TokenParser

public class TokenParser
extends java.lang.Object

This class can be used to iterate through all codepoints of a token.

Author:
BaseX Team 2005-13, BSD License, Christian Gruen

Field Summary
protected  byte[] token
          Token to be parsed.
 
Constructor Summary
TokenParser(byte[] tok)
          Constructor.
 
Method Summary
 boolean consume(int ch)
          Tries to consume the specified codepoint.
 boolean more()
          Checks if the parser will return more codepoints.
 int next()
          Returns the current codepoint and advances the cursor.
 void reset()
          Resets the cursor position.
 IntList toList()
          Returns a list with all codepoints.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

token

protected final byte[] token
Token to be parsed.

Constructor Detail

TokenParser

public TokenParser(byte[] tok)
Constructor.

Parameters:
tok - token
Method Detail

reset

public void reset()
Resets the cursor position.


more

public boolean more()
Checks if the parser will return more codepoints.

Returns:
result of check

next

public int next()
Returns the current codepoint and advances the cursor.

Returns:
current codepoint, or -1

consume

public boolean consume(int ch)
Tries to consume the specified codepoint.

Parameters:
ch - codepoint to be consumed
Returns:
indicates if the codepoint was consumed

toList

public final IntList toList()
Returns a list with all codepoints.

Returns:
array

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object