class Nooz
extends java.lang.Object
Nooz is the driver class for Nooz, a simple newspaper story data system.
Because user interaction with the date is focused on news makers, the primary
data structure used by the driver is a NewsMakerList
, which is
used within main
.
Modifier and Type | Field and Description |
---|---|
private static NewsMakerList |
newsMakers
The list of news makers.
|
private static java.util.Map<java.lang.String,java.lang.String> |
sourceMap
The map from source code numerals used in the Nooz data file to the names
of the sources.
|
private static java.util.Map<java.lang.String,java.lang.String> |
subjectMap
The map from topic code numerals used in the Nooz data file to the
descriptions of the topics.
|
private static java.util.Map<java.lang.String,java.lang.String> |
topicMap
The map from topic code numerals used in the Nooz data file to the
descriptions of the topics.
|
Constructor and Description |
---|
Nooz() |
Modifier and Type | Method and Description |
---|---|
private static void |
loadData()
This helper method loads the data from either a set of four text files or
a single binary file
|
private static void |
loopForUserQueries()
This helper method handles the main user interaction loop, from "Search
newspapers ...
|
static void |
main(java.lang.String[] args)
The main method creates the objects necessary to do the work, then lets
them do it.
|
private static NewsMakerList newsMakers
private static java.util.Map<java.lang.String,java.lang.String> sourceMap
private static java.util.Map<java.lang.String,java.lang.String> topicMap
private static java.util.Map<java.lang.String,java.lang.String> subjectMap
public static void main(java.lang.String[] args) throws java.io.IOException, java.lang.ClassNotFoundException
Main delegates most of its work to two helper methods. One handles reading in the data. The other handles the main user interaction loop.
Note that this program doesn't attempt to deal with I/O errors. This is allowable at this point to keep this project relatively simple and because we haven't covered this topic yet. However, this is something to be refined in the future.
args
- The program arguments are not used in this program.java.io.IOException
- If there is an I/O problem reading the data file.java.lang.ClassNotFoundException
- If there is a data problem with the binary read.private static void loadData() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
- If there is an I/O problem reading the data file.java.lang.ClassNotFoundException
- If there is a data problem with the binary read.private static void loopForUserQueries() throws java.io.IOException
java.io.IOException
- If there is an I/O problem reading the data file.