pobs.scanner
Class PStringScanner

java.lang.Object
  extended bypobs.scanner.PStringScanner
All Implemented Interfaces:
PScanner

public class PStringScanner
extends java.lang.Object
implements PScanner

Basic iterator for strings. Does nothing but pass allong the iterator interface to the encapsuled String.

Author:
Martijn W. van der Lee

Constructor Summary
PStringScanner(java.lang.String string)
          Sole constructor.
 
Method Summary
 char charAt(long index)
          Returns the character at the specified location.
 long length()
          Gives the length of this scanners' content.
 java.lang.String substring(long beginIndex, long endIndex)
          Returns the part of the input from the beginning upto the ending index locations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PStringScanner

public PStringScanner(java.lang.String string)
Sole constructor.

Parameters:
string - the source string for this iterator
Method Detail

charAt

public char charAt(long index)
            throws java.lang.IndexOutOfBoundsException
Description copied from interface: PScanner
Returns the character at the specified location.

Specified by:
charAt in interface PScanner
Parameters:
index - position of the character to return
Returns:
character at the specified index
Throws:
java.lang.IndexOutOfBoundsException - when the specified index is either less than zero or equal or more than the length

length

public long length()
Description copied from interface: PScanner
Gives the length of this scanners' content. That is; the last position which can be indexed.

Specified by:
length in interface PScanner
Returns:
the length of this iterator.

substring

public java.lang.String substring(long beginIndex,
                                  long endIndex)
Description copied from interface: PScanner
Returns the part of the input from the beginning upto the ending index locations.

Specified by:
substring in interface PScanner
Parameters:
beginIndex - starting offset from which to extract the substring
endIndex - ending offset at which the substring ends
Returns:
the substring
See Also:
String