forked from nus-cs2103-AY2223S2/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Ui class with MessageGenerator class
- Loading branch information
Showing
12 changed files
with
114 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package duke; | ||
|
||
|
||
/** | ||
* Class responsible for Duke's response messages. | ||
*/ | ||
public class MessageGenerator { | ||
|
||
/** | ||
* get Duke's welcome message that plays on startup. | ||
*/ | ||
public static String genWelcomeMsg() { | ||
return "What's up? \uD83D\uDE00"; | ||
} | ||
|
||
public static String genByeMsg() { | ||
return "Goodbye"; | ||
} | ||
|
||
public static String genAddedTaskMsg(String task) { | ||
return "added a " + task; | ||
} | ||
|
||
public static String genMissingTaskDescMsg(String task) { | ||
return "You're missing a description for your " + task; | ||
} | ||
|
||
public static String genMissingFieldMsg(String field) { | ||
return "You're missing a " + field + " field"; | ||
} | ||
|
||
public static String genDateTimeParseErrorMsg() { | ||
return "Couldn't understand the given date and time"; | ||
} | ||
|
||
public static String genDeleteTaskMsg(String task) { | ||
return "Deleted " + task; | ||
} | ||
|
||
public static String genTaskDoesNotExistMsg(String number) { | ||
return "A task with number " + number + " does not exist."; | ||
} | ||
|
||
public static String genNotANumberMsg() { | ||
return "We needed a number here"; | ||
} | ||
|
||
public static String genFindTasksMsg(String tasks) { | ||
if (tasks.isEmpty()) { | ||
return "Didn't find anything"; | ||
} | ||
|
||
return "Here's what I found:\n" + tasks; | ||
} | ||
|
||
public static String genShowTasksMsg(String tasks) { | ||
if (tasks.isEmpty()) { | ||
return "You don't have any tasks... Try adding some."; | ||
} | ||
|
||
return "Here's your tasks:\n" + tasks; | ||
} | ||
|
||
public static String genMarkorUnmarkTaskMsg(String task, boolean isMark) { | ||
if (isMark) { | ||
return "Marked this task: " + task; | ||
} | ||
|
||
return "Unmarked this task: " + task; | ||
} | ||
|
||
public static String genUnknownCommandMsg() { | ||
return "I don't know what that means"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package duke.command; | ||
|
||
import duke.DukeResponse; | ||
import duke.MessageGenerator; | ||
|
||
public class ByeCommand extends Command { | ||
|
||
@Override | ||
public DukeResponse execute() { | ||
return new DukeResponse("goodbye", true); | ||
return new DukeResponse(MessageGenerator.genByeMsg(), true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.