com.waveset.util
Class ParseStringCharacterIterator

java.lang.Object
  extended bycom.waveset.util.ParseStringCharacterIterator
All Implemented Interfaces:
java.text.CharacterIterator, java.lang.Cloneable

public class ParseStringCharacterIterator
extends java.lang.Object
implements java.text.CharacterIterator

Adds some additional functionality to the StringCharacterIterator. Also provides a more expected implementation of next() such that when you call it the first time, you get the first character instead of the second character.


Field Summary
protected  java.text.CharacterIterator _cIter
           
protected  java.lang.String _eol
           
static java.lang.String code_id
           
 
Fields inherited from interface java.text.CharacterIterator
DONE
 
Constructor Summary
ParseStringCharacterIterator(java.lang.String text)
           
ParseStringCharacterIterator(java.lang.String text, int pos)
           
ParseStringCharacterIterator(java.lang.String text, int begin, int end, int pos)
           
 
Method Summary
 void bypass(int length)
           
 void bypass(java.lang.String s)
           
 boolean bypassOpt(java.lang.String s)
           
 void bypassWhitespace()
           
 java.lang.Object clone()
           
 char current()
           
 char first()
           
 java.lang.String get(int length)
           
 java.lang.String get(java.lang.String termStr)
          Return the string starting with the current index and ending with the character just before any of the characters in "termStr"
 java.lang.String get(java.lang.String termStr, int length)
          Return the string starting with the current index and ending with the character just before any of the characters in "termStr"
 int getBeginIndex()
           
 int getEndIndex()
           
 int getIndex()
           
 int getPreviousEolIndex()
           
 java.lang.String getToEol()
           
 java.lang.String getToEol(int length)
          Get characters to the end of line or a max of 'length' characters, whichever comes first.
 java.lang.String getToToken(java.lang.String termToken)
          Return the string starting with the current index and ending with the character just before the given termination token.
 boolean hasNext()
           
 char last()
           
 char next()
           
 char previous()
           
 char setIndex(int position)
           
 boolean skipPast(char charToPass)
           
 boolean skipPast(java.lang.String stringToPass)
           
 boolean skipPast(java.lang.String stringToPass, java.lang.String termToken)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

_cIter

protected java.text.CharacterIterator _cIter

_eol

protected java.lang.String _eol
Constructor Detail

ParseStringCharacterIterator

public ParseStringCharacterIterator(java.lang.String text)

ParseStringCharacterIterator

public ParseStringCharacterIterator(java.lang.String text,
                                    int pos)

ParseStringCharacterIterator

public ParseStringCharacterIterator(java.lang.String text,
                                    int begin,
                                    int end,
                                    int pos)
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface java.text.CharacterIterator

current

public char current()
Specified by:
current in interface java.text.CharacterIterator

first

public char first()
Specified by:
first in interface java.text.CharacterIterator

getBeginIndex

public int getBeginIndex()
Specified by:
getBeginIndex in interface java.text.CharacterIterator

getEndIndex

public int getEndIndex()
Specified by:
getEndIndex in interface java.text.CharacterIterator

getIndex

public int getIndex()
Specified by:
getIndex in interface java.text.CharacterIterator

last

public char last()
Specified by:
last in interface java.text.CharacterIterator

previous

public char previous()
Specified by:
previous in interface java.text.CharacterIterator

setIndex

public char setIndex(int position)
Specified by:
setIndex in interface java.text.CharacterIterator

next

public char next()
Specified by:
next in interface java.text.CharacterIterator

skipPast

public boolean skipPast(char charToPass)

skipPast

public boolean skipPast(java.lang.String stringToPass)

skipPast

public boolean skipPast(java.lang.String stringToPass,
                        java.lang.String termToken)

bypass

public void bypass(int length)
            throws WavesetException
Throws:
WavesetException

bypass

public void bypass(java.lang.String s)
            throws WavesetException
Throws:
WavesetException

bypassOpt

public boolean bypassOpt(java.lang.String s)

bypassWhitespace

public void bypassWhitespace()
                      throws WavesetException
Throws:
WavesetException

hasNext

public boolean hasNext()

getToEol

public java.lang.String getToEol()
                          throws WavesetException
Throws:
WavesetException

getToEol

public java.lang.String getToEol(int length)
                          throws WavesetException
Get characters to the end of line or a max of 'length' characters, whichever comes first. If there are exactly 'length' characters before the end of line, go ahead and skip past the end of line.

Throws:
WavesetException

get

public java.lang.String get(int length)
                     throws WavesetException
Throws:
WavesetException

get

public java.lang.String get(java.lang.String termStr)
                     throws WavesetException
Return the string starting with the current index and ending with the character just before any of the characters in "termStr"

Throws:
WavesetException

get

public java.lang.String get(java.lang.String termStr,
                            int length)
                     throws WavesetException
Return the string starting with the current index and ending with the character just before any of the characters in "termStr"

Throws:
WavesetException

getToToken

public java.lang.String getToToken(java.lang.String termToken)
                            throws WavesetException
Return the string starting with the current index and ending with the character just before the given termination token. Index will be positioned after the token when done. (i.e. termination token will be consumed).

Throws:
WavesetException

getPreviousEolIndex

public int getPreviousEolIndex()