public class TicTacToeHashMap
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
private static int |
ERROR_CODE |
An integer constant holding the number (1) that is passed to System.exit()
after certain conditions occur
|
private static int |
HASHMAP_SIZE |
The size of the HashMap chosen because it is one of the closest powers of two (specifically it's 2^9)
to a load factor of two (and I would prefer the smaller one out of the two options)
|
private static int |
NUMBER_OF_WINNERS |
The number of winning TicTacToe Strings
|
private static java.lang.String |
WINNER_FILE |
The name of the file with the TicTacToe winners
|
private static java.lang.String |
WINNER_FILE_NOT_FOUND |
The error message used if the file with the winners is not found
|
(package private) java.util.HashMap<java.lang.String,java.lang.Boolean> |
winners |
The HashMap that holds the winning TicTacToe Strings.
|
| Constructor | Description |
|---|---|
TicTacToeHashMap() |
Constructs a TicTacToeHashMap, which holds a HashMap with a String key and Boolean value.
|
| Modifier and Type | Method | Description |
|---|---|---|
private int |
capacity() |
Uses reflection to return the capacity of the winners HashMap
|
private java.lang.Object |
getNext(java.util.Map.Entry entry) |
Uses reflection to return the next node after a HashMap.Entry in a linked list
|
private java.util.Map.Entry[] |
getTable() |
Uses reflection to return the table of the winners HashMap, which is a HashMap.Entry[]
|
private boolean |
hasNext(java.util.Map.Entry entry) |
Uses reflection whether a HashMap.Entry in a linked list has a next node
|
static void |
main(java.lang.String[] args) |
java.util.HashMap<java.lang.String,java.lang.Boolean> winners
private static final int NUMBER_OF_WINNERS
private static final int HASHMAP_SIZE
private static final int ERROR_CODE
private static final java.lang.String WINNER_FILE
private static final java.lang.String WINNER_FILE_NOT_FOUND
TicTacToeHashMap()
private int capacity()
throws java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
java.lang.NoSuchFieldException - thrown if the reflective field this method is looking for,
which is table, cannot be foundjava.lang.IllegalAccessException - thrown when the method tries to use
reflection without accessprivate java.util.Map.Entry[] getTable()
throws java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
java.lang.NoSuchFieldException - thrown if the reflective field this method is looking for,
which is table, cannot be foundjava.lang.IllegalAccessException - thrown when the method tries to use
reflection without accessprivate java.lang.Object getNext(java.util.Map.Entry entry)
throws java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
entry - a HashMap.Entry for which the next node will be foundjava.lang.NoSuchFieldException - thrown if the reflective field this method is looking for,
which is next, cannot be foundjava.lang.IllegalAccessException - thrown when the method tries to use
reflection without accessprivate boolean hasNext(java.util.Map.Entry entry)
throws java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
entry - a HashMap.Entry for which it will be assessed if it has a next nodejava.lang.NoSuchFieldException - thrown if the reflective field this method is looking for,
which is next, cannot be foundjava.lang.IllegalAccessException - thrown when the method tries to use
reflection without accesspublic static void main(java.lang.String[] args)
throws java.io.FileNotFoundException,
java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
java.io.FileNotFoundExceptionjava.lang.NoSuchFieldExceptionjava.lang.IllegalAccessException