SimKit
Class BatchFile
java.lang.Object
|
+--java.io.StreamTokenizer
|
+--SimKit.BatchFile
- public class BatchFile
- extends java.io.StreamTokenizer
The BatchFile class is used for running a simulation
multiple times, each time with different arguments.
To primary function to use from this class is the
nextArgs() function.
The batch file adheres to a format containing three parts.
Section 1: Default Parameters
This section is embedded between <DefaultParameters>
and </DefaultParameters> tags. It contains pairs of
items, the first part is a variable name, the second
part is that variable's value.
Section 2: Label fields
This section is embedded between <Labels>
and </Labels> tags. It contains a list of n variable
names.
Section 3: Values of Parameters
This section is not embedded between any tags but
simply contains a sequence of sets of n values. Each of
these
will be assigned to their respective counterparts from
the labels section.
Here is an example file
# A comment goes here. The DefaultParameters are optional.
<DefaultParameters>
x 7
y 9.34
endTime 12
SimName "Test of Batch Mode"
debugMode False
</DefaultParameters>
<Labels>
runName u seed density gamma
</Labels>
"Test2" 12.3 354 565 35
"Test3" 12.3 344 656 34
# Repeat add nauseam
Fields inherited from class java.io.StreamTokenizer |
nval, sval, TT_EOF, TT_EOL, TT_NUMBER, TT_WORD, ttype |
Constructor Summary |
BatchFile(java.lang.String name)
Open the batch file for read only access. |
Method Summary |
void |
close()
Close the input file |
Arguments |
nextArgs()
Retrieve the next set of arguments from the text file. |
Methods inherited from class java.io.StreamTokenizer |
commentChar, eolIsSignificant, lineno, lowerCaseMode, nextToken, ordinaryChar, ordinaryChars, parseNumbers, pushBack, quoteChar, resetSyntax, slashSlashComments, slashStarComments, toString, whitespaceChars, wordChars |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BatchFile
public BatchFile(java.lang.String name)
throws java.io.IOException
- Open the batch file for read only access. Parse the
header information as well. This includes the
DEFAULTPARAMETERS tag as well as the LABELS tag.
- Parameters:
name
- The name of the file to open.
nextArgs
public Arguments nextArgs()
- Retrieve the next set of arguments from the text file.
If there are not enough arguments remaining in the file
then a null value will be returned.
- Returns:
- The arguments found on the next text line of
the input file. Returns null if there are no more.
- See Also:
Arguments
close
public void close()
throws java.io.IOException
- Close the input file
java.io.IOException