com.ibm.dse.applsrv.aa
Class DummyStringParser

java.lang.Object
  |
  +--com.ibm.dse.applsrv.aa.StringParser
        |
        +--com.ibm.dse.applsrv.aa.DummyStringParser

public class DummyStringParser
extends StringParser
implements java.util.Enumeration

This is a dummy parser which processes an already parsed list of strings.


Constructor Summary
DummyStringParser(java.lang.String[] v)
          Create a dummy parser on the specified list of strings.
 
Method Summary
 int countTokens()
          Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.
 boolean hasMoreElements()
          Tests if there are more tokens available from this tokenizer's string.
 boolean hasMoreTokens()
          Tests if there are more tokens available from this tokenizer's string.
 boolean isDelimiter(char c)
          Check if the specified character is a delimiter.
 java.lang.String nextToken()
          Returns the next token from this string parser or nil if there are no more tokens.
 java.lang.String nextToken(java.lang.String delim)
          Returns the next token in this string tokenizer's string.
 java.lang.String rest()
          Returns the rest of the string.
 void rewind()
          Rewind the parser.
 boolean selectToken(int n)
          Set the read pointer before the n'th token (or EOF if the n'th token doesn't exist.
 void set(java.lang.String str)
          Reset the parse for a new string.
 void set(java.lang.String[] v)
          Reinitialize this parser on the specified list of strings.
 java.lang.String source()
          Returns the 'original' string.
 
Methods inherited from class com.ibm.dse.applsrv.aa.StringParser
nextElement, restAsIntArray, restAsIntegerArray, restAsStringArray, restAsStringArrays
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyStringParser

public DummyStringParser(java.lang.String[] v)
Create a dummy parser on the specified list of strings.
Parameters:
v - String[] - the list of strings.
Throws:
NullPointerException - - if the argument is null.
Method Detail

countTokens

public int countTokens()
Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception.
Overrides:
countTokens in class StringParser
Returns:
int - the number of tokens remaining in the string using the current delimiter set.

hasMoreElements

public boolean hasMoreElements()
Tests if there are more tokens available from this tokenizer's string.
Specified by:
hasMoreElements in interface java.util.Enumeration
Overrides:
hasMoreElements in class StringParser
Returns:
boolean - true if there are more tokens available from this tokenizer's string, false otherwise.

hasMoreTokens

public boolean hasMoreTokens()
Tests if there are more tokens available from this tokenizer's string.
Overrides:
hasMoreTokens in class StringParser
Returns:
boolean - true if there are more tokens available from this tokenizer's string, false otherwise.

isDelimiter

public boolean isDelimiter(char c)
Check if the specified character is a delimiter.
Overrides:
isDelimiter in class StringParser
Parameters:
c - char - the character to check.
Returns:
boolean - true if the character is a delimiter else false.

nextToken

public java.lang.String nextToken()
Returns the next token from this string parser or nil if there are no more tokens.
Overrides:
nextToken in class StringParser
Returns:
String - the next token from this string parser.

nextToken

public java.lang.String nextToken(java.lang.String delim)
Returns the next token in this string tokenizer's string. The new delimiter set remains the default after this call. THIS OPERATION IS NOT SUPPORTED BY DummyStringParser.
Overrides:
nextToken in class StringParser
Parameters:
delim - String - the new delimiters.
Returns:
String - the next token, after switching to the new delimiter set.
Throws:
java.lang.RuntimeException - - unconditionally.

rest

public java.lang.String rest()
Returns the rest of the string.
Overrides:
rest in class StringParser
Returns:
String - the rest of the string.

rewind

public void rewind()
Rewind the parser.
Overrides:
rewind in class StringParser

selectToken

public boolean selectToken(int n)
Set the read pointer before the n'th token (or EOF if the n'th token doesn't exist. Count from 1.
Overrides:
selectToken in class StringParser
Parameters:
n - int - the token to select (counting from 1).
Returns:
boolean - true if n > 0 and the next nextToken() will succeed.

set

public void set(java.lang.String[] v)
Reinitialize this parser on the specified list of strings.
Parameters:
v - String[] - the list of strings.
Throws:
NullPointerException - - if the argument is null.

set

public void set(java.lang.String str)
Reset the parse for a new string. The parser uses the default delimiter set, which is "\t\n\r": the space character, the tab character, the newline character, and the carriage-return character. THIS OPERATION IS NOT SUPPORTED BY DummyStringParser.
Overrides:
set in class StringParser
Parameters:
str - String - the string to be parsed.
Throws:
java.lang.RuntimeException - - unconditionally.

source

public java.lang.String source()
Returns the 'original' string.
Overrides:
source in class StringParser
Returns:
String - the 'original' string.