-
Notifications
You must be signed in to change notification settings - Fork 191
[wingho]IP #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kum-wh
wants to merge
90
commits into
nus-cs2113-AY2122S1:master
Choose a base branch
from
kum-wh:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[wingho]IP #196
Changes from 23 commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
cfa100b
Change the dukes speech
58398a4
Add a echo functions that repeat commands entered by the user and exi…
7b1d074
Add the ability to store text input into a list and display it back w…
1d74b39
Add the ability to mark task as done
eed209d
Add catergory to the task, todo,deadlines and events
f4fecb4
Refactor the code to remove duplcated functions
b8ad62d
Added the ability to add mutiple task in the same line and the abilit…
37abf0d
Added a way to print words like what was printed for duke but based o…
1e6963b
Added testing
2f491b7
Add a lot of exceptions to prevent any errors
4a08901
Changing some Strings
50ed25d
Further fixes to the String printed
64b7752
Merge branch 'branch-Level-5'
2305316
Minimal packaging
57771c8
More packages
a9d7713
Fix packages
1a2a6ac
Merge branch 'branch-A-Packages'
c383114
Add a delete function to class ListManager and class inputhandler whe…
5ee47d4
Some formatting words changes
6ee2be3
Add the save function to txt files
f714fce
Merge branch 'branch-Level-7'
ec11a9f
remove some bugged files
6d21d77
debugging the file update when there is no task in the array
8565495
Change all the commands into their own class
80e1c4e
Added a find date command that find task with a specific date
71fb4c5
Added Find Keyword to search the list
cf3394a
Merge pull request #1 from kum-wh/branch-Level-8
kum-wh 3f53d4e
Merge pull request #2 from kum-wh/branch-Level-9
kum-wh 30a5c96
Added Comment to All function and classes
1f8f273
Merge branch 'master' of https://github.com/kum-wh/ip
4fb78e6
Merge pull request #3 from kum-wh/branch-A-JavaDoc
kum-wh 05c358f
Merge branch 'branch-A-JavaDoc'
9a88e1b
Level-8
668659b
Level-9
8c59d4d
JavaDoc
9060af4
no message
dc1ab66
Merge branch 'branch-A-JavaDoc'
2b9947c
Merge commit '668659beb25f93f3be1f67d4b3ea7b0d964ae7b9'
6ca401f
Merge commit '9a88e1b9b936bff54c9ed02dbd7763db87c9cd6b'
27f1319
Merge branch 'master' of https://github.com/kum-wh/ip
1c84ea0
Levvel-7 fix
899cb14
Merge branch 'branch-Level-7'
1915741
Level-8-fix
2bb73dd
Level9 fix
88be32e
A-JavaDoc
6ffc9fd
Merge pull request #4 from kum-wh/branch-Level-8
kum-wh fd4bc0a
Merge branch 'master' into branch-Level-9
kum-wh 125df38
Merge pull request #5 from kum-wh/branch-Level-9
kum-wh 2ecd0a6
Merge branch 'master' into branch-A-JavaDoc
kum-wh d22def0
Merge pull request #6 from kum-wh/branch-A-JavaDoc
kum-wh 5d5f795
Merge branch 'master' of https://github.com/kum-wh/ip
1bbc6f5
Level8
7022461
Level9
78d2e29
JavaDoc
15cfa13
Branch level8
b349f2e
Branch Level9
6a5eff9
A-JavaDoc
0303cbe
Merge pull request #7 from kum-wh/branch-Level-8
kum-wh 52b947b
Merge branch 'master' into branch-Level-9
kum-wh b097c6f
Merge pull request #8 from kum-wh/branch-Level-9
kum-wh 025d7c0
Merge branch 'master' into branch-A-JavaDoc
kum-wh c922374
Merge pull request #9 from kum-wh/branch-A-JavaDoc
kum-wh ecceb76
Level:8
8e59389
Level:9
887ddf1
A-JavaDoc
b184fca
Merge pull request #10 from kum-wh/branch-Level-8
kum-wh 2989450
Merge branch 'branch-A-JavaDoc'
d07b2aa
Solving merge conflict
bd7aca4
Merge branch 'branch-Level-9'
f3317e1
Merging PRS
264344e
Fix Exception Messages and add more comments to functions
21ea138
Fix a bug that invalid date keep throwing parsing error
19b892c
Update README.md
kum-wh 8e97fa8
Set theme jekyll-theme-cayman
kum-wh 41d7353
Update README.md
kum-wh 5d3bffc
Create README.md
kum-wh 4339745
Update README.md
kum-wh 7576a85
Update README.md
kum-wh 3f424fc
Update README.md
kum-wh 5cbdada
Update README.md
kum-wh 0ec1b61
Update README.md
kum-wh 28c7be4
Update README.md
kum-wh e4d14a7
Update README.md
kum-wh 4054b00
Update README.md
kum-wh bc4554c
Update README.md
kum-wh 1816abe
Update README.md
kum-wh e29bcf7
Update README.md
kum-wh cee51f8
Update README.md
kum-wh bba48ca
Fix ArtBot null pointer
f2c2a13
Merge branch 'master' of https://github.com/kum-wh/ip
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or 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,4 @@ | ||
| [T];[X];watch hankyuu livestream | ||
| [T];[ ];watch haxxnini livestream | ||
| [D];[X];reach radiant;this season | ||
| [E];[ ]g2 vs sentinel;12am |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,3 @@ | ||
| Manifest-Version: 1.0 | ||
| Main-Class: duke.Duke | ||
|
|
This file contains hidden or 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,154 @@ | ||
| package duke; | ||
|
|
||
| import java.util.ArrayList; | ||
|
|
||
| public class ArtBot implements ArtInterface{ | ||
|
|
||
| private final String userInput; | ||
|
|
||
| public ArtBot(String userInput){ | ||
| this.userInput = userInput; | ||
| } | ||
|
|
||
| private String[] getLogo(String letter){ | ||
| String[] letterArt; | ||
| switch(letter) { | ||
| case "A": | ||
| letterArt = Logo.A.split("\n"); | ||
| break; | ||
| case "B": | ||
| letterArt = Logo.B.split("\n"); | ||
| break; | ||
| case "C": | ||
| letterArt = Logo.C.split("\n"); | ||
| break; | ||
| case "D": | ||
| letterArt = Logo.D.split("\n"); | ||
| break; | ||
| case "E": | ||
| letterArt = Logo.E.split("\n"); | ||
| break; | ||
| case "F": | ||
| letterArt = Logo.F.split("\n"); | ||
| break; | ||
| case "G": | ||
| letterArt = Logo.G.split("\n"); | ||
| break; | ||
| case "H": | ||
| letterArt = Logo.H.split("\n"); | ||
| break; | ||
| case "I": | ||
| letterArt = Logo.I.split("\n"); | ||
| break; | ||
| case "J": | ||
| letterArt = Logo.J.split("\n"); | ||
| break; | ||
| case "K": | ||
| letterArt = Logo.K.split("\n"); | ||
| break; | ||
| case "L": | ||
| letterArt = Logo.L.split("\n"); | ||
| break; | ||
| case "M": | ||
| letterArt = Logo.M.split("\n"); | ||
| break; | ||
| case "N": | ||
| letterArt = Logo.N.split("\n"); | ||
| break; | ||
| case "O": | ||
| letterArt = Logo.O.split("\n"); | ||
| break; | ||
| case "P": | ||
| letterArt = Logo.P.split("\n"); | ||
| break; | ||
| case "Q": | ||
| letterArt = Logo.Q.split("\n"); | ||
| break; | ||
| case "R": | ||
| letterArt = Logo.R.split("\n"); | ||
| break; | ||
| case "S": | ||
| letterArt = Logo.S.split("\n"); | ||
| break; | ||
| case "T": | ||
| letterArt = Logo.T.split("\n"); | ||
| break; | ||
| case "U": | ||
| letterArt = Logo.U.split("\n"); | ||
| break; | ||
| case "V": | ||
| letterArt = Logo.V.split("\n"); | ||
| break; | ||
| case "W": | ||
| letterArt = Logo.W.split("\n"); | ||
| break; | ||
| case "X": | ||
| letterArt = Logo.X.split("\n"); | ||
| break; | ||
| case "Y": | ||
| letterArt = Logo.Y.split("\n"); | ||
| break; | ||
| case "Z": | ||
| letterArt = Logo.Z.split("\n"); | ||
| break; | ||
| case "0": | ||
| letterArt = Logo.ZERO.split("\n"); | ||
| break; | ||
| case "1": | ||
| letterArt = Logo.One.split("\n"); | ||
| break; | ||
| case "2": | ||
| letterArt = Logo.Two.split("\n"); | ||
| break; | ||
| case "3": | ||
| letterArt = Logo.THREE.split("\n"); | ||
| break; | ||
| case "4": | ||
| letterArt = Logo.FOUR.split("\n"); | ||
| break; | ||
| case "5": | ||
| letterArt = Logo.FIVE.split("\n"); | ||
| break; | ||
| case "6": | ||
| letterArt = Logo.SIX.split("\n"); | ||
| break; | ||
| case "7": | ||
| letterArt = Logo.SEVEN.split("\n"); | ||
| break; | ||
| case "8": | ||
| letterArt = Logo.EIGHT.split("\n"); | ||
| break; | ||
| case "9": | ||
| letterArt = Logo.NINE.split("\n"); | ||
| break; | ||
| default: | ||
| letterArt = null; | ||
| break; | ||
| } | ||
| return letterArt; | ||
| } | ||
|
|
||
| public void drawArt() throws CommandException{ | ||
| String[] charArray = userInput.split("(?!^)"); | ||
| ArrayList<String[]> artArray = new ArrayList<>(); | ||
| String[] mergeString = new String[5]; | ||
| for(String s:charArray){ | ||
| String[] letterInArtForm = getLogo(s); | ||
| if(letterInArtForm == null){ | ||
| throw new CommandException(ErrorList.ERROR_LETTER_NOT_FOUND); | ||
| } | ||
| artArray.add(letterInArtForm); | ||
| } | ||
| for(int i = 0; i < 5; i++){ | ||
| StringBuilder sb = new StringBuilder(); | ||
| for (String[] strings : artArray) { | ||
| String temp = strings[i]; | ||
| sb.append(temp); | ||
| } | ||
| mergeString[i] = sb.toString(); | ||
| } | ||
| for(int i = 0; i < 5; i++){ | ||
| System.out.println(mergeString[i]); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,5 @@ | ||
| package duke; | ||
|
|
||
| public interface ArtInterface { | ||
| void drawArt() throws CommandException; | ||
| } |
This file contains hidden or 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,14 @@ | ||
| package duke; | ||
|
|
||
| public class CommandException extends Exception{ | ||
|
|
||
| private String errorMessage; | ||
|
|
||
| public CommandException(String errorMessage){ | ||
| this.errorMessage = errorMessage; | ||
| } | ||
|
|
||
| public void handleException(){ | ||
| System.out.println(errorMessage); | ||
| } | ||
| } |
This file contains hidden or 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,5 @@ | ||
| package duke; | ||
|
|
||
| public interface CommandInterface { | ||
| void handleCommand(); | ||
| } |
This file contains hidden or 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,61 @@ | ||
| package duke; | ||
|
|
||
| public class CommandManager implements CommandInterface{ | ||
|
|
||
| private static final String COMMAND_HELP = "!help"; | ||
| private static final String COMMAND_LIST_HELP = "!list"; | ||
| private static final String COMMAND_EVENT_HELP = "!event"; | ||
| private static final String COMMAND_DEADLINE_HELP = "!deadline"; | ||
| private static final String COMMAND_ECHO = "!echo"; | ||
| private static final String MESSAGE_HELP = "List of Commands:\n" + | ||
| " echo - Repeat whatever was typed - !echo to repeat in art form\n" + | ||
| " list - Display List - !list for details\n" + | ||
| " todo - Add ToDo Task\n" + | ||
| " event - Add Event Task - !event for details\n" + | ||
| " deadline - Add Deadline Task - !deadline for details\n" + | ||
| " bye - Shut Down\n"; | ||
| private static final String MESSAGE_LIST_HELP = "list displays all tasks\n" + | ||
| "list todo displays all todo tasks\n" + | ||
| "list event displays all event tasks\n" + | ||
| "list deadline displays all deadline tasks\n"; | ||
| private static final String MESSAGE_EVENT_HELP = "event command requires a timing indicated using \"at\" [timing]\n"; | ||
| private static final String MESSAGE_DEADLINE_HELP = "deadline command requires a end time indicated using \"by\"[end time]\n"; | ||
|
|
||
| private final String description; | ||
|
|
||
| public CommandManager(String description){ | ||
| this.description = description; | ||
| } | ||
|
|
||
| private void handleArtCommand(){ | ||
| String removeCommand = description.replaceFirst(COMMAND_ECHO,"").trim().toUpperCase(); | ||
| System.out.println(removeCommand); | ||
| ArtBot artBot = new ArtBot(removeCommand); | ||
| try { | ||
| artBot.drawArt(); | ||
| }catch (CommandException e){ | ||
| e.handleException(); | ||
| } | ||
| } | ||
|
|
||
| public void handleCommand(){ | ||
| if(description.startsWith(COMMAND_ECHO)){ | ||
| handleArtCommand(); | ||
| return; | ||
| } | ||
| switch(description) { | ||
| case COMMAND_HELP: | ||
| System.out.println(Logo.divider + MESSAGE_HELP + Logo.dividerWithoutNewLine); | ||
| break; | ||
| case COMMAND_LIST_HELP: | ||
| System.out.println(Logo.divider + MESSAGE_LIST_HELP + Logo.dividerWithoutNewLine); | ||
| break; | ||
| case COMMAND_EVENT_HELP: | ||
| System.out.println(Logo.divider + MESSAGE_EVENT_HELP + Logo.dividerWithoutNewLine); | ||
| break; | ||
| case COMMAND_DEADLINE_HELP: | ||
| System.out.println(Logo.divider + MESSAGE_DEADLINE_HELP + Logo.dividerWithoutNewLine); | ||
| break; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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,52 @@ | ||
| package duke; | ||
|
|
||
| import duke.task.Task; | ||
|
|
||
| import java.util.Scanner; | ||
| import java.util.ArrayList; | ||
|
|
||
| public class Duke { | ||
| private static final String MESSAGE_HI = "Hello! I'm Duke\n" + "What can I do for you?\n" + "!help for Command List\n"; | ||
| private static final String MESSAGE_BYE = "Bye. Hope to see you again soon!\n"; | ||
|
|
||
| protected static boolean isOnline; | ||
|
|
||
| private static void startDuke(){ | ||
| isOnline = true; | ||
| System.out.println(Logo.logo +Logo.divider + MESSAGE_HI + Logo.dividerWithoutNewLine); | ||
| } | ||
|
|
||
| private static void endDuke(){ | ||
| System.out.println(Logo.divider + MESSAGE_BYE + Logo.divider + Logo.bye); | ||
| } | ||
|
|
||
| public static void main(String[] args) { | ||
| startDuke(); | ||
| Scanner in = new Scanner(System.in); | ||
| ArrayList <Task> list = new ArrayList<>(); | ||
| ListManager listManager = new ListManager(list); | ||
| FileManager fileManager = new FileManager(listManager); | ||
| fileManager.covertStringToTask(); | ||
| while(isOnline) { | ||
| String userInput = in.nextLine().toLowerCase().trim(); | ||
| if (userInput.startsWith("!")) { | ||
| CommandManager commandManager = new CommandManager(userInput); | ||
| commandManager.handleCommand(); | ||
| } else { | ||
| InputHandler inputManager = new InputHandler(userInput, listManager, fileManager); | ||
| try { | ||
| inputManager.handleInput(); | ||
| }catch(CommandException e){ | ||
| e.handleException(); | ||
| } | ||
| if(list.size() != 0) { | ||
| fileManager.writeToFile(list.get(0), false); | ||
| for (int i = 1; i < list.size(); i++) { | ||
| fileManager.writeToFile(list.get(i), true); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| endDuke(); | ||
| } | ||
| } | ||
This file contains hidden or 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,20 @@ | ||
| package duke; | ||
|
|
||
| public class ErrorList { | ||
| public static final String ERROR_NULL = "☹ OOPS!!! Input cannot be empty."; | ||
| public static final String ERROR_UNKNOWN_COMMAND = "☹ OOPS!!! I'm sorry, but I don't know what that means :-(\n" + "" + | ||
| "Defaulting to Echo. Type !help to see the list of Commands"; | ||
| public static final String ERROR_EMPTY_LIST = "☹ OOPS!!! List is empty. Add tasks to the list."; | ||
| public static final String ERROR_EMPTY_TODO_LIST = "☹ OOPS!!! There is no To Do task in list. Add To Do tasks to the list."; | ||
| public static final String ERROR_EMPTY_EVENT_LIST = "☹ OOPS!!! There is no Event task in list. Add Events to the list."; | ||
| public static final String ERROR_EMPTY_DEADLINE_LIST = "☹ OOPS!!! There is no Deadline task in list. Add Deadlines to the list."; | ||
| public static final String ERROR_EMPTY_TODO_INPUT = "☹ OOPS!!! The description of a todo cannot be empty.\n"; | ||
| public static final String ERROR_EMPTY_EVENT_INPUT = "☹ OOPS!!! The description of a event cannot be empty.\n"; | ||
| public static final String ERROR_EMPTY_DEADLINE_INPUT = "☹ OOPS!!! The description of a deadline cannot be empty.\n"; | ||
| public static final String ERROR_EMPTY_ECHO_INPUT = "☹ OOPS!!! The description of a echo cannot be empty.\n"; | ||
| public static final String ERROR_EMPTY_EVENT_TIME = "☹ OOPS!!! The timing of a event cannot be empty.\n"; | ||
| public static final String ERROR_EMPTY_DEADLINE_TIME = "☹ OOPS!!! The due date of a deadline cannot be empty.\n"; | ||
| public static final String ERROR_DONE_TASK_NOT_IN_LIST ="☹ OOPS!!! Task done not found in list\n"; | ||
| public static final String ERROR_DELETE_TASK ="☹ OOPS!!! Cannot remove task that does not exist.\n"; | ||
| public static final String ERROR_LETTER_NOT_FOUND = "☹ OOPS!!! Something went wrong. Do not input space or symbols.\n"; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps a magic string here? maybe change to a named constant in case you are going to use it somewhere else...