public class ExpressionTreeTest
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
private static java.lang.String |
DEFAULT_FILE_NAME |
The default name for the input file
|
private static java.lang.String |
EMPTY |
An empty String
|
private static int |
ERROR_CODE |
The code passed as a parameter to System.exit() when something has gone wrong
|
private static java.lang.String |
EXIT |
The word exit
|
private static java.lang.String |
INVALID_FILE_MESSAGE |
The message shown if the file holding the postfix expressions is not found
|
private static java.lang.String |
IOEXCEPTION_MESSAGE |
The message shown if the program encounters an IOException when reading the file with the expressions
|
private static java.util.Scanner |
keyboard |
The Scanner used to read user input on the keyboard
|
private static java.lang.String |
NEW_LINE |
A newline
|
private static java.io.PrintWriter |
output |
The PrintWriter to print to the output file with name OUTPUT_FILE_NAME
|
private static java.lang.String |
OUTPUT_FILE_NAME |
The name of the designated output file
|
private static java.lang.String |
PRINTWRITER_ERROR_MESSAGE |
The error message used if a PrintWriter throws a FileNotFoundException
|
private static java.lang.String |
SPACE |
A space
|
| Constructor | Description |
|---|---|
ExpressionTreeTest() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
main(java.lang.String[] args) |
|
static void |
printTest(ExpressionTree tree,
java.lang.String[] expressions) |
Prints out the various tests this program is required to run.
|
static java.lang.String[] |
readFileWithPostfixExpressions(java.io.File file) |
Reads a file with postfixExpressions in it and returns the expressions as a String array
with each index holding a singular expression.
|
private static final java.lang.String DEFAULT_FILE_NAME
private static final java.lang.String OUTPUT_FILE_NAME
private static final java.lang.String IOEXCEPTION_MESSAGE
private static final java.lang.String INVALID_FILE_MESSAGE
private static final java.lang.String PRINTWRITER_ERROR_MESSAGE
private static final java.lang.String EXIT
private static final java.lang.String SPACE
private static final java.lang.String EMPTY
private static final java.lang.String NEW_LINE
private static final int ERROR_CODE
private static java.util.Scanner keyboard
private static java.io.PrintWriter output
public static void main(java.lang.String[] args)
public static java.lang.String[] readFileWithPostfixExpressions(java.io.File file)
throws java.io.IOException
file - the name of the file to readjava.io.IOException - if an error has occurred in reading the filepublic static void printTest(ExpressionTree tree, java.lang.String[] expressions)
tree - an ExpressionTree to perform various operations onexpressions - the list of expressions the ExpressionTree holds