org.translet.processor
Interface TokenIterator

All Known Implementing Classes:
TokenIteratorImpl

public interface TokenIterator

Iterator across a specified range of the tokens generated from the xpath expressions.

Version:
$Revision: 1.4 $
Author:
Karthikeyan M.

Method Summary
 TokenIterator createSnapshot()
          Creates a snapshot since the time markForSnapshot was called including all the elements that was gotten using next().
 boolean hasNext()
          Check if there is any more tokens.
 boolean hasPrevious()
          Check if previous will return valid token.
 void markForSnapshot()
          Marks the position to start recoding.
 String next()
          Returns the value of the token.
 boolean nextTokenIs(char c)
          Returns true if the next token is the char specified.
 String peekNext()
          Peeks the next token w/o incrementing cursor.
 String previous()
          Returns the previous element in the list.
 void rewind()
          Re-initializes the iterator.
 

Method Detail

hasPrevious

public boolean hasPrevious()
Check if previous will return valid token.

previous

public String previous()
Returns the previous element in the list. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)
Throws:
NoSuchElementException - - if the iteration has no previous element.

nextTokenIs

public boolean nextTokenIs(char c)
Returns true if the next token is the char specified. Doesn't increment the cursor.

peekNext

public String peekNext()
Peeks the next token w/o incrementing cursor.
Throws:
NoSuchElementException - - if the iteration has no previous element.

next

public String next()
Returns the value of the token.

hasNext

public boolean hasNext()
Check if there is any more tokens.

markForSnapshot

public void markForSnapshot()
Marks the position to start recoding. Illegal to call markForSnapshot twice before calling createSnapshot(). This means, it is not possible to create overlapping snapshots. The tokens would include that would have been returned by next() (Optional operation).

createSnapshot

public TokenIterator createSnapshot()
Creates a snapshot since the time markForSnapshot was called including all the elements that was gotten using next(). Resets the mark.

rewind

public void rewind()
Re-initializes the iterator. Will also reset any snapshot marks.