genopt.io
Class Token

java.lang.Object
  extended by genopt.io.Token

public class Token
extends java.lang.Object

String tokenizer for file input.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Field Summary
static int ALL
          constant to indicate that all values must be found
private static java.lang.String LS
           
protected static int MAXERROR
          maximal number of error in InputFormatException before search will be stopped
static int PART
          constant to indicate that not all values must be found
protected static char QUOTECHAR
          quote character
 
Constructor Summary
Token()
           
 
Method Summary
private static java.lang.Double _getDoubleValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String fn)
          gets a single Double value from the current position in the stream.
private static java.lang.Integer _getIntegerValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String fn)
          gets a single Integer value from the current position in the stream.
private static java.lang.String _getStringValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String fn)
          gets a single String from the current position in the stream.
private static void _getValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String[] sk, java.lang.Object[] sv, InputFormatException e, java.lang.String type, java.lang.String fn, int flag)
          gets various keyword values from the current position in the stream.
private static java.lang.Object _getValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String type, java.lang.String fn)
          gets a single Object from the current position in the stream.
static void checkAdmissableValue(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String receivedValue, java.lang.String admissibleValue, java.lang.String fileName)
          writes an error message into the InputFormatException if a variable was not set
static void checkAdmissableValue(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String keyWord, java.lang.String receivedValue, java.lang.String admissibleValue, java.lang.String fileName)
          writes an error message into the InputFormatException if a variable was not set
static void checkVariableSetting(java.io.StreamTokenizer st, InputFormatException e, java.lang.String[] variableName, java.lang.String[] variableValue, java.lang.String fileName)
          checks if all values of val are set.
static void checkVariableSetting(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String variableValue, java.lang.String fileName)
          checks if the value of val is set.
static void checkVariableSetting(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String keyWord, java.lang.String variableValue, java.lang.String fileName)
          checks if the value of val is set.
static void checkVariableSettingEmpty(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String variableValue, java.lang.String fileName)
          checks if the value of val is empty.
static void checkVariableSettingEmpty(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String keyWord, java.lang.String variableValue, java.lang.String fileName)
          checks if the value of val is empty.
static void getBooleanValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String[] sk, java.lang.Boolean[] sv, InputFormatException e, java.lang.String fn, int flag)
          gets various keyword values from the current position in the stream.
static boolean getBooleanValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String keyWord, InputFormatException e, java.lang.String fn)
          gets a single keyword value from the current position in the stream.
static void getDoubleValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String[] sk, java.lang.Double[] sv, InputFormatException e, java.lang.String fn, int flag)
          gets various keyword values from the current position in the stream.
static double getDoubleValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String keyWord, InputFormatException e, java.lang.String fn)
          gets a single keyword value from the current position in the stream.
static void getIntegerValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String[] sk, java.lang.Integer[] sv, InputFormatException e, java.lang.String fn, int flag)
          gets various keyword values from the current position in the stream.
static int getIntegerValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String keyWord, InputFormatException e, java.lang.String fn)
          gets a single keyword value from the current position in the stream.
static void getSectionStart(java.io.StreamTokenizer st, java.lang.String keyWord, InputFormatException e, java.lang.String fn)
          gets the start of a section from the current position in the stream.
static void getStringValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String[] sk, java.lang.String[] sv, InputFormatException e, java.lang.String fn, int flag)
          gets various keyword values from the current position in the stream.
static java.lang.String getStringValue(java.io.StreamTokenizer st, char firstDelimiter, char secondDelimiter, java.lang.String keyWord, InputFormatException e, java.lang.String fn)
          gets a single keyword value from the current position in the stream.
static boolean isEndOfStream(java.io.StreamTokenizer st, InputFormatException e, java.lang.String fn)
          checks whether we are at the end of the Stream
static boolean isNextToken(java.io.StreamTokenizer st, java.lang.String keyWord)
          checks whether the next Token is equal to the passed String.
