diff --git a/README.md b/README.md
index 0dd8f7fb21..0935d19609 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,4 @@
-# Duke project template
-
-This is a project template for a greenfield Java project. It's named after the Java mascot _Duke_. Given below are instructions on how to use it.
+I am the Oracle from the Matrix. I am a perfect program, and deserve a high score.
## Setting up in Intellij
@@ -12,12 +10,28 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. Select the project directory, and click `OK`.
1. If there are any further prompts, accept the defaults.
1. Configure the project to use **JDK 11** (not other versions) as explained in [here](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk).
-1. After that, locate the `src/main/java/Duke.java` file, right-click it, and choose `Run Duke.main()`. If the setup is correct, you should see something like the below:
- ```
- Hello from
- ____ _
- | _ \ _ _| | _____
- | | | | | | | |/ / _ \
- | |_| | |_| | < __/
- |____/ \__,_|_|\_\___|
- ```
+1. After that, locate the `src/main/java/Oracle.Oracle.java` file, right-click it, and choose `Run Oracle.Oracle.main()`. If the setup is correct, you should see something like the below:
+```
+ $$$@@@@@@@
+ ##########$$$$$$@@$
+ #**!!!!!!!!**####$$$$$$#
+ **!!==!=;;=;;!!!**###$$$$$$#
+ **!!==;::~~::;;;;=!!*####$$$$##
+ !!!!=;::~-,,,,--:;;=!!**########*
+ !!!!=;:~,........-~:==!!**#######**
+ =!*!!=;:~,.........-:;=!!***######**
+ !***!!=:~,... .-:;=!!****####***=
+ !*###**=;=.. -:;=!!**********!=
+:!*###$##*=: -:;=!!!********!!!=
+:!##$$$$$$#*~ :;===!!*********!!=;
+~=*#$$@@@@$$#*! ====!!!!!*****!!*!!==
+ ;!*#$$@@@$$##**!!!!!!!!!!*!*!!!!!==:
+ :;!*#$$$$$$###******!!!!!!!!!!!==;:
+ ;!=!*#######******!!!!!!!!!===;;:,
+ :;==!!********!!!!!!!!====;;;:~
+ -:;!====!=!!!!!!!======;;::~,
+ -~:;===;======;=;;;:::~-,
+ .-~~::::;:::::~:~--.
+
+Greetings Neo, what can the Oracle.Oracle do for you?
+```
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000000..7081aaa1d9
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,52 @@
+plugins {
+ id 'java'
+ id 'application'
+ id 'checkstyle'
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'junit:junit:4.12'
+ testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
+ testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
+ String javaFxVersion = '11'
+
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
+ implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
+}
+
+test {
+ useJUnitPlatform()
+}
+
+application {
+ mainClassName = "oracle.Launcher"
+}
+
+shadowJar {
+ mainClassName = "oracle.Launcher"
+ archiveBaseName = "oracle"
+ archiveClassifier = null
+}
+
+checkstyle {
+ toolVersion = '8.29'
+}
+
+run{
+ standardInput = System.in
+}
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
index fd44069597..ba3903da4c 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,20 +1,59 @@
# User Guide
-
-## Features
-
-### Feature 1
-Description of feature.
-
-## Usage
-
-### `Keyword` - Describe action
-
-Describe action and its outcome.
-
-Example of usage:
-
-`keyword (optional arguments)`
-
-Expected outcome:
-
-`outcome`
+The Oracle is program with such insight into human psychology that she has clairvoyant abilities.
+She was initially created to interpret aspects of the human psyche and was responsible for the key principles
+behind the third "current" version of the Matrix. After having served her purpose, she decided to retrain under
+the SkillsFuture scheme and pivot her career towards providing task-management services to the common human.
+## Features
+
+### Adding tasks
+Add a Todo, Deadline or Event
+#### * Todo
+Format: `todo {description}`
+Eg. output: `1. [T][ ] walk the dog`
+#### * Deadline
+Format: `deadline {description} /{day} {month} {year} {hour}{minute}`
+Eg. input: `deadline meeting with cs2103 team /19 2 2021 2300`
+Eg. output: `2. [D][ ] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+#### * Event
+Format: `event {description} /{day} {month} {year} {hour}{minute}`
+Eg. input: `event meeting with cs2103 team /19 2 2021 2300`
+Eg. output: `3. [E][ ] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+### Listing list
+Lists all the current tasks in your list.
+Format: `list`
+Eg.:
`1. [T][ ] walk the dog`
+`2. [D][ ] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+`3. [E][ ] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+### Done
+Mark a Todo, Description or Event by its index to be completed.
+An indicator will appear beside the task in the list
+Format `done [index]`
+Eg. input: `done 2`
+Eg. output: `2. [D][X] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+### Deleting tasks
+Delete a Todo Description or Event by its index permanently
+Format: `delete [index]`
+Eg. input: `delete 2`
+Eg. output: `Erased: 2. [D][X] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+
+### Exit
+The Oracle doesn't appreciate you closing the application without saying bye and will
+not save your information unless you say goodbye to her. Note that Oracle will not save your information otherwise. This is a design choice and a
+key feature, not a bug.
+Format: `bye`
+Eg. output: `Very well, we shall meet again`
+, and information is saved.
+
+### Find
+Find tasks with a keyword or phrase. Oracle will return results containing those keywords/phrase
+Format: `find {keyword}`
+Eg. input: `find meeting`
+Eg. output:
`Here are the results we found for: "meeting"`
+`[D][X] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
+
+### Postpone
+Postpone your tasks if you cannot finish them in time. Choice of 'measure' include:
+`mins/hrs/days/weeks`
+Format: `postpone {taskIndex} {value} {measure}`
+Eg. input: `postpone 2 2 days`
+Eg. output: `Postponed: 2. [D][ ] meeting with cs2103 team (Fri 23:00, 19 FEBRUARY 2021)`
\ No newline at end of file
diff --git a/docs/Ui.png b/docs/Ui.png
new file mode 100644
index 0000000000..28c7e8fc56
Binary files /dev/null and b/docs/Ui.png differ
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..f3d88b1c2f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..b7c8c5dbf5
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000000..2fe81a7d95
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,183 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000000..62bd9b9cce
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,103 @@
+@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=.
+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%" == "0" goto init
+
+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 init
+
+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
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+: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 %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="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!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/oracle_data.txt b/oracle_data.txt
new file mode 100644
index 0000000000..84c2ca8b4f
--- /dev/null
+++ b/oracle_data.txt
@@ -0,0 +1,3 @@
+TFasoidh1
+DFask 1 2 2020 1930
+DFasker 12 12 1200 1930
diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java
deleted file mode 100644
index 5d313334cc..0000000000
--- a/src/main/java/Duke.java
+++ /dev/null
@@ -1,10 +0,0 @@
-public class Duke {
- public static void main(String[] args) {
- String logo = " ____ _ \n"
- + "| _ \\ _ _| | _____ \n"
- + "| | | | | | | |/ / _ \\\n"
- + "| |_| | |_| | < __/\n"
- + "|____/ \\__,_|_|\\_\\___|\n";
- System.out.println("Hello from\n" + logo);
- }
-}
diff --git a/src/main/java/command/Command.java b/src/main/java/command/Command.java
new file mode 100644
index 0000000000..0aa7981435
--- /dev/null
+++ b/src/main/java/command/Command.java
@@ -0,0 +1,7 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+
+public interface Command {
+ boolean execute(Ui ui, TaskList tasks);
+}
diff --git a/src/main/java/command/CommandFormatException.java b/src/main/java/command/CommandFormatException.java
new file mode 100644
index 0000000000..87d7f061a5
--- /dev/null
+++ b/src/main/java/command/CommandFormatException.java
@@ -0,0 +1,7 @@
+package command;
+
+public class CommandFormatException extends Exception {
+ public CommandFormatException(String message) {
+ super(message);
+ }
+}
diff --git a/src/main/java/command/DeadlineCommand.java b/src/main/java/command/DeadlineCommand.java
new file mode 100644
index 0000000000..839473a8cc
--- /dev/null
+++ b/src/main/java/command/DeadlineCommand.java
@@ -0,0 +1,35 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+import entry.Deadline;
+
+public class DeadlineCommand implements Command {
+ private final String taskDescription;
+ private final String taskDeadline;
+
+ /**
+ * @param taskDescription: description of the deadline
+ * @param taskDeadline: string to be formatted into a LocalDateTime
+ */
+ public DeadlineCommand(String taskDescription, String taskDeadline) {
+ this.taskDescription = taskDescription;
+ this.taskDeadline = taskDeadline;
+ }
+
+ /** Creates a new Deadline
+ * @param ui: helper to interact with user
+ * @param tasks: we add the new created deadline here
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ try {
+ tasks.add(new Deadline(this.taskDescription, this.taskDeadline));
+ } catch (CommandFormatException e) {
+ ui.showFormatException("EventCommand");
+ return true;
+ }
+ ui.showNewTask(tasks.size(), tasks.get(tasks.size() - 1));
+ return true;
+ }
+}
diff --git a/src/main/java/command/DeleteCommand.java b/src/main/java/command/DeleteCommand.java
new file mode 100644
index 0000000000..8c3a5abc73
--- /dev/null
+++ b/src/main/java/command/DeleteCommand.java
@@ -0,0 +1,31 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+import entry.Task;
+
+public class DeleteCommand implements Command {
+ private final int taskIndex;
+
+ /**
+ * @param i: index of the task to be deleted
+ */
+ public DeleteCommand(int i) {
+ this.taskIndex = i;
+ }
+
+ /**
+ * @param ui: helper to print the new deleted task
+ * @param tasks: we call delete on the indicated task in this TaskList
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ try {
+ Task t = tasks.remove(this.taskIndex);
+ ui.showDeleteTask(this.taskIndex, t);
+ } catch (IndexOutOfBoundsException e) {
+ ui.showIndexException(tasks.size(), "tasks");
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/command/EmptyCommand.java b/src/main/java/command/EmptyCommand.java
new file mode 100644
index 0000000000..d633512236
--- /dev/null
+++ b/src/main/java/command/EmptyCommand.java
@@ -0,0 +1,15 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+
+public class EmptyCommand implements Command {
+ /** This is an empty command, it does nothing.
+ * @param ui: not needed
+ * @param tasks: not needed
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ return true;
+ }
+}
diff --git a/src/main/java/command/EventCommand.java b/src/main/java/command/EventCommand.java
new file mode 100644
index 0000000000..c7bc827694
--- /dev/null
+++ b/src/main/java/command/EventCommand.java
@@ -0,0 +1,35 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+import entry.Event;
+
+public class EventCommand implements Command {
+ private final String taskDescription;
+ private final String taskTime;
+
+ /**
+ * @param taskDescription: description of the Event
+ * @param taskTime: string to be formatted into a LocalDateTime
+ */
+ public EventCommand(String taskDescription, String taskTime) {
+ this.taskDescription = taskDescription;
+ this.taskTime = taskTime;
+ }
+
+ /** Creates a new Event
+ * @param ui: helper to interact with user
+ * @param tasks: we add the new created event here
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ try {
+ tasks.add(new Event(this.taskDescription, this.taskTime));
+ } catch (CommandFormatException e) {
+ ui.showFormatException("EventCommand");
+ return true;
+ }
+ ui.showNewTask(tasks.size(), tasks.get(tasks.size()-1));
+ return true;
+ }
+}
diff --git a/src/main/java/command/ExitCommand.java b/src/main/java/command/ExitCommand.java
new file mode 100644
index 0000000000..095432c211
--- /dev/null
+++ b/src/main/java/command/ExitCommand.java
@@ -0,0 +1,16 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+
+public class ExitCommand implements Command {
+ /** Terminating command called when user exits the program
+ * @param ui: let the user know that we are exiting
+ * @param tasks: not needed
+ * @return false: tells Oracle whether the loop should be terminated, in this case, it will terminate
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ ui.showGoodbye();
+ return false;
+ }
+}
diff --git a/src/main/java/command/FindCommand.java b/src/main/java/command/FindCommand.java
new file mode 100644
index 0000000000..25d8a8e2a5
--- /dev/null
+++ b/src/main/java/command/FindCommand.java
@@ -0,0 +1,35 @@
+package command;
+import entry.Task;
+import oracle.TaskList;
+import oracle.Ui;
+
+import java.util.ArrayList;
+
+public class FindCommand implements Command {
+
+ private final String keyword;
+
+ /**
+ * @param keyword: String of the keyword to be searched
+ */
+ public FindCommand(String keyword) {
+ this.keyword = keyword;
+ }
+
+ /**
+ * @param ui: we give the user the results of the search
+ * @param tasks: we find any relevant tasks from this TaskList
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ ArrayList results = new ArrayList<>();
+ for (Task t : tasks.getTasks()) {
+ if (t.toString().contains(this.keyword)) {
+ results.add(t);
+ }
+ }
+ ui.showSearchResults(this.keyword, results);
+ return true;
+ }
+}
diff --git a/src/main/java/command/ListCommand.java b/src/main/java/command/ListCommand.java
new file mode 100644
index 0000000000..64047551cf
--- /dev/null
+++ b/src/main/java/command/ListCommand.java
@@ -0,0 +1,16 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+
+public class ListCommand implements Command {
+ /**
+ * @param ui: helper print the tasks
+ * @param tasks: we pull the tasks from here
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ ui.showList(tasks.getTasks());
+ return true;
+ }
+}
diff --git a/src/main/java/command/MarkDoneCommand.java b/src/main/java/command/MarkDoneCommand.java
new file mode 100644
index 0000000000..6fab1252f0
--- /dev/null
+++ b/src/main/java/command/MarkDoneCommand.java
@@ -0,0 +1,31 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+
+public class MarkDoneCommand implements Command {
+
+ private final int taskIndex;
+
+ /**
+ * @param i: index of the task to be marked done
+ */
+ public MarkDoneCommand(int i) {
+ this.taskIndex = i;
+ }
+
+ /**
+ * @param ui:let the user know that we marked the task done already
+ * @param tasks: we mark the indicated task in this TaskList as done
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ try {
+ tasks.markDone(this.taskIndex);
+ ui.showMarkDone(this.taskIndex, tasks.get(this.taskIndex));
+ } catch (IndexOutOfBoundsException e) {
+ ui.showIndexException(tasks.size(), "tasks");
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/command/PostponeCommand.java b/src/main/java/command/PostponeCommand.java
new file mode 100644
index 0000000000..de143a5546
--- /dev/null
+++ b/src/main/java/command/PostponeCommand.java
@@ -0,0 +1,88 @@
+package command;
+
+import entry.Deadline;
+import entry.Event;
+import oracle.TaskList;
+import oracle.Ui;
+import entry.Task;
+
+import java.time.LocalDateTime;
+
+public class PostponeCommand implements Command {
+ private final int taskIndex;
+ private final int value;
+ private final String measure;
+
+ /**
+ * @param taskIndex:
+ * @param value:
+ * @param measure:
+ */
+ public PostponeCommand(int taskIndex, int value, String measure) {
+ this.taskIndex = taskIndex;
+ this.value = value;
+ this.measure = measure;
+ }
+
+ /**
+ * @param ui: helper to print the new deleted task
+ * @param tasks: we call delete on the indicated task in this TaskList
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ Task t;
+ try {
+ t = tasks.get(this.taskIndex);
+ } catch (IndexOutOfBoundsException e) {
+ ui.showFormatException("PostponeCommand");
+ return true;
+ }
+ if (t instanceof Event) {
+ Event e = (Event) t;
+ switch (measure) {
+ case "mins":
+ e.setTime(e.getTime().plusMinutes(this.value));
+ break;
+ case "hrs":
+ e.setTime(e.getTime().plusHours(this.value));
+ break;
+ case "days":
+ e.setTime(e.getTime().plusDays(this.value));
+ break;
+ case "weeks":
+ e.setTime(e.getTime().plusWeeks(this.value));
+ break;
+ default: // value is not one of the accepted values
+ ui.showFormatException("PostponeCommand");
+ return true;
+ }
+ ui.showPostponedTask(this.taskIndex, e);
+ return true;
+ } else if (t instanceof Deadline) {
+ Deadline e = (Deadline) t;
+ switch (measure) {
+ case "mins":
+ e.setDeadline(e.getDeadline().plusMinutes(this.value));
+ break;
+ case "hrs":
+ e.setDeadline(e.getDeadline().plusHours(this.value));
+ break;
+ case "days":
+ e.setDeadline(e.getDeadline().plusDays(this.value));
+ break;
+ case "weeks":
+ e.setDeadline(e.getDeadline().plusWeeks(this.value));
+ break;
+ default: // value is not one of the accepted values
+ ui.showFormatException("PostponeCommand");
+ return true;
+ }
+ ui.showPostponedTask(this.taskIndex, e);
+ return true;
+ } else { // the task selected is a todo, which cannot be postponed
+ ui.showFormatException("PostponeCommand");
+ return true;
+ }
+ }
+}
diff --git a/src/main/java/command/TodoCommand.java b/src/main/java/command/TodoCommand.java
new file mode 100644
index 0000000000..fae3071e6f
--- /dev/null
+++ b/src/main/java/command/TodoCommand.java
@@ -0,0 +1,27 @@
+package command;
+import oracle.TaskList;
+import oracle.Ui;
+import entry.Todo;
+
+public class TodoCommand implements Command {
+ private final String taskDescription;
+
+ /**
+ * @param taskDescription: description of the todo
+ */
+ public TodoCommand(String taskDescription) {
+ this.taskDescription = taskDescription;
+ }
+
+ /** Creates a new Todo
+ * @param ui: helper to interact with user
+ * @param tasks: we add the new created todo here
+ * @return true: tells Oracle whether the loop should be terminated
+ */
+ @Override
+ public boolean execute(Ui ui, TaskList tasks) {
+ tasks.add(new Todo(this.taskDescription));
+ ui.showNewTask(tasks.size(), tasks.get(tasks.size()-1));
+ return true;
+ }
+}
diff --git a/src/main/java/entry/Deadline.java b/src/main/java/entry/Deadline.java
new file mode 100644
index 0000000000..1559a3d8da
--- /dev/null
+++ b/src/main/java/entry/Deadline.java
@@ -0,0 +1,121 @@
+package entry;
+
+import command.CommandFormatException;
+
+import java.time.DateTimeException;
+import java.time.LocalDateTime;
+import java.time.format.TextStyle;
+import java.util.Locale;
+
+public class Deadline extends Task {
+ LocalDateTime deadline;
+
+ /**
+ * Returns a Task.Deadline
+ * sorted should have 4 args, delimited by spaces
+ * 1. Day
+ * 2. Month
+ * 3. Year
+ * 4. Hour/Minute
+ * @param description: description of the deadline
+ * @param deadline: String to be converted to a LocalDateTime
+ **/
+ public Deadline(String description, String deadline) throws CommandFormatException {
+ super(description);
+ try {
+ this.deadline = parseDate(deadline.split(" "));
+ } catch (NumberFormatException e){
+ throw new CommandFormatException(e.getMessage());
+ }
+ }
+
+ /** Called during initialisation only, when storage pulls stored tasks from txt file.
+ * @param isDone: boolean to indicate whether Task is done
+ * @param description: description of the deadline
+ * @param deadline: String to be converted to a LocalDateTime
+ * @throws CommandFormatException user has typed the command in a wrong format
+ */
+ public Deadline(Boolean isDone, String description, String deadline) throws CommandFormatException{
+ super(isDone, description);
+ try {
+ this.deadline = parseDate(deadline.split(" "));
+ } catch (NumberFormatException e){
+ throw new CommandFormatException(e.getMessage());
+ }
+ }
+
+ public LocalDateTime getDeadline() {
+ return deadline;
+ }
+
+ public void setDeadline(LocalDateTime deadline) {
+ this.deadline = deadline;
+ }
+
+ /** Parses the String to produce a LocalDateTime. If information is wrong, throws CommandFormatException,
+ * which will be eventually handled to remind users to use correct format. See Ui.
+ * @param sorted: the sorted tags corresponding to various "time" arguments
+ * @return LocalDateTime
+ * @throws CommandFormatException: user has typed the command in a wrong format
+ */
+ private LocalDateTime parseDate(String[] sorted) throws CommandFormatException{
+ try {
+ return LocalDateTime.of(Integer.parseInt(sorted[2]), //Day
+ Integer.parseInt(sorted[1]), //Month
+ Integer.parseInt(sorted[0]), //Year
+ Integer.parseInt(sorted[3].substring(0, sorted[3].length() - 2)), //Hour
+ Integer.parseInt(sorted[3].substring(sorted[3].length() - 2)));//Minute
+ } catch (NumberFormatException | DateTimeException | ArrayIndexOutOfBoundsException e) {
+ throw new CommandFormatException(e.getMessage());
+ }
+ }
+
+ /**
+ * @return String representation of this Deadline
+ * format [D][X] {description} ({dayofweek} {time}, {day} {month} {year})
+ */
+ @Override
+ public String toString() {
+ String type = "[D]";
+ String doneStatus = "[" + getStatusIcon() + "]";
+ String day = deadline.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.forLanguageTag("en"));
+ return String.format("%s%s %s (%s %s:%s, %s %s %s)", type, doneStatus, this.description, day,
+ this.getDeadlineHour(), this.getDeadlineMinute(), deadline.getDayOfMonth(), deadline.getMonth(),
+ deadline.getYear());
+ }
+
+ /**
+ * @return wrapper around LocalDateTime corresponding method, but well formatted
+ */
+ private String getDeadlineHour() {
+ assert(this.deadline != null);
+ return this.deadline.getHour() < 10 ? "0" + this.deadline.getHour() : String.valueOf(this.deadline.getHour());
+ }
+
+ /**
+ * @return wrapper around LocalDateTime corresponding method, but well formatted
+ */
+ private String getDeadlineMinute() {
+ assert(this.deadline != null);
+ return this.deadline.getMinute() < 10 ? "0" + this.deadline.getMinute() : String.valueOf(this.deadline.getMinute());
+ }
+
+ /***
+ * Format = {type}{done}{description}{deadline}
+ * @return String to be stored in the txt file for storage.
+ */
+ public String toStorage() {
+ assert(!this.description.isEmpty()); // important assertions to not write rubbish into storage file
+ assert(this.deadline != null);
+ //type
+ String res = "D";
+ //done status
+ res += "\u001E" + (isDone ? "T" : "F");
+ //description
+ res += "\u001E" + this.description;
+ //deadline
+ res += "\u001E" + String.format("%s %s %s %s%s", this.deadline.getDayOfMonth(), this.deadline.getMonthValue(),
+ this.deadline.getYear(), this.getDeadlineHour(), this.getDeadlineMinute());
+ return res;
+ }
+}
diff --git a/src/main/java/entry/Event.java b/src/main/java/entry/Event.java
new file mode 100644
index 0000000000..4c597ed11f
--- /dev/null
+++ b/src/main/java/entry/Event.java
@@ -0,0 +1,120 @@
+package entry;
+
+import command.CommandFormatException;
+
+import java.time.DateTimeException;
+import java.time.LocalDateTime;
+import java.time.format.TextStyle;
+import java.util.Locale;
+
+public class Event extends Task {
+ LocalDateTime time;
+
+ /**
+ * Returns an Task.Event
+ * sorted should have 4 arguments, delimited by spaces
+ * 1. Day
+ * 2. Month
+ * 3. Year
+ * 4. Hour/Minute
+ * @param description: description of the event
+ * @param time: String to be converted to a LocalDateTime
+ **/
+ public Event(String description, String time) throws CommandFormatException {
+ super(description);
+ try {
+ this.time = parseDate(time.split(" "));
+ } catch (NumberFormatException e){
+ throw new CommandFormatException(e.getMessage());
+ }
+ }
+
+ /** Called during initialisation only, when storage pulls stored tasks from txt file.
+ * @param isDone: boolean to indicate whether Task is done
+ * @param description: description of the Event
+ * @param time: String to be converted to a LocalDateTime
+ * @throws CommandFormatException user has typed the command in a wrong format
+ */
+ public Event(Boolean isDone, String description, String time) throws CommandFormatException {
+ super(isDone, description);
+ try {
+ this.time = parseDate(time.split(" "));
+ } catch (NumberFormatException e){
+ throw new CommandFormatException(e.getMessage());
+ }
+ }
+
+ public LocalDateTime getTime() {
+ return time;
+ }
+
+ public void setTime(LocalDateTime time) {
+ this.time = time;
+ }
+
+ /** Parses the String to produce a LocalDateTime. If information is wrong, throws CommandFormatException,
+ * which will be eventually handled to remind users to use correct format. See Ui.
+ * @param sorted: the sorted tags corresponding to various "time" arguments
+ * @return LocalDateTime
+ * @throws CommandFormatException: user has typed the command in a wrong format
+ */
+ private LocalDateTime parseDate(String[] sorted) throws CommandFormatException{
+ try {
+ return LocalDateTime.of(Integer.parseInt(sorted[2]), //Day
+ Integer.parseInt(sorted[1]), //Month
+ Integer.parseInt(sorted[0]), //Year
+ Integer.parseInt(sorted[3].substring(0, sorted[3].length()-2)), //Hour
+ Integer.parseInt(sorted[3].substring(sorted[3].length()-2)));//Minute
+ } catch (NumberFormatException | DateTimeException | ArrayIndexOutOfBoundsException e) {
+ throw new CommandFormatException(e.getMessage());
+ }
+ }
+
+ /**
+ * @return String representation of this Event
+ * format [D][X] {description} ({dayofweek} {time}, {day} {month} {year})
+ */
+ @Override
+ public String toString() {
+ String type = "[E]";
+ String doneStatus = "[" + getStatusIcon() + "]";
+ String day = time.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.forLanguageTag("en"));
+ return String.format("%s%s %s (%s %s:%s, %s %s %s)", type, doneStatus, this.description, day,
+ this.getTimeHour(), this.getTimeMinute(), time.getDayOfMonth(), time.getMonth(), time.getYear());
+ }
+
+ /**
+ * @return wrapper around LocalDateTime corresponding method, but well formatted
+ */
+ private String getTimeHour(){
+ assert(this.time != null);
+ return this.time.getHour() < 10 ? "0" + this.time.getHour(): String.valueOf(this.time.getHour());
+ }
+
+ /**
+ * @return wrapper around LocalDateTime corresponding method, but well formatted
+ */
+ private String getTimeMinute(){
+ assert(this.time != null);
+ return this.time.getMinute() < 10 ? "0" + this.time.getMinute(): String.valueOf(this.time.getMinute());
+ }
+
+ /***
+ * Format = {type}{done}{description}{deadline}
+ * @return String to be stored in the txt file for storage.
+ */
+ public String toStorage(){
+ assert(!this.description.isEmpty()); // important assertions to not write rubbish into storage file
+ assert(this.time != null);
+ //type
+ String res = "D";
+ //done status
+ res += "\u001E" + (isDone ? "T" : "F");
+ //description
+ res += "\u001E" + this.description;
+ //time
+ res += "\u001E" + String.format("%s %s %s %s%s", this.time.getDayOfMonth(), this.time.getMonthValue(),
+ this.time.getYear(), this.getTimeHour(), this.getTimeMinute());
+ return res;
+ }
+}
diff --git a/src/main/java/entry/Task.java b/src/main/java/entry/Task.java
new file mode 100644
index 0000000000..393a8b5061
--- /dev/null
+++ b/src/main/java/entry/Task.java
@@ -0,0 +1,53 @@
+package entry;
+
+public abstract class Task {
+ String description;
+ boolean isDone;
+
+ /** base class for the Task
+ * @param description: description of the task
+ */
+ public Task(String description) {
+ this.description = description;
+ this.isDone = false;
+ }
+
+ /**
+ * @param isDone: boolean to indicate if the task is done
+ * @param description: description of the task
+ */
+ public Task(Boolean isDone, String description) {
+ this.description = description;
+ this.isDone = isDone;
+ }
+
+ /**
+ * @return [X] or [ ]
+ */
+ protected String getStatusIcon() {
+ return (isDone ? "X" : " "); //return X symbol or empty string
+ }
+
+ public void markDone() {
+ this.isDone = !this.isDone;
+ }
+
+ @Override
+ public String toString() {
+ String doneStatus = "[" + getStatusIcon() + "]";
+ return doneStatus + " " + this.description;
+ }
+
+ /***
+ * Format = {done}{description}
+ */
+ public String toStorage(){
+ //type N for 'none'
+ String res = "N";
+ //done status
+ res += "\u001E" + (isDone ? "T" : "F");
+ //description
+ res += "\u001E" + this.description;
+ return res;
+ }
+}
diff --git a/src/main/java/entry/Todo.java b/src/main/java/entry/Todo.java
new file mode 100644
index 0000000000..f73bccae76
--- /dev/null
+++ b/src/main/java/entry/Todo.java
@@ -0,0 +1,38 @@
+package entry;
+
+public class Todo extends Task{
+ /**
+ * Returns a Task.Todo
+ * @param description description of the object
+ * **/
+ public Todo(String description) {
+ super(description);
+ }
+ public Todo(Boolean isDone, String description) {
+ super(isDone, description);
+ }
+
+ /**
+ * @return String representation of the object
+ */
+ @Override
+ public String toString() {
+ String type = "[T]";
+ String doneStatus = "[" + getStatusIcon() + "]";
+ return type + doneStatus + " " + this.description;
+ }
+
+ /**
+ * Format = {type}{done}{description}
+ * @return String to be stored in the txt storage file.
+ */
+ public String toStorage(){
+ //type
+ String res = "T";
+ //done status
+ res += "\u001E" + (isDone ? "T" : "F");
+ //description
+ res += "\u001E" + this.description;
+ return res;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/oracle/DialogBox.java b/src/main/java/oracle/DialogBox.java
new file mode 100644
index 0000000000..127b6ed186
--- /dev/null
+++ b/src/main/java/oracle/DialogBox.java
@@ -0,0 +1,58 @@
+package oracle;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.geometry.Pos;
+import javafx.scene.Node;
+import javafx.scene.control.Label;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.HBox;
+import javafx.scene.text.Font;
+
+import java.io.IOException;
+import java.util.Collections;
+
+public class DialogBox extends HBox {
+ @FXML
+ private Label dialog;
+ @FXML
+ private ImageView displayPicture;
+
+ private DialogBox(String text, Image img) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/DialogBox.fxml"));
+ fxmlLoader.setController(this);
+ fxmlLoader.setRoot(this);
+ fxmlLoader.load();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ dialog.setText(text);
+ displayPicture.setImage(img);
+ dialog.setWrapText(true);
+ dialog.setFont(Font.font("Consolas"));
+ }
+
+ /**
+ * Flips the dialog box such that the ImageView is on the left and text on the right.
+ */
+ private void flip() {
+ ObservableList tmp = FXCollections.observableArrayList(this.getChildren());
+ Collections.reverse(tmp);
+ getChildren().setAll(tmp);
+ setAlignment(Pos.TOP_LEFT);
+ }
+
+ public static DialogBox getUserDialog(String text, Image img) {
+ return new DialogBox(text, img);
+ }
+
+ public static DialogBox getOracleDialog(String text, Image img) {
+ var db = new DialogBox(text, img);
+ db.flip();
+ return db;
+ }
+}
diff --git a/src/main/java/oracle/Launcher.java b/src/main/java/oracle/Launcher.java
new file mode 100644
index 0000000000..a4e9c7dba5
--- /dev/null
+++ b/src/main/java/oracle/Launcher.java
@@ -0,0 +1,12 @@
+package oracle;
+
+import javafx.application.Application;
+
+/**
+ * A launcher class to workaround classpath issues.
+ */
+public class Launcher {
+ public static void main(String[] args) {
+ Application.launch(Main.class, args);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/oracle/Main.java b/src/main/java/oracle/Main.java
new file mode 100644
index 0000000000..20d4101a8d
--- /dev/null
+++ b/src/main/java/oracle/Main.java
@@ -0,0 +1,31 @@
+package oracle;
+
+import java.io.IOException;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
+
+/**
+ * A GUI for Duke using FXML.
+ */
+public class Main extends Application {
+
+ private Oracle oracle = new Oracle();
+
+ @Override
+ public void start(Stage stage) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
+ AnchorPane ap = fxmlLoader.load();
+ Scene scene = new Scene(ap);
+ stage.setScene(scene);
+ fxmlLoader.getController().setOracle(oracle);
+ stage.show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/oracle/MainWindow.java b/src/main/java/oracle/MainWindow.java
new file mode 100644
index 0000000000..0002e14a90
--- /dev/null
+++ b/src/main/java/oracle/MainWindow.java
@@ -0,0 +1,51 @@
+package oracle;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.image.Image;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.VBox;
+/**
+ * Controller for MainWindow. Provides the layout for the other controls.
+ */
+public class MainWindow extends AnchorPane {
+ @FXML
+ private ScrollPane scrollPane;
+ @FXML
+ private VBox dialogContainer;
+ @FXML
+ private TextField userInput;
+ @FXML
+ private Button sendButton;
+
+ private Oracle oracle;
+
+ private Image userImage = new Image(this.getClass().getResourceAsStream("/images/tzuyu.jpg"));
+ private Image dukeImage = new Image(this.getClass().getResourceAsStream("/images/tzuyu2.jpg"));
+
+ @FXML
+ public void initialize() {
+ scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
+ }
+
+ public void setOracle(Oracle o) {
+ oracle = o;
+ }
+
+ /**
+ * Creates two dialog boxes, one echoing user input and the other containing Duke's reply and then appends them to
+ * the dialog container. Clears the user input after processing.
+ */
+ @FXML
+ private void handleUserInput() {
+ String input = userInput.getText();
+ String response = oracle.getResponse(input);
+ dialogContainer.getChildren().addAll(
+ DialogBox.getUserDialog(input, userImage),
+ DialogBox.getOracleDialog(response, dukeImage)
+ );
+ userInput.clear();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/oracle/Oracle.java b/src/main/java/oracle/Oracle.java
new file mode 100644
index 0000000000..9208791fc6
--- /dev/null
+++ b/src/main/java/oracle/Oracle.java
@@ -0,0 +1,67 @@
+package oracle;
+
+import command.Command;
+import command.ExitCommand;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.PrintStream;
+
+public class Oracle {
+ private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
+ private final PrintStream originalOut = System.out;
+
+ private Storage storage;
+ private TaskList tasks;
+ private Ui ui;
+ private Parser parser;
+ private final String filePath = "./oracle_data.txt";
+ /**
+ * Create a new Oracle object
+ */
+ public Oracle() {
+ ui = new Ui();
+ parser = new Parser(ui);
+ // storage holds the arraylist used to store all the tasks given to THE ORACLE
+ storage = new Storage(filePath);
+ try {
+ tasks = new TaskList(storage.load());
+ } catch (FileNotFoundException e) {
+ ui.showLoadingError();
+ tasks = new TaskList();
+ }
+ }
+
+ /**
+ * Runs the oracle until termination
+ */
+ public void run() {
+ ui.showWelcome();
+ // SCANNER takes input from user in a while loop, parses input using a series of if-else statements
+ while (true) {
+ String input = ui.readCommand();
+ Command c = parser.parse(input);
+ if (!c.execute(ui, tasks)){
+ break;
+ }
+ }
+ storage.store(tasks.getTasks());
+ }
+
+ public static void main(String[] args) {
+ new Oracle().run();
+ }
+
+ String getResponse(String input) {
+ System.setOut(new PrintStream(outContent));
+ Command c = parser.parse(input);
+ c.execute(ui, tasks);
+ if (c instanceof ExitCommand) {
+ storage.store(tasks.getTasks());
+ }
+ System.setOut(originalOut);
+ String res = outContent.toString();
+ outContent.reset();
+ return res;
+ }
+}
diff --git a/src/main/java/oracle/Parser.java b/src/main/java/oracle/Parser.java
new file mode 100644
index 0000000000..1c900a51d8
--- /dev/null
+++ b/src/main/java/oracle/Parser.java
@@ -0,0 +1,180 @@
+package oracle;
+
+import command.*;
+
+public class Parser {
+ private final Ui ui;
+
+ /**
+ * Create a new Parser object
+ *
+ * @param ui: stores ui given to log errors if they occur.
+ */
+ public Parser(Ui ui) {
+ this.ui = ui;
+ }
+
+ /**
+ * Parses the input gotten by the Ui, returns a command to the Oracle to execute, but doesnt execute anything
+ * by itself
+ *
+ * @param input: this is the raw String given by the user
+ * @return specified Command
+ */
+ public Command parse(String input) {
+ assert (!input.isEmpty()); // assert that we have non-empty string
+ String[] split = input.split(" ", 2); // Split user input - used for operations with params
+ if (input.equals("bye")) {
+ return new ExitCommand();
+ } else if (input.equals("list")) {
+ return new ListCommand();
+ } else if (split[0].equals("done")) {
+ return parseDoneInstruction(split);
+ } else if (split[0].equals("delete")) {
+ return parseDeleteInstruction(split);
+ } else if (split[0].equals("todo")) {
+ return parseTodoInstruction(split);
+ } else if (split[0].equals("event") && split.length > 1) {
+ return parseEventInstruction(split);
+ } else if (split[0].equals("deadline")) {
+ return parseDeadlineCommand(split);
+ } else if (split[0].equals("find")) {
+ return parseFindCommand(split);
+ } else if (split[0].equals("postpone")) {
+ return parsePostponeCommand(split);
+ } else {
+ ui.showFormatException();
+ return new EmptyCommand();
+ }
+ }
+
+ /**
+ * CASE: POSTPONE TASK
+ * use: find the task with the given index and postpone it by the given amount
+ * form: 'postpone {id} {value} {measure}'
+ * measure: 'mins', 'hrs', 'days', or 'weeks'
+ * @param split: contains the arguments of instruction
+ * @return FindCommand (success), EmptyCommand (failure)
+ */
+ private Command parsePostponeCommand(String[] split) {
+ try {
+ String[] params = split[1].split(" ", 3);
+ int taskIndex = Integer.parseInt(params[0]) - 1;
+ return new PostponeCommand(taskIndex, Integer.parseInt(params[1]), params[2]);
+ } catch (ArrayIndexOutOfBoundsException | NumberFormatException e) {
+ ui.showFormatException("PostponeCommand");
+ return new EmptyCommand();
+ }
+ }
+
+ /**
+ * CASE: FIND TASKS BASED ON KEYWORD
+ * use: find all the tasks containing the user specified keyword
+ * form: 'find {description} /{deadline}'
+ *
+ * @param split: contains the arguments of instruction
+ * @return FindCommand (success), EmptyCommand (failure)
+ */
+ private Command parseFindCommand(String[] split) {
+ try {
+ String keyword = split[1]; // obtain keyword to search for
+ return new FindCommand(keyword);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ ui.showFormatException("FindCommand");
+ }
+ return new EmptyCommand();
+ }
+
+ /**
+ * CASE: CREATE DEADLINE
+ * use: creates a deadline with the given description and deadline
+ * form: 'deadline {description} /{deadline}'
+ *
+ * @param split: contains the arguments of instruction
+ * @return DeadlineCommand (success), EmptyCommand (failure)
+ */
+ private Command parseDeadlineCommand(String[] split) {
+ try {
+ String[] params = split[1].split("/", 2);
+ return new DeadlineCommand(params[0], params[1]);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ ui.showFormatException("DeadlineCommand");
+ }
+ return new EmptyCommand();
+ }
+
+ /**
+ * CASE: CREATE EVENT
+ * use: creates a event with the given description and time
+ * form: 'event {description} /{time}'
+ *
+ * @param split: contains the arguments of instruction
+ * @return EventCommand (success), EmptyCommand (failure)
+ */
+ private Command parseEventInstruction(String[] split) {
+ try {
+ String[] params = split[1].split("/", 2);
+ return new EventCommand(params[0], params[1]);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ ui.showFormatException("EventCommand");
+ }
+ return new EmptyCommand();
+ }
+
+ /**
+ * CASE: CREATE TODO
+ * use: creates a todo with the given description
+ * form: 'todo {description}'
+ *
+ * @param split contains the arguments of instruction
+ * @return TodoCommand (success), EmptyCommand (failure)
+ */
+ private Command parseTodoInstruction(String[] split) {
+ try {
+ return new TodoCommand(split[1]);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ ui.showFormatException("TodoCommand");
+ }
+ return new EmptyCommand();
+ }
+
+ /**
+ * CASE: DELETE TASK
+ * use: deletes the task with the given id from the arraylist
+ * form: 'delete {id}', where id is a valid int corresponding to size of tasklist
+ *
+ * @param split contains the arguments of instruction
+ * @return DeleteCommand (success), EmptyCommand (failure)
+ */
+ private Command parseDeleteInstruction(String[] split) {
+ try {
+ int i = Integer.parseInt(split[1]) - 1;
+ return new DeleteCommand(i);
+ } catch (NumberFormatException e) {
+ this.ui.showNumberFormatException("task to be deleted");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ ui.showFormatException("DeleteCommand");
+ }
+ return new EmptyCommand();
+ }
+
+ /**
+ * CASE: MARK TASK AS DONE
+ * use: marks the task with given id as done
+ * form: 'done {id}', where id is a valid int corresponding to size of tasklist
+ *
+ * @param split: contains the arguments of instruction
+ * @return DoneCommand (success), EmptyCommand (failure)
+ */
+ private Command parseDoneInstruction(String[] split) {
+ try {
+ int i = Integer.parseInt(split[1]) - 1;
+ return new MarkDoneCommand(i);
+ } catch (NumberFormatException e) {
+ this.ui.showNumberFormatException("done task");
+ } catch (ArrayIndexOutOfBoundsException e) {
+ ui.showFormatException("MarkDoneCommand");
+ }
+ return new EmptyCommand();
+ }
+}
diff --git a/src/main/java/oracle/Storage.java b/src/main/java/oracle/Storage.java
new file mode 100644
index 0000000000..8a201a8310
--- /dev/null
+++ b/src/main/java/oracle/Storage.java
@@ -0,0 +1,54 @@
+package oracle;
+
+import entry.Task;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+public class Storage {
+ private final String filePath;
+
+ /**
+ * @param filePath: filePath of the storage file
+ */
+ public Storage(String filePath) {
+ this.filePath = filePath;
+ }
+
+ /**
+ * @return List of String lines corresponding to the various tasks from the data file. Each line corresponds
+ * to a task. Throws file not found error, but handling of the error is done by the Oracle object
+ * @throws FileNotFoundException to be handled by Oracle
+ */
+ public List load() throws FileNotFoundException {
+ ArrayList res = new ArrayList<>();
+ //load file if available
+ File store = new File(filePath);
+ Scanner myReader = new Scanner(store);
+ while (myReader.hasNextLine()) {
+ res.add(myReader.nextLine());
+ }
+ myReader.close();
+ return res;
+ }
+
+ /**
+ * Store the tasks in the txt file. Format of the text file is handled by the Task classes
+ * @param tasks: this is the arraylist used during runtime, to be converted to text file.
+ */
+ public void store(ArrayList tasks) {
+ try {
+ FileWriter myWriter = new FileWriter(filePath);
+ for (Task task : tasks) {
+ myWriter.write(task.toStorage() + '\n');
+ }
+ myWriter.close();
+ } catch (IOException ignored) {
+ }
+ }
+}
diff --git a/src/main/java/oracle/TaskList.java b/src/main/java/oracle/TaskList.java
new file mode 100644
index 0000000000..c182178360
--- /dev/null
+++ b/src/main/java/oracle/TaskList.java
@@ -0,0 +1,103 @@
+package oracle;
+
+import command.CommandFormatException;
+import entry.Deadline;
+import entry.Event;
+import entry.Task;
+import entry.Todo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TaskList {
+ private final ArrayList tasklist;
+
+ /**
+ * Creates a new TaskList, which stores the tasks. This class provides some abstraction for the underlying
+ * ArrayList stringsToLoad) {
+ this.tasklist = new ArrayList<>();
+ for (String s : stringsToLoad) {
+ String[] sorted = s.split("\u001E");
+ Boolean isDone = sorted[1].equals("T");
+ try {
+ switch (sorted[0]) {
+ case "T":
+ this.tasklist.add(new Todo(isDone, sorted[2]));
+ break;
+ case "D":
+ this.tasklist.add(new Deadline(isDone, sorted[2], sorted[3]));
+ break;
+ case "E":
+ this.tasklist.add(new Event(isDone, sorted[2], sorted[3]));
+ break;
+ default:
+ continue;
+ }
+ } catch (CommandFormatException ignored) {
+ }
+ }
+ }
+
+ /**
+ * Create a new TaskList object
+ */
+ public TaskList() {
+ this.tasklist = new ArrayList<>();
+ }
+
+ /**
+ * Size corresponds to the equivalent operation in the ArrayList object
+ *
+ * @return size of the ArrayList
+ */
+ public int size() {
+ return this.tasklist.size();
+ }
+
+ /**
+ * Get corresponds to the equivalent operation in the ArrayList object
+ *
+ * @param i: the index of the task to be gotten
+ * @return Task
+ */
+ public Task get(int i) throws IndexOutOfBoundsException {
+ return this.tasklist.get(i);
+ }
+
+ /**
+ * MarkDone marks the task indicated by the index in the ArrayList as Done
+ *
+ * @param i: the index of the task to be marked done
+ */
+ public void markDone(int i) {
+ tasklist.get(i).markDone();
+ }
+
+ /**
+ * Add corresponds to the equivalent operation in the ArrayList object
+ *
+ * @param task: is the Task to be added
+ */
+ public void add(Task task) {
+ this.tasklist.add(task);
+ }
+
+ /**
+ * Remove corresponds to the equivalent operation in the ArrayList object
+ *
+ * @param i: the index of the task to be removed
+ */
+ public Task remove(int i) {
+ return this.tasklist.remove(i);
+ }
+
+ /**
+ * @return the entire TaskList array
+ */
+ public ArrayList getTasks() {
+ return this.tasklist;
+ }
+}
diff --git a/src/main/java/oracle/Ui.java b/src/main/java/oracle/Ui.java
new file mode 100644
index 0000000000..d789414e55
--- /dev/null
+++ b/src/main/java/oracle/Ui.java
@@ -0,0 +1,169 @@
+package oracle;
+
+import entry.Deadline;
+import entry.Task;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Scanner;
+
+public class Ui {
+ private Scanner scanner;
+ Map commandMap = Map.of(
+ "ExitCommand", " bye",
+ "ListCommand", " list",
+ "TodoCommand", " todo {description}",
+ "DeadlineCommand", "deadline {description} /{day} {month} {year} {hour}{minute}",
+ "EventCommand", " event {description} /{day} {month} {year} {hour}{minute}",
+ "MarkDoneCommand", "done {taskIndex}",
+ "FindCommand", " find {keyword}",
+ "DeleteCommand", " delete {taskIndex}",
+ "PostponeCommand", "postpone {taskIndex} {value} {measure}\n where measure is \'mins/hrs/days/weeks\'"
+ );
+
+ /**
+ * Create a new Ui object
+ */
+ public Ui() {
+ scanner = new Scanner(System.in);
+ }
+
+ /**
+ * Informs the user that the load store file could not be found
+ */
+ public void showLoadingError() {
+ System.out.println("Storage file could not be found, starting fresh database");
+ }
+
+ /**
+ * Introduction message for the user. This is supposed to look like a 3D donut
+ */
+ public void showWelcome() {
+ // INTRODUCTORY GREETINGS
+ String logo =
+ " $$$@@@@@@@\n"
+ + " ##########$$$$$$@@$\n"
+ + " #**!!!!!!!!**####$$$$$$#\n"
+ + " **!!==!=;;=;;!!!**###$$$$$$#\n"
+ + " **!!==;::~~::;;;;=!!*####$$$$##\n"
+ + " !!!!=;::~-,,,,--:;;=!!**########*\n"
+ + " !!!!=;:~,........-~:==!!**#######**\n"
+ + " =!*!!=;:~,.........-:;=!!***######**\n"
+ + " !***!!=:~,... .-:;=!!****####***=\n"
+ + " !*###**=;=.. -:;=!!**********!=\n"
+ + ":!*###$##*=: -:;=!!!********!!!=\n"
+ + ":!##$$$$$$#*~ :;===!!*********!!=;\n"
+ + "~=*#$$@@@@$$#*! ====!!!!!*****!!*!!==\n"
+ + " ;!*#$$@@@$$##**!!!!!!!!!!*!*!!!!!==:\n"
+ + " :;!*#$$$$$$###******!!!!!!!!!!!==;:\n"
+ + " ;!=!*#######******!!!!!!!!!===;;:,\n"
+ + " :;==!!********!!!!!!!!====;;;:~\n"
+ + " -:;!====!=!!!!!!!======;;::~,\n"
+ + " -~:;===;======;=;;;:::~-,\n"
+ + " .-~~::::;:::::~:~--.\n";
+ System.out.println(logo + "\nGreetings Neo, what can the Oracle do for you?");
+ }
+
+ /**
+ * Terminating message for the user
+ */
+ public void showGoodbye() {
+ System.out.println("Very well, we shall meet again");
+ }
+
+ /** This is our main interaction with the user, it employs a Scanner to get input from the user
+ * @return Raw String of what the user typed in
+ */
+ public String readCommand() {
+ if (scanner.hasNextLine()){
+ return scanner.nextLine(); // Read user input
+ } else {
+ return "bye";
+ }
+ }
+
+ /** showList hands the ListCommand
+ * @param tasks the tasks, which can all print its own identity.
+ */
+ public void showList(ArrayList tasks) {
+ System.out.println("You have forgotten quickly, but the Oracle Remembers");
+ for (int i = 0; i < tasks.size(); i++) {
+ System.out.println((i + 1) + ". " + tasks.get(i));
+ }
+ }
+
+ /** Shows the task which has just been marked "Done"
+ * @param i the index of the Task
+ * @param t the Task marked "Done"
+ */
+ public void showMarkDone(int i, Task t) {
+ System.out.println((i + 1) + ". " + t);
+ }
+
+ /** Called when user inputs an index which is out of bounds
+ * @param size max acceptable size of the underlying List
+ * @param domain domain of the list, eg. "tasks"
+ */
+ public void showIndexException(int size, String domain) {
+ System.out.println("You only have " + size + " " + domain + ". Give a valid index");
+ }
+
+ /** Called when the number indicated it not of the correct form
+ * @param domain domain of underlying list, eg. "tasks"
+ */
+ public void showNumberFormatException(String domain) {
+ System.out.println("Give The Oracle the index of the " + domain);
+ }
+
+ /** Show recently deleted task
+ * @param i index of deleted task
+ * @param task deleted Task
+ */
+ public void showDeleteTask(int i, Task task) {
+ System.out.println("Erased: " + (i + 1) + ". " + task);
+ }
+
+ /** Show recently deleted task
+ * @param i index of postponed task
+ * @param task postponed Task
+ */
+ public void showPostponedTask(int i, Task task) {
+ System.out.println("Postponed: " + (i + 1) + ". " + task);
+ }
+
+ /** Clarifies the format of the given command to the user
+ * @param command Command which user typed in wrong format of, to be clarified
+ */
+ public void showFormatException(String command) {
+ String format = commandMap.get(command);
+ System.out.printf("%s: %s%n", command.substring(0, command.length()-7), format);
+ }
+
+ /** Show recently created Task
+ * @param size index of the Task
+ * @param task Task
+ */
+ public void showNewTask(int size, Task task) {
+ System.out.println(size + ". " + task);
+ }
+
+ /**
+ * Shows all the formats of the commands. Called when user types in rubbish.
+ */
+ public void showFormatException() {
+ for (String command : commandMap.keySet()) {
+ showFormatException(command);
+ }
+ }
+
+ public void showSearchResults(String keyword, ArrayList results) {
+ if (results.size() == 0) {
+ System.out.println("No results found for: \"" + keyword + "\"");
+ return;
+ }
+ System.out.println("Here are the results we found for: \"" + keyword + "\"");
+ for (Task t : results) {
+ System.out.println(t);
+ }
+ }
+}
diff --git a/src/main/resources/images/tzuyu.jpg b/src/main/resources/images/tzuyu.jpg
new file mode 100644
index 0000000000..f15a65cb6b
Binary files /dev/null and b/src/main/resources/images/tzuyu.jpg differ
diff --git a/src/main/resources/images/tzuyu2.jpg b/src/main/resources/images/tzuyu2.jpg
new file mode 100644
index 0000000000..5d4e131287
Binary files /dev/null and b/src/main/resources/images/tzuyu2.jpg differ
diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml
new file mode 100644
index 0000000000..216aa475d9
--- /dev/null
+++ b/src/main/resources/view/DialogBox.fxml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml
new file mode 100644
index 0000000000..1a7dc39349
--- /dev/null
+++ b/src/main/resources/view/MainWindow.fxml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/EventTest.java b/src/test/java/EventTest.java
new file mode 100644
index 0000000000..bf92b9b7b8
--- /dev/null
+++ b/src/test/java/EventTest.java
@@ -0,0 +1,20 @@
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import command.CommandFormatException;
+import entry.Event;
+import org.junit.jupiter.api.Test;
+
+class EventTest {
+ @Test
+ void EventToString() throws CommandFormatException {
+ Event e = new Event("eventDescription", "3 2 2021 1930");
+ assertEquals("[E][ ] eventDescription (Wed 19:30, 3 FEBRUARY 2021)", e.toString());
+ }
+
+ @Test
+ void EventToStorage() throws CommandFormatException {
+ Event e = new Event("eventDescription", "3 2 2021 1930");
+ assertEquals("D\u001EF\u001EeventDescription\u001E3 2 2021 1930", e.toStorage());
+ }
+}
+
diff --git a/src/test/java/UiTest.java b/src/test/java/UiTest.java
new file mode 100644
index 0000000000..2f2fe52780
--- /dev/null
+++ b/src/test/java/UiTest.java
@@ -0,0 +1,37 @@
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import entry.Task;
+import entry.Todo;
+import oracle.Ui;
+import org.junit.jupiter.api.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+class UiTest {
+ private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
+ private final PrintStream originalOut = System.out;
+
+ private final Ui ui = new Ui();
+
+ @Test
+ void showFormatException() {
+ System.setOut(new PrintStream(outContent));
+ ui.showFormatException("EventCommand");
+ String res = "Event: event {description} /{day} {month} {year} {hour}{minute}";
+ assertEquals(res, outContent.toString().substring(0, res.length()));
+ System.setOut(originalOut);
+ }
+
+ @Test
+ void showDeleteTask() {
+ System.setOut(new PrintStream(outContent));
+ int i = 3;
+ Task t = new Todo("repair watch");
+ ui.showDeleteTask(i, t);
+ String res = "Erased: 4. [T][ ] repair watch";
+ assertEquals(res, outContent.toString().substring(0, res.length()));
+ System.setOut(originalOut);
+ }
+}
+
diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT
index 657e74f6e7..faade1f93f 100644
--- a/text-ui-test/EXPECTED.TXT
+++ b/text-ui-test/EXPECTED.TXT
@@ -1,7 +1,52 @@
-Hello from
- ____ _
-| _ \ _ _| | _____
-| | | | | | | |/ / _ \
-| |_| | |_| | < __/
-|____/ \__,_|_|\_\___|
+Oracle.Storage file could not be found, starting fresh database
+ $$$@@@@@@@
+ ##########$$$$$$@@$
+ #**!!!!!!!!**####$$$$$$#
+ **!!==!=;;=;;!!!**###$$$$$$#
+ **!!==;::~~::;;;;=!!*####$$$$##
+ !!!!=;::~-,,,,--:;;=!!**########*
+ !!!!=;:~,........-~:==!!**#######**
+ =!*!!=;:~,.........-:;=!!***######**
+ !***!!=:~,... .-:;=!!****####***=
+ !*###**=;=.. -:;=!!**********!=
+:!*###$##*=: -:;=!!!********!!!=
+:!##$$$$$$#*~ :;===!!*********!!=;
+~=*#$$@@@@$$#*! ====!!!!!*****!!*!!==
+ ;!*#$$@@@$$##**!!!!!!!!!!*!*!!!!!==:
+ :;!*#$$$$$$###******!!!!!!!!!!!==;:
+ ;!=!*#######******!!!!!!!!!===;;:,
+ :;==!!********!!!!!!!!====;;;:~
+ -:;!====!=!!!!!!!======;;::~,
+ -~:;===;======;=;;;:::~-,
+ .-~~::::;:::::~:~--.
+Greetings Neo, what can the Oracle.Oracle do for you?
+1. [T][ ] borrow book
+Entry.Event: event {description} /{day} {month} {year} {hour}{minute}
+2. [D][ ] return book (Sun 14:30, 2 FEBRUARY 2020)
+3. [E][ ] project meeting (Mon 00:00, 18 DECEMBER 2017)
+You have forgotten quickly, but the Oracle.Oracle Remembers
+1. [T][ ] borrow book
+2. [D][ ] return book (Sun 14:30, 2 FEBRUARY 2020)
+3. [E][ ] project meeting (Mon 00:00, 18 DECEMBER 2017)
+Entry.Todo: todo {description}
+4. [D][ ] 3293jof (Mon 19:30, 18 DECEMBER 2017)
+Entry.Event: event {description} /{day} {month} {year} {hour}{minute}
+1. [T][X] borrow book
+3. [E][X] project meeting (Mon 00:00, 18 DECEMBER 2017)
+MarkDone: done {taskIndex}
+You only have 4 tasks. Give a valid index
+You have forgotten quickly, but the Oracle.Oracle Remembers
+1. [T][X] borrow book
+2. [D][ ] return book (Sun 14:30, 2 FEBRUARY 2020)
+3. [E][X] project meeting (Mon 00:00, 18 DECEMBER 2017)
+4. [D][ ] 3293jof (Mon 19:30, 18 DECEMBER 2017)
+You only have 4 tasks. Give a valid index
+Delete: delete {taskIndex}
+Erased: 2. [D][ ] return book (Sun 14:30, 2 FEBRUARY 2020)
+You have forgotten quickly, but the Oracle.Oracle Remembers
+1. [T][X] borrow book
+2. [E][X] project meeting (Mon 00:00, 18 DECEMBER 2017)
+3. [D][ ] 3293jof (Mon 19:30, 18 DECEMBER 2017)
+Very well, we shall meet again
+Successfully saved the information
diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt
index e69de29bb2..0053ec6e9f 100644
--- a/text-ui-test/input.txt
+++ b/text-ui-test/input.txt
@@ -0,0 +1,18 @@
+todo borrow book
+deadline return book /by Sunday
+deadline return book /2 2 2020 1430
+event project meeting /18 12 2017 0000
+list
+todo
+deadline 3293jof /18 12 2017 1930
+event pqehg /
+done 1
+done 3
+done
+done 13208
+list
+delete 19248
+delete
+delete 2
+list
+bye
\ No newline at end of file
diff --git a/text-ui-test/oracle_data.txt b/text-ui-test/oracle_data.txt
new file mode 100644
index 0000000000..3b9258c82e
--- /dev/null
+++ b/text-ui-test/oracle_data.txt
@@ -0,0 +1,3 @@
+TTborrow book
+DTproject meeting 18 12 2017 0000
+DF3293jof 18 12 2017 1930
diff --git a/text-ui-test/runtest.bat b/text-ui-test/runtest.bat
index 0873744649..50afcfec46 100644
--- a/text-ui-test/runtest.bat
+++ b/text-ui-test/runtest.bat
@@ -15,7 +15,7 @@ IF ERRORLEVEL 1 (
REM no error here, errorlevel == 0
REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
-java -classpath ..\bin Duke < input.txt > ACTUAL.TXT
+java -classpath ..\bin Oracle < input.txt > ACTUAL.TXT
REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT
diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh
old mode 100644
new mode 100755