All Packages Class Hierarchy This Package Previous Next Index
Class jdsltools.testers.TesterStringParser
java.lang.Object
|
+----jdsltools.testers.TesterStringParser
- public class TesterStringParser
- extends Object
-
TesterStringParser()
- Class constructor.
-
TesterStringParser(GenericTester)
- Class constructor.
-
parseMessage(String)
- Parses a string that contains a message.
-
parseParameters(String)
- Parses a string that contains a list of parameters for a call to execute.
-
parseTests(String)
- Parses a list of tests of the form n,m.
TesterStringParser
public TesterStringParser()
- Class constructor. If this constructor is used, the tester will not
be able to parse $ commands.
TesterStringParser
public TesterStringParser(GenericTester tester)
- Class constructor.
- Parameters:
- tester - The
GenericTester
that will be using this
parser.
parseParameters
public TesterArrays parseParameters(String string) throws StringFormatException
- Parses a string that contains a list of parameters for a call to execute.
The following tokens are understood in the string:
- $LOCATION the current location created from the most recent call to
generate
on the factory.
- $LOCATION[n] where n is an integer. This is location
n in the array of locations returned by the most recent call to
generate.
- $STRUCTURE the current structure created from the most recent call to
generate
on the factory.
- $STRUCTURE[n] where n is an integer. This is structure
- $RETURN the return value of the most recently executed
execute
command.
- $PARAMETER[n] The corresponding parameter set by a call to
setParameter
.
n in the array of structures returned by the most recent call to
generate.
- A string surrounded by quotes(") is considered to be
java.lang.String, and the quoted literal is the data contained in that
String.
- All other tokens are assumed to be either
class
names
(either fully qualified or refered to in an import
call.), a
base type (i.e. boolean
or void
). or a
parameter to a function.
- In the case of a base type, the name of the base type should be
followed by the value that base type should have. For example
int
3 or float
.
- If it is a
class
name, then it should be followed by a
'(', and then a list of the parameters to pass into that constructor.
Nested constructors are permitted in this manner. For example:
java.util.Hashtable(int 3).
In all cases, the tokens should be separated by a comma. Please note
that int
3 is considered one token.
- Parameters:
- string - The string to be parsed
- Returns:
- A
TesterArrays
that represents the string that
was parsed.
- Throws: StringFormatException
- if there is an error in the format of the string.
parseMessage
public String parseMessage(String message) throws StringFormatException
- Parses a string that contains a message.
The following tokens are understood in the string:
- $METHOD - The method that was most recently called.
- $STRUCTURE - The string name representing the container that was most
recently created by the factory. This string is obtained by calling
structName
on the factory, and passing the number that was
used to create the current container.
- $STRUCTURE[n] - Similar to $STRUCTURE, except it should be
used when the call to
generate
created multiple containers.
- $LOCATION - The string name representing the location created during
the most recent call to
generate
. This string is obtained
by calling locName
on the factory, and passing in the number
of the container and location passed in.
- $LOCATION[n] - Similar to $LOCATION, except it should be
used when the call to
generate
created multiple containers.
- $ANSWER - Returns what you were expecting the
execute
method to throw or return.
- All other tokens are considered to be literals.
- Parameters:
- message - The string to be parsed.
- Returns:
- the string that
message
represents.
parseTests
public int[][] parseTests(String list) throws StringFormatException
- Parses a list of tests of the form n,m. If a structure key was given,
but no location key was given, then a -1 is put in place of that key.
- Returns:
- A array of pairs of ints.
- Throws: StringFormatException
- if there is an error in the string
format.
All Packages Class Hierarchy This Package Previous Next Index