Methods Summary |
---|
public boolean | atEnd()Returns true, if the scanner has reached the end and a further invocation
of nextChar() would return the END_REACHED character.
return ( endReached( this.peek() ) ) ;
|
public boolean | endNotReached(char character)Returns true, if the given character does not indicate that the
end of the scanned string si reached.
return ( ! endReached( character ) ) ;
|
public boolean | endReached(char character)Returns true, if the given character indicates that the end of the
scanned string is reached.
// =========================================================================
// PUBLIC CLASS METHODS
// =========================================================================
return ( character == END_REACHED ) ;
|
public int | getPosition()Returns the current position in the string
return position ;
|
public boolean | hasNext()Returns true, if the scanner has not yet reached the end.
return ! this.atEnd() ;
|
protected int | length()
return length ;
|
public void | markPosition()Remembers the current position for later use with restorePosition()
pos_marker = position ;
|
public char | nextChar()Returns the character at the current position and increments
the position afterwards by 1.
char next = this.peek() ;
if ( endNotReached( next ) )
this.skip(1);
return next ;
|
public char | nextNoneWhitespaceChar()Returns the next character that is no whitespace and leaves the
position pointer one character after the returned one.
char next = this.nextChar() ;
while ( ( endNotReached( next ) ) && ( Character.isWhitespace(next) ) )
{
next = this.nextChar() ;
}
return next ;
|
public char | peek()Returns the character at the current position without changing
the position, that is subsequent calls to this method return always
the same character.
return ( position < length() ? buffer[position] : END_REACHED ) ;
|
public void | restorePosition()Restores the position to the value of the latest markPosition() call
this.setPosition( pos_marker ) ;
|
protected void | setPosition(int pos)
if ( ( pos >= 0 ) && ( pos <= this.length() ) )
position = pos ;
|
public void | skip(int count)Moves the position pointer count characters.
positive values move forwards, negative backwards.
The position never becomes negative !
position += count ;
if ( position < 0 )
position = 0 ;
|
public java.lang.String | toString()Returns the string the scanner was initialized with
return new String( buffer ) ;
|