Class MessageApp
Object
MessageApp
This is the heart of the program, providing interaction between the client
and the MessageList. As such, it needs an ArrayList of Messages to work.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageApp
(ArrayList<OpenMessage> messages) Initialize the ArrayList of messages -
Method Summary
Modifier and TypeMethodDescriptionvoid
go()
Runs the program, keep going until user input is "x".void
processCommand
(String command) Checks the command (options from the menu) and calls appropriate methods for its functionality.private String
Asks user for what type of search and what they are searching for, then returns the message if found.
-
Field Details
-
messages
-
view
-
-
Constructor Details
-
MessageApp
Initialize the ArrayList of messages- Parameters:
messages
- ArrayList of messages
-
-
Method Details
-
go
public void go()Runs the program, keep going until user input is "x". If "x" is entered, stop the program. -
processCommand
Checks the command (options from the menu) and calls appropriate methods for its functionality. Does nothing if a command is not known (no need for help dialog).Implementation Hints:
- First convert the command to lower case so we don't have to worry about case
- Then check if the command is "s". If so, search for the string and print the result.
- Use helper methods! The searchHelper() method is there to keep clutter out of the processCommand() method.
- Note: You will need to print the results of searchHelper()
- Parameters:
command
- command entered by user
-
searchHelper
Asks user for what type of search and what they are searching for, then returns the message if found.- Returns:
- String that is a list of all messages found that satisfy the search
-