usflix
Class Driver

java.lang.Object
  extended by usflix.Driver

public class Driver
extends java.lang.Object

Driver class manages user interaction: input and output between the program and users

Version:
2.0 March 3, 2013.
Author:
EJ Jung

Field Summary
private static MovieDatabase movieDB
          There will be only one movie database and one user database in the system, so they are declared as static.
private static UserDatabase userDB
           
 
Constructor Summary
Driver()
           
 
Method Summary
private static void listMenu(User u, java.util.ArrayList<Movie> list)
          listMenu handles printing the list of Movies with the appropriate rating (user's own if available, average otherwise), letting user rate any of the Movies in the list.
private static void loadUsers(java.lang.String filename)
          loadUsers() method loads the user information from a file.
static void main(java.lang.String[] args)
          The first program argument (args[0]) may contain the movie information file name, and the second program argument (args[1]) may contain the user information file name.
private static void userMenu(User u)
          userMenu handles menu options that are available after logging in, such as search by title (and director if you have it) and the list of movies the user has seen before.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

movieDB

private static MovieDatabase movieDB
There will be only one movie database and one user database in the system, so they are declared as static.


userDB

private static UserDatabase userDB
Constructor Detail

Driver

public Driver()
Method Detail

main

public static void main(java.lang.String[] args)
The first program argument (args[0]) may contain the movie information file name, and the second program argument (args[1]) may contain the user information file name.

Parameters:
args -

loadUsers

private static void loadUsers(java.lang.String filename)
                       throws java.io.FileNotFoundException
loadUsers() method loads the user information from a file. If the username is available, then the new account is created and his or her rating information gets added to the movie database and also to the user object. If the username is not available, then this method skips to the next user information (until it sees "done").

Parameters:
filename - the user information file name
Throws:
java.io.FileNotFoundException - if the user information file is not found, then the main method catches the exception and asks user for another file name.

userMenu

private static void userMenu(User u)
userMenu handles menu options that are available after logging in, such as search by title (and director if you have it) and the list of movies the user has seen before.

Parameters:
u -

listMenu

private static void listMenu(User u,
                             java.util.ArrayList<Movie> list)
listMenu handles printing the list of Movies with the appropriate rating (user's own if available, average otherwise), letting user rate any of the Movies in the list.

Parameters:
u -
list - search result or the list of movies user has seen