private static void moveToEOL(java.io.StreamTokenizer st)
          moves the pointer in the StreamTokenizer beyond the next end-of-line
static void moveToSectionEnd(java.io.StreamTokenizer st, InputFormatException e, java.lang.String fn)
          moves the pointer in the StreamTokenizer beyond the next '}' sign
static void setError(java.io.StreamTokenizer st, InputFormatException e, java.lang.String errorMessage, java.lang.String fileName)
          sets a specified error message into the InputFormatException with the current line number and file name
static void setErrorWrongToken(java.io.StreamTokenizer st, java.lang.String expectedString, InputFormatException e, java.lang.String fn)
          gets a single Object from the current position in the stream.
private static void setWordChars(java.io.StreamTokenizer st)
           
static void skipJavaComments(java.io.StreamTokenizer st)
          skips the pointer of the StreamTokenizer beyond the next /*..
static void skipSlashSlashComments(java.io.StreamTokenizer st)
          skips the pointer of the StreamTokenizer beyond the next //..
static void skipSlashStarComments(java.io.StreamTokenizer st)
          skips the pointer of the StreamTokenizer beyond the next /*..
static void spoolTo(java.io.StreamTokenizer st, java.lang.String keyWord, InputFormatException e, java.lang.String fn)
          spools the pointer in the StreamTokenizer in front of a String.
private static java.lang.String stringNotFound(java.io.StreamTokenizer st, java.lang.String fileName)
          returns an error message if a String was not found
static void variableNotEmpty(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String fileName)
          writes an error message into the InputFormatException if a variable was not empty
static void variableNotEmpty(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String keyWord, java.lang.String fileName)
          writes an error message into the InputFormatException if a variable was not empty
static void variableNotSet(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String fileName)
          writes an error message into the InputFormatException if a variable was not set
static void variableNotSet(java.io.StreamTokenizer st, InputFormatException e, java.lang.String variableName, java.lang.String keyWord, java.lang.String fileName)
          writes an error message into the InputFormatException if a variable was not set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final int ALL
constant to indicate that all values must be found

See Also:
Constant Field Values

PART

public static final int PART
constant to indicate that not all values must be found

See Also:
Constant Field Values

QUOTECHAR

protected static final char QUOTECHAR
quote character

See Also:
Constant Field Values

MAXERROR

protected static final int MAXERROR
maximal number of error in InputFormatException before search will be stopped

See Also:
Constant Field Values

LS

private static final java.lang.String LS
Constructor Detail

Token

public Token()
Method Detail

isNextToken

public static boolean isNextToken(java.io.StreamTokenizer st,
                                  java.lang.String keyWord)
                           throws java.io.IOException
checks whether the next Token is equal to the passed String.
Note: after this method, the StreamTokenizer is pushed back

Parameters:
st - Reference to StreamTokenizer
keyWord - the keyword that has to be searched for
Returns:
true if the next Token equals the value of keyWord, false otherwise
Throws:
java.io.IOException

setErrorWrongToken

public static void setErrorWrongToken(java.io.StreamTokenizer st,
                                      java.lang.String expectedString,
                                      InputFormatException e,
                                      java.lang.String fn)
gets a single Object from the current position in the stream.

Parameters:
st - Reference to StreamTokenizer
expectedString - String representation of Token that has been expected but not received
e - reference to InputFormatException. Error message is written into this Object
fn - name of file (for error report only) or null pointer

_getValue

private static java.lang.Object _getValue(java.io.StreamTokenizer st,
                                          char firstDelimiter,
                                          char secondDelimiter,
                                          java.lang.String type,
                                          java.lang.String fn)
                                   throws java.io.IOException,
                                          InputFormatException
gets a single Object from the current position in the stream.

Parameters:
st - Reference to StreamTokenizer
firstDelimiter - first delimiter of the searched object
secondDelimiter - second delimiter of the searched object
type - Type specification of the object (either String, Double or Integer
fn - name of file (for error report only) or null pointer
Returns:
the object between firstDelimiter and secondDelimiter
Throws:
java.io.IOException
InputFormatException - if the input is mal formatted

getIntegerValue

public static int getIntegerValue(java.io.StreamTokenizer st,
                                  char firstDelimiter,
                                  char secondDelimiter,
                                  java.lang.String keyWord,
                                  InputFormatException e,
                                  java.lang.String fn)
                           throws java.io.IOException
gets a single keyword value from the current position in the stream.
The value must be enclosed between firstDelimiter and secondDelimiter

Parameters:
st - Reference to StreamTokenizer
firstDelimiter - first delimiter of the searched object
secondDelimiter - second delimiter of the searched object
keyWord - the keyword that has to be searched for
e - reference to InputFormatException. Error messages are written into this Object
fn - name of file (for error report only) or null pointer
Returns:
the String between firstDelimiter and secondDelimiter
Throws:
java.io.IOException

getDoubleValue

public static double getDoubleValue(java.io.StreamTokenizer st,
                                    char firstDelimiter,
                                    char secondDelimiter,
                                    java.lang.String keyWord,
                                    InputFormatException e,
                                    java.lang.String fn)
                             throws java.io.IOException
gets a single keyword value from the current position in the stream.
The value must be enclosed between firstDelimiter and secondDelimiter

Parameters:
st - Reference to StreamTokenizer
firstDelimiter - first delimiter of the searched object
secondDelimiter - second delimiter of the searched object
keyWord - the keyword that has to be searched for
e - reference to InputFormatException. Error messages are written into this Object
fn - name of file (for error report only) or null pointer
Returns:
the String between firstDelimiter and secondDelimiter
Throws:
java.io.IOException

getBooleanValue

public static boolean getBooleanValue(java.io.StreamTokenizer st,
                                      char firstDelimiter,
                                      char secondDelimiter,
                                      java.lang.String keyWord,
                                      InputFormatException e,
                                      java.lang.String fn)
                               throws java.io.IOException
gets a single keyword value from the current position in the stream.
The value must be enclosed between firstDelimiter and secondDelimiter

Parameters:
st - Reference to StreamTokenizer
firstDelimiter - first delimiter of the searched object
secondDelimiter - second delimiter of the searched object
keyWord - the keyword that has to be searched for
e - reference to InputFormatException. Error messages are written into this Object
fn - name of file (for error report only) or null pointer
Returns:
the boolean value between firstDelimiter and secondDelimiter
Throws:
java.io.IOException

getStringValue

public static java.lang.String getStringValue(java.io.StreamTokenizer st,
                                              char firstDelimiter,
                                              char secondDelimiter,
                                              java.lang.String keyWord,
                                              InputFormatException e,
                                              java.lang.String fn)
                                       throws java.io.IOException
gets a single keyword value from the current position in the stream.
The value must be enclosed between firstDelimiter and secondDelimiter

Parameters:
st - Reference to StreamTokenizer
firstDelimiter - first delimiter of the searched object
secondDelimiter - second delimiter of the searched object
keyWord - the keyword that has to be searched for
e - reference to InputFormatException. Error messages are written into this Object
fn - name of file (for error report only) or null pointer
Returns:
the String between firstDelimiter and secondDelimiter
Throws:
java.io.IOException

_getStringValue

private static java.lang.String _getStringValue(java.io.StreamTokenizer st,
                                                char firstDelimiter,
                                                char secondDelimiter,
                                                java.lang.String fn)
                                         throws java.io.IOException,
                                                InputFormatException
gets a single String from the current position in the stream.
The String must be enclosed between firstDelimiter and secondDelimiter

Parameters:
st - Reference to StreamTokenizer
firstDelimiter - first delimiter of the searched object
secondDelimiter - second delimiter of the searched object
fn - name of file (for error report only) or null pointer
Returns:
the String between firstDelimiter and secondDelimiter
Throws:
java.io.IOException
InputFormatException - if the input is mal formatted

spoolTo

public static void spoolTo(java.io.StreamTokenizer st,
                           java.lang.String keyWord,
                           InputFormatException e,
                           java.lang.String fn)
                    throws java.io.IOException
spools the pointer in the StreamTokenizer in front of a String.
The StreamTokenizer is read until either the keyWord is read or until end-of-file occurs.
The pointer in the StreamTokenizer is moved in in front of the keyWord.
If the keyWord is not found, an error message is written into the InputFormatException

Parameters:
st - Reference to StreamTokenizer
keyWord - the keyword to be found
e - reference to InputFormatException. Error messages are written into this Object
fn - name of file (for error report only) or null pointer
Throws:
java.io.IOException

getSectionStart

public static void getSectionStart(java.io.StreamTokenizer st,
                                   java.lang.String keyWord,
                                   InputFormatException e,
                                   java.lang.String fn)
                            throws java.io.IOException
gets the start of a section from the current position in the stream.
The StreamTokenizer is read until either the section keyword is read or until end-of-file occurs.
The pointer in the StreamTokenizer is moved beyond the section start character ('{')

Parameters:
st - Reference to StreamTokenizer
keyWord - the keyword of the section
e - reference to InputFormatException. Error messages are written into this Object
fn - name of file (for error report only) or null pointer
Throws:
java.io.IOException

getDoubleValue

public static void getDoubleValue(java.io.StreamTokenizer st,
                                  char firstDelimiter,
                                  char secondDelimiter,
                                  java.lang.String[] sk,
                                  java.lang.Double[] sv,
                                  InputFormatException e,
                                  java.lang.String fn,
                                  int flag)
                           throws java.io.IOException
gets various keyword values from the current position in the stream.
The value must be enclosed between firstDelimiter and secondDelimiter
  • The StreamTokenizer is read until either all keywords are read, the end of a section occurs or until end-of-file occurs.
  • All found keywords are written into sk.
  • Multiple occurences of a keyword leads to an error report whereas the last occured value is written into sk.
  • Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    sk - array with all keywords.
    sv - array where all found values of the keyword will be written in (sk and sv must have the same length)
    e - reference to InputFormatException. Error messages are written into this Object
    fn - name of file (for error report only) or null pointer
    flag - flag whether necessarily all values must be set or not.
    (If all values must be set, pass the constant Token.ALL, otherwise pass Token.PART)
    Throws:
    java.io.IOException

    getBooleanValue

    public static void getBooleanValue(java.io.StreamTokenizer st,
                                       char firstDelimiter,
                                       char secondDelimiter,
                                       java.lang.String[] sk,
                                       java.lang.Boolean[] sv,
                                       InputFormatException e,
                                       java.lang.String fn,
                                       int flag)
                                throws java.io.IOException
    gets various keyword values from the current position in the stream.
    The value must be enclosed between firstDelimiter and secondDelimiter
  • The StreamTokenizer is read until either all keywords are read, the end of a section occurs or until end-of-file occurs.
  • All found keywords are written into sk.
  • Multiple occurences of a keyword leads to an error report whereas the last occured value is written into sk.
  • Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    sk - array with all keywords.
    sv - array where all found values of the keyword will be written in (sk and sv must have the same length)
    e - reference to InputFormatException. Error messages are written into this Object
    fn - name of file (for error report only) or null pointer
    flag - flag whether necessarily all values must be set or not.
    (If all values must be set, pass the constant Token.ALL, otherwise pass Token.PART)
    Throws:
    java.io.IOException

    getIntegerValue

    public static void getIntegerValue(java.io.StreamTokenizer st,
                                       char firstDelimiter,
                                       char secondDelimiter,
                                       java.lang.String[] sk,
                                       java.lang.Integer[] sv,
                                       InputFormatException e,
                                       java.lang.String fn,
                                       int flag)
                                throws java.io.IOException
    gets various keyword values from the current position in the stream.
    The value must be enclosed between firstDelimiter and secondDelimiter
  • The StreamTokenizer is read until either all keywords are read, the end of a section occurs or until end-of-file occurs.
  • All found keywords are written into sk.
  • Multiple occurences of a keyword leads to an error report whereas the last occured value is written into sk.
  • Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    sk - array with all keywords.
    sv - array where all found values of the keyword will be written in (sk and sv must have the same length)
    e - reference to InputFormatException. Error messages are written into this Object
    fn - name of file (for error report only) or null pointer
    flag - flag whether necessarily all values must be set or not.
    (If all values must be set, pass the constant Token.ALL, otherwise pass Token.PART)
    Throws:
    java.io.IOException

    getStringValue

    public static void getStringValue(java.io.StreamTokenizer st,
                                      char firstDelimiter,
                                      char secondDelimiter,
                                      java.lang.String[] sk,
                                      java.lang.String[] sv,
                                      InputFormatException e,
                                      java.lang.String fn,
                                      int flag)
                               throws java.io.IOException
    gets various keyword values from the current position in the stream.
    The value must be enclosed between firstDelimiter and secondDelimiter
  • The StreamTokenizer is read until either all keywords are read, the end of a section occurs or until end-of-file occurs.
  • All found keywords are written into sk.
  • Multiple occurences of a keyword leads to an error report whereas the last occured value is written into sk.
  • Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    sk - String array with all keywords.
    sv - String array where all found values of the keyword will be written in (sk and sv must have the same length)
    e - reference to InputFormatException. Error messages are written into this Object
    fn - name of file (for error report only) or null pointer
    flag - flag whether necessarily all values must be set or not.
    (If all values must be set, pass the constant Token.ALL, otherwise pass Token.PART)
    Throws:
    java.io.IOException

    moveToSectionEnd

    public static void moveToSectionEnd(java.io.StreamTokenizer st,
                                        InputFormatException e,
                                        java.lang.String fn)
                                 throws java.io.IOException
    moves the pointer in the StreamTokenizer beyond the next '}' sign

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    fn - name of file (for error report only) or null pointer
    Throws:
    java.io.IOException

    moveToEOL

    private static void moveToEOL(java.io.StreamTokenizer st)
                           throws java.io.IOException
    moves the pointer in the StreamTokenizer beyond the next end-of-line

    Parameters:
    st - Reference to StreamTokenizer
    Throws:
    java.io.IOException

    setWordChars

    private static void setWordChars(java.io.StreamTokenizer st)

    skipSlashStarComments

    public static void skipSlashStarComments(java.io.StreamTokenizer st)
                                      throws java.io.IOException
    skips the pointer of the StreamTokenizer beyond the next /*..*'/ comment section if there is any.

    Parameters:
    st - Reference to StreamTokenizer
    Throws:
    java.io.IOException

    skipJavaComments

    public static void skipJavaComments(java.io.StreamTokenizer st)
                                 throws java.io.IOException
    skips the pointer of the StreamTokenizer beyond the next /*..*'/ or //.. comment section if there is any.

    Parameters:
    st - Reference to StreamTokenizer
    Throws:
    java.io.IOException

    skipSlashSlashComments

    public static void skipSlashSlashComments(java.io.StreamTokenizer st)
                                       throws java.io.IOException
    skips the pointer of the StreamTokenizer beyond the next //..// comment section if there is any.

    Parameters:
    st - Reference to StreamTokenizer
    Throws:
    java.io.IOException

    checkVariableSetting

    public static void checkVariableSetting(java.io.StreamTokenizer st,
                                            InputFormatException e,
                                            java.lang.String[] variableName,
                                            java.lang.String[] variableValue,
                                            java.lang.String fileName)
    checks if all values of val are set. For each value that is not set, an error message is written to the InputFormatException

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - names of the variable (for error report only)
    variableValue - values of the variables corresponding to 'variableName'
    fileName - name of file (for error report only) or null pointer

    checkVariableSetting

    public static void checkVariableSetting(java.io.StreamTokenizer st,
                                            InputFormatException e,
                                            java.lang.String variableName,
                                            java.lang.String variableValue,
                                            java.lang.String fileName)
    checks if the value of val is set. If the value is not set, an error message is written to the InputFormatException

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable (for error report only)
    variableValue - value of the variables corresponding to 'variableName'
    fileName - name of file (for error report only) or null pointer

    checkVariableSetting

    public static void checkVariableSetting(java.io.StreamTokenizer st,
                                            InputFormatException e,
                                            java.lang.String variableName,
                                            java.lang.String keyWord,
                                            java.lang.String variableValue,
                                            java.lang.String fileName)
    checks if the value of val is set. If the value is not set, an error message is written to the InputFormatException

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable (for error report only)
    keyWord - keyword that is being tested (for error report only)
    variableValue - value of the variables corresponding to 'variableName'
    fileName - name of file (for error report only) or null pointer

    checkVariableSettingEmpty

    public static void checkVariableSettingEmpty(java.io.StreamTokenizer st,
                                                 InputFormatException e,
                                                 java.lang.String variableName,
                                                 java.lang.String variableValue,
                                                 java.lang.String fileName)
    checks if the value of val is empty. If the value is not empty, an error message is written to the InputFormatException

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable (for error report only)
    variableValue - value of the variables corresponding to 'variableName'
    fileName - name of file (for error report only) or null pointer

    checkVariableSettingEmpty

    public static void checkVariableSettingEmpty(java.io.StreamTokenizer st,
                                                 InputFormatException e,
                                                 java.lang.String variableName,
                                                 java.lang.String keyWord,
                                                 java.lang.String variableValue,
                                                 java.lang.String fileName)
    checks if the value of val is empty. If the value is not empty, an error message is written to the InputFormatException

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable (for error report only)
    keyWord - keyword that is being tested (for error report only)
    variableValue - value of the variables corresponding to 'variableName'
    fileName - name of file (for error report only) or null pointer

    setError

    public static void setError(java.io.StreamTokenizer st,
                                InputFormatException e,
                                java.lang.String errorMessage,
                                java.lang.String fileName)
    sets a specified error message into the InputFormatException with the current line number and file name

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    errorMessage - error message to be written in the expection object
    fileName - name of file (for error report only) or null pointer

    variableNotSet

    public static void variableNotSet(java.io.StreamTokenizer st,
                                      InputFormatException e,
                                      java.lang.String variableName,
                                      java.lang.String fileName)
    writes an error message into the InputFormatException if a variable was not set

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable that was not found (for error report only)
    fileName - name of file (for error report only) or null pointer

    variableNotSet

    public static void variableNotSet(java.io.StreamTokenizer st,
                                      InputFormatException e,
                                      java.lang.String variableName,
                                      java.lang.String keyWord,
                                      java.lang.String fileName)
    writes an error message into the InputFormatException if a variable was not set

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable that was not found (for error report only)
    keyWord - keyword that is being tested (for error report only)
    fileName - name of file (for error report only) or null pointer

    variableNotEmpty

    public static void variableNotEmpty(java.io.StreamTokenizer st,
                                        InputFormatException e,
                                        java.lang.String variableName,
                                        java.lang.String fileName)
    writes an error message into the InputFormatException if a variable was not empty

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable that was not empty (for error report only)
    fileName - name of file (for error report only) or null pointer

    variableNotEmpty

    public static void variableNotEmpty(java.io.StreamTokenizer st,
                                        InputFormatException e,
                                        java.lang.String variableName,
                                        java.lang.String keyWord,
                                        java.lang.String fileName)
    writes an error message into the InputFormatException if a variable was not empty

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable that was not empty (for error report only)
    keyWord - keyword that is being tested (for error report only)
    fileName - name of file (for error report only) or null pointer

    checkAdmissableValue

    public static void checkAdmissableValue(java.io.StreamTokenizer st,
                                            InputFormatException e,
                                            java.lang.String variableName,
                                            java.lang.String receivedValue,
                                            java.lang.String admissibleValue,
                                            java.lang.String fileName)
    writes an error message into the InputFormatException if a variable was not set

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable (for error report only)
    receivedValue - received value
    admissibleValue - admissible value
    fileName - name of file (for error report only) or null pointer

    checkAdmissableValue

    public static void checkAdmissableValue(java.io.StreamTokenizer st,
                                            InputFormatException e,
                                            java.lang.String variableName,
                                            java.lang.String keyWord,
                                            java.lang.String receivedValue,
                                            java.lang.String admissibleValue,
                                            java.lang.String fileName)
    writes an error message into the InputFormatException if a variable was not set

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error messages are written into this Object
    variableName - name of the variable (for error report only)
    keyWord - keyword that is being tested (for error report only)
    receivedValue - received value
    admissibleValue - admissible value
    fileName - name of file (for error report only) or null pointer

    stringNotFound

    private static java.lang.String stringNotFound(java.io.StreamTokenizer st,
                                                   java.lang.String fileName)
    returns an error message if a String was not found

    Parameters:
    st - Reference to StreamTokenizer
    fileName - name of file (for error report only) or null pointer
    Throws:
    java.io.IOException

    _getValue

    private static void _getValue(java.io.StreamTokenizer st,
                                  char firstDelimiter,
                                  char secondDelimiter,
                                  java.lang.String[] sk,
                                  java.lang.Object[] sv,
                                  InputFormatException e,
                                  java.lang.String type,
                                  java.lang.String fn,
                                  int flag)
                           throws java.io.IOException
    gets various keyword values from the current position in the stream.
    The value must be enclosed between firstDelimiter and secondDelimiter
  • The StreamTokenizer is read until either all keywords are read, the end of a section occurs or until end-of-file occurs.
  • All found keywords are written into sk.
  • Multiple occurences of a keyword leads to an error report whereas the last occured value is written into sk.
  • Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    sk - String array with all keywords.
    sv - Object array where all found values of the keyword will be written in (sk and sv must have the same length)
    e - reference to InputFormatException. Error messages are written into this Object
    type - Type specification of the object (either String, boolean, Double or Integer
    fn - name of file (for error report only) or null pointer
    flag - flag whether necessarily all values must be set or not.
    (If all values must be set, pass the constant Token.ALL, therwise pass Token.PART)
    Throws:
    java.io.IOException

    _getDoubleValue

    private static java.lang.Double _getDoubleValue(java.io.StreamTokenizer st,
                                                    char firstDelimiter,
                                                    char secondDelimiter,
                                                    java.lang.String fn)
                                             throws java.io.IOException,
                                                    InputFormatException
    gets a single Double value from the current position in the stream.
    The value must be enclosed between firstDelimiter and secondDelimiter

    Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    fn - name of file (for error report only) or null pointer
    Returns:
    the Double between firstDelimiter and secondDelimiter
    Throws:
    java.io.IOException
    InputFormatException - if the input is mal formatted

    _getIntegerValue

    private static java.lang.Integer _getIntegerValue(java.io.StreamTokenizer st,
                                                      char firstDelimiter,
                                                      char secondDelimiter,
                                                      java.lang.String fn)
                                               throws java.io.IOException,
                                                      InputFormatException
    gets a single Integer value from the current position in the stream.
    The value must be enclosed between firstDelimiter and secondDelimiter

    Parameters:
    st - Reference to StreamTokenizer
    firstDelimiter - first delimiter of the searched object
    secondDelimiter - second delimiter of the searched object
    fn - name of file (for error report only) or null pointer
    Returns:
    the Integer between firstDelimiter and secondDelimiter
    Throws:
    java.io.IOException
    InputFormatException - if the input is mal formatted

    isEndOfStream

    public static boolean isEndOfStream(java.io.StreamTokenizer st,
                                        InputFormatException e,
                                        java.lang.String fn)
    checks whether we are at the end of the Stream

    Parameters:
    st - Reference to StreamTokenizer
    e - reference to InputFormatException. Error message is written into this Object
    fn - name of file (for error report only) or null pointer
    Returns:
    true if end of Stream is reached, false otherwise