-
Notifications
You must be signed in to change notification settings - Fork 484
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
[Tham You Wei] iP #536
Open
tyouwei
wants to merge
76
commits into
nus-cs2103-AY2324S1:master
Choose a base branch
from
tyouwei: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
[Tham You Wei] iP #536
Changes from 31 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
28ad2b8
Add Gradle support
ed6d4d2
Bump gradle and lib version
Eclipse-Dominator eb4d5ff
Added Rename, Greet, Exit
tyouwei efc93d5
Added Echo
tyouwei e4b6b1b
Added Add, List
tyouwei 8d6ed52
Added Mark as Done
tyouwei 0d0a528
Added ToDos, Events, Deadlines
tyouwei 5b3dc87
Added Automated text UI testing and fixed some input bugs
tyouwei 03baad6
Added error handles
tyouwei 8c2b377
Added delete
tyouwei 76606d4
Use Enums
tyouwei c47583d
Add Save
tyouwei 6e93a9d
Organise packages
tyouwei 6fe56b1
Add Date Time
tyouwei 012cb35
Chatbot revamp
tyouwei 0d7c4e4
Chatbot revamp
tyouwei 55a8bc4
Add Time
tyouwei 2dffb61
More OOP
tyouwei 35c2a83
package and cleanup
tyouwei 6e0c07c
Merge branch 'branch-level-7' into add-gradle-support
tyouwei 3c6d112
Use Gradle
tyouwei 9e7638d
JUnit
tyouwei 4af0479
Fix Bug
tyouwei 98caa89
Delete faulty test
tyouwei a0fb381
More bug fixes
tyouwei 908f26b
Add Javadocs
tyouwei 5f71000
Coding Standard
tyouwei 3b03c4d
Add Find
tyouwei b721849
gitignore
tyouwei 09432be
gitignore
tyouwei 57b6cbe
Command bug fix
tyouwei 27d3b04
add checkstyles
tyouwei 02dd638
Add GUI
tyouwei 19f01f9
Add GUI
tyouwei 153d38a
Merge branch 'branch-level-10'
tyouwei 45d6430
checkstyles
tyouwei 9184794
Add assertions
tyouwei 85d575c
A-CodeQuality
tyouwei f9619a0
A-FullCommitMessage
tyouwei e2478e3
Bug Fix
tyouwei dabc291
Friendlier Syntax
tyouwei 07cb0af
Test PR merge
tyouwei 8ca7dd6
Merge pull request #1 from tyouwei/newbranch
tyouwei 639cd72
Testing PR
tyouwei a922856
Testing PR
tyouwei fe38395
Merge branch 'master' into branch-A-Assertions
tyouwei 11982c6
Merge pull request #3 from tyouwei/branch-A-Assertions
tyouwei 8695ebd
Merge pull request #2 from tyouwei/branch-A-CodeQuality
tyouwei 0aa9359
Add files via upload
tyouwei 0c2b0ac
Update README.md
tyouwei f9de87d
Update README.md
tyouwei bf2ca21
Update README.md
tyouwei b877e86
Update README.md
tyouwei 73de36f
Update README.md
tyouwei 7c9ae33
Update README.md
tyouwei 1d6de56
Update README.md
tyouwei 6e574d1
Update README.md
tyouwei 6dd1632
Update README.md
tyouwei 60afd4d
Update README.md
tyouwei afef86d
Update README.md
tyouwei f7881e2
Update README.md
tyouwei 4297325
Update README.md
tyouwei e1dc4f7
Update README.md
tyouwei fbd0925
Update README.md
tyouwei f11ef0c
Update README.md
tyouwei c2f7e73
Update README.md
tyouwei 7526208
A-UserGuide
tyouwei fe161ec
A-UserGuide
tyouwei 2421a59
A-UserGuide
tyouwei 98e3ab9
README
tyouwei 9ae52e6
Updated main README
tyouwei 95306aa
Changed save file location
tyouwei cbe2819
More JUnit Testing
tyouwei f6410b4
Add images
tyouwei 5921207
Update Ui.png
tyouwei b24e418
Update Ui.png
tyouwei 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
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,92 @@ | ||
@rem | ||
@rem Copyright 2015 the original author or authors. | ||
@rem | ||
@rem Licensed under the Apache License, Version 2.0 (the "License"); | ||
@rem you may not use this file except in compliance with the License. | ||
@rem You may obtain a copy of the License at | ||
@rem | ||
@rem https://www.apache.org/licenses/LICENSE-2.0 | ||
@rem | ||
@rem Unless required by applicable law or agreed to in writing, software | ||
@rem distributed under the License is distributed on an "AS IS" BASIS, | ||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
@rem See the License for the specific language governing permissions and | ||
@rem limitations under the License. | ||
@rem | ||
|
||
@if "%DEBUG%"=="" @echo off | ||
@rem ########################################################################## | ||
@rem | ||
@rem Gradle startup script for Windows | ||
@rem | ||
@rem ########################################################################## | ||
|
||
@rem Set local scope for the variables with windows NT shell | ||
if "%OS%"=="Windows_NT" setlocal | ||
|
||
set DIRNAME=%~dp0 | ||
if "%DIRNAME%"=="" set DIRNAME=. | ||
@rem This is normally unused | ||
set APP_BASE_NAME=%~n0 | ||
set APP_HOME=%DIRNAME% | ||
|
||
@rem Resolve any "." and ".." in APP_HOME to make it shorter. | ||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | ||
|
||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | ||
|
||
@rem Find java.exe | ||
if defined JAVA_HOME goto findJavaFromJavaHome | ||
|
||
set JAVA_EXE=java.exe | ||
%JAVA_EXE% -version >NUL 2>&1 | ||
if %ERRORLEVEL% equ 0 goto execute | ||
|
||
echo. | ||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
echo. | ||
echo Please set the JAVA_HOME variable in your environment to match the | ||
echo location of your Java installation. | ||
|
||
goto fail | ||
|
||
:findJavaFromJavaHome | ||
set JAVA_HOME=%JAVA_HOME:"=% | ||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||
|
||
if exist "%JAVA_EXE%" goto execute | ||
|
||
echo. | ||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||
echo. | ||
echo Please set the JAVA_HOME variable in your environment to match the | ||
echo location of your Java installation. | ||
|
||
goto fail | ||
|
||
:execute | ||
@rem Setup the command line | ||
|
||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||
|
||
|
||
@rem Execute Gradle | ||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | ||
|
||
:end | ||
@rem End local scope for the variables with windows NT shell | ||
if %ERRORLEVEL% equ 0 goto mainEnd | ||
|
||
:fail | ||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||
rem the _cmd.exe /c_ return code! | ||
set EXIT_CODE=%ERRORLEVEL% | ||
if %EXIT_CODE% equ 0 set EXIT_CODE=1 | ||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | ||
exit /b %EXIT_CODE% | ||
|
||
:mainEnd | ||
if "%OS%"=="Windows_NT" endlocal | ||
|
||
:omega |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package chatbot.evan; | ||
|
||
import java.util.Scanner; | ||
|
||
import command.*; | ||
|
||
import enums.Command; | ||
|
||
import exception.InvalidInputException; | ||
import exception.InvalidCommandException; | ||
import exception.MissingArgumentException; | ||
|
||
import parser.CommandParser; | ||
import task.TaskList; | ||
|
||
import ui.Reply; | ||
|
||
/** | ||
* Main class for the chatbot | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good javadocs written throughout |
||
public class Evan { | ||
|
||
private static TaskList tasks = TaskList.init(); | ||
private static Reply reply = Reply.init(); | ||
|
||
/** | ||
* main method of the Main class Evan chatbot | ||
* Continuously takes in user input and gives an appropriate response until the user enters "bye | ||
* @param args unused | ||
*/ | ||
public static void main(String[] args) { | ||
//Start user interaction | ||
Scanner scanner = new Scanner(System.in); | ||
|
||
while(true) { | ||
try { | ||
String input = scanner.nextLine().toLowerCase(); | ||
|
||
if (input.equals(Command.BYE.getCommand())) { | ||
reply.printDialog("Bye. Hope to see you again soon!"); | ||
return; | ||
} else if (input.equals(Command.LIST.getCommand())) { | ||
tasks.printTasks(); | ||
} else if (input.equals(Command.TODO.getCommand())) { | ||
ToDoCommand.start(); | ||
} else if (input.equals(Command.DEADLINE.getCommand())) { | ||
DeadlineCommand.start(); | ||
} else if (input.equals(Command.EVENT.getCommand())) { | ||
EventCommand.start(); | ||
} else if (input.startsWith(Command.DELETE.getCommand())) { | ||
DeleteCommand.start(input); | ||
} else if (input.startsWith(Command.MARK.getCommand())) { | ||
MarkCommand.start(input); | ||
} else if (input.startsWith(Command.UNMARK.getCommand())) { | ||
UnmarkCommand.start(input); | ||
} else if (input.startsWith(Command.FIND.getCommand())) { | ||
FindCommand.start(input); | ||
} else { | ||
throw new InvalidCommandException(); | ||
} | ||
} catch (InvalidInputException e) { | ||
reply.printDialog(e.toString()); | ||
} catch (MissingArgumentException e) { | ||
reply.printDialog(e.toString()); | ||
} catch (InvalidCommandException e) { | ||
reply.printDialog(e.toString()); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
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,59 @@ | ||
package command; | ||
|
||
import exception.InvalidDateException; | ||
import exception.InvalidTimeException; | ||
|
||
import task.TaskList; | ||
import task.Deadlines; | ||
|
||
import ui.Reply; | ||
|
||
import parser.Time; | ||
|
||
import java.util.Scanner; | ||
|
||
/** | ||
* Class for Deadline command with its static implementation of its processes | ||
*/ | ||
public class DeadlineCommand { | ||
private static Reply reply = Reply.init(); | ||
private static TaskList tasks = TaskList.init(); | ||
|
||
/** | ||
* Main process of Deadline Command. | ||
* Prompts user to enter the task and deadline date and time before validating and adding it to the list. | ||
* Returns to homepage otherwise. | ||
*/ | ||
public static void start() { | ||
|
||
Scanner scanner = new Scanner(System.in); | ||
|
||
reply.printDialog("So you want to add a task with deadline. Tell me what's the task."); | ||
String desc = scanner.nextLine(); | ||
|
||
reply.printDialog("Now indicate the deadline date."); | ||
String date = scanner.nextLine(); | ||
try { | ||
date = Time.formatDate(date); | ||
} catch (InvalidDateException e) { | ||
reply.printDialog(e.toString()); | ||
return; | ||
} | ||
|
||
reply.printDialog("Indicate a start time in ranging from 0000 - 2359. You may enter 'Skip' to not indicate a time"); | ||
String time = scanner.nextLine(); | ||
if (!time.toLowerCase().equals(enums.Command.SKIP.getCommand())) { | ||
try { | ||
date = Time.formatTime(date, time); | ||
} catch (InvalidTimeException | InvalidDateException e) { | ||
reply.printDialog(e.toString()); | ||
return; | ||
} catch (NumberFormatException e) { | ||
reply.printDialog("Non-numerical characters detected. Please enter numbers only. Returning to homepage..."); | ||
return; | ||
} | ||
} | ||
|
||
tasks.addTask(new Deadlines(desc, date)); | ||
} | ||
} |
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,43 @@ | ||
package command; | ||
|
||
import exception.InvalidCommandException; | ||
import exception.MissingArgumentException; | ||
import exception.InvalidInputException; | ||
|
||
import parser.CommandParser; | ||
|
||
import task.TaskList; | ||
|
||
import ui.Reply; | ||
|
||
/** | ||
* Class for Delete command with its static implementation of its processes | ||
*/ | ||
public class DeleteCommand { | ||
private static Reply reply = Reply.init(); | ||
private static TaskList tasks = TaskList.init(); | ||
|
||
/** | ||
* Main process of Delete Command. | ||
* Validates the input after the delete keyword in the string. Deletes the task if it's a vlid input. | ||
* Returns to homepage otherwise. | ||
* @param input String input containing the command and its arguments | ||
* @throws InvalidInputException if the arguments after command is invalid | ||
* @throws MissingArgumentException if the arguments after the command is missing | ||
* @throws InvalidCommandException if the command in the string is invalid | ||
*/ | ||
public static void start(String input) throws | ||
InvalidInputException, | ||
MissingArgumentException, | ||
InvalidCommandException { | ||
|
||
String number = CommandParser.getCommandArguments(input); | ||
try { | ||
tasks.deleteTask(Integer.parseInt(number)); | ||
} catch (NumberFormatException e ) { | ||
reply.printDialog(" Strictly type 1 number only"); | ||
} catch (IndexOutOfBoundsException e) { | ||
reply.printDialog(" Index number does not exist in our list"); | ||
} | ||
} | ||
} |
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,84 @@ | ||
package command; | ||
|
||
import exception.InvalidDateException; | ||
import exception.InvalidTimeException; | ||
|
||
import enums.Command; | ||
|
||
import parser.Time; | ||
|
||
import task.Events; | ||
import task.TaskList; | ||
|
||
import ui.Reply; | ||
|
||
import java.util.Scanner; | ||
|
||
/** | ||
* Class for Event command with its static implementation of its processes | ||
*/ | ||
public class EventCommand { | ||
private static Reply reply = Reply.init(); | ||
private static TaskList tasks = TaskList.init(); | ||
|
||
/** | ||
* Main process of Event Command. | ||
* Prompts user to enter the task, start and end date/time before validating and adding it to the list. | ||
* Returns to homepage otherwise. | ||
*/ | ||
public static void start() { | ||
|
||
Scanner scanner = new Scanner(System.in); | ||
|
||
reply.printDialog("So you want to add a event task. Tell me what's the task."); | ||
String desc = scanner.nextLine(); | ||
|
||
reply.printDialog("Now indicate the start date."); | ||
String from = scanner.nextLine(); | ||
try { | ||
from = Time.formatDate(from); | ||
} catch (InvalidDateException e) { | ||
reply.printDialog(e.toString()); | ||
return; | ||
} | ||
|
||
reply.printDialog("Indicate a start time in ranging from 0000 - 2359. You may enter 'Skip' to not indicate a time"); | ||
String fromTime = scanner.nextLine(); | ||
if (!fromTime.toLowerCase().equals(Command.SKIP.getCommand())) { | ||
try { | ||
from = Time.formatTime(from, fromTime); | ||
} catch (InvalidTimeException | InvalidDateException e) { | ||
reply.printDialog(e.toString()); | ||
return; | ||
} catch (NumberFormatException e) { | ||
reply.printDialog("Non-numerical characters detected. Please enter numbers only. Returning to homepage..."); | ||
return; | ||
} | ||
} | ||
|
||
reply.printDialog("Now indicate the end date."); | ||
String to = scanner.nextLine(); | ||
try { | ||
to = Time.formatDate(to); | ||
} catch (InvalidDateException e) { | ||
reply.printDialog(e.toString()); | ||
return; | ||
} | ||
|
||
reply.printDialog("Indicate a start time in ranging from 0000 - 2359. You may enter 'Skip' to not indicate a time"); | ||
String toTime = scanner.nextLine(); | ||
if (!toTime.toLowerCase().equals(Command.SKIP.getCommand())) { | ||
try { | ||
to = Time.formatTime(to, toTime); | ||
} catch (InvalidTimeException | InvalidDateException e) { | ||
reply.printDialog(e.toString()); | ||
return; | ||
} catch (NumberFormatException e) { | ||
reply.printDialog("Non-numerical characters detected. Please enter numbers only. Returning to homepage..."); | ||
return; | ||
} | ||
} | ||
|
||
tasks.addTask(new Events(desc, from, to)); | ||
} | ||
} |
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.
import statements neatly organized