Skip to content
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

[Adi Kesava] iP #11

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3b19ba1
Add Gradle support
May 24, 2020
e75da20
Level 0. Greet
e0261621 Aug 21, 2020
23b837a
Level 1. Greet, Echo, Exit
e0261621 Aug 21, 2020
4374ab3
Level 2. Add, List
e0261621 Aug 21, 2020
a895ade
Level 2. Add, List
e0261621 Aug 21, 2020
cf0d5a8
Level 3. Mark as Done
e0261621 Aug 21, 2020
dd30381
Added Deadline/ Task /Event with Task as Abstract as well as Constant…
e0261621 Aug 25, 2020
ff628e7
Level-4 - Adjusted the Deadline/ Task /Event as well as Constants an…
e0261621 Aug 26, 2020
661a076
A-CodingStandard - Changed the code to adhere to coding standards/ un…
e0261621 Aug 28, 2020
a75fcee
build.gradle: Update version to 8.29
Aug 29, 2020
cc8d80a
Branch-Level-5
e0261621 Sep 4, 2020
14e4699
A-CodeQuality
e0261621 Sep 4, 2020
745bf5f
Merge branch 'A-CodeQuality'
e0261621 Sep 4, 2020
9210ac3
Fixed javac compile and the runtest.bat file
e0261621 Sep 10, 2020
31bc066
branch-Level-6
e0261621 Sep 10, 2020
056f1d7
Merge pull request #1 from adi-kd0021/branch-Level-6
adi-kd0021 Sep 10, 2020
18c960e
branch-Level-7
e0261621 Sep 10, 2020
6e0c810
branch-A-JavaDoc
e0261621 Sep 10, 2020
dd968cf
Merge branch 'branch-Level-7'
e0261621 Sep 10, 2020
3e425e8
Merge branch 'branch-A-JavaDoc'
e0261621 Sep 10, 2020
c610621
branch-Level-9
e0261621 Sep 17, 2020
f97a9a3
Merge pull request #2 from adi-kd0021/branch-Level-9
adi-kd0021 Sep 17, 2020
2389d2d
Committing tasks.txt to pull branch-Level-9
e0261621 Sep 17, 2020
d4f2855
Merge branch 'master' of https://github.com/adi-kd0021/ip
e0261621 Sep 17, 2020
f5b301c
branch-A-JUnit
e0261621 Sep 17, 2020
b26633e
Merge pull request #3 from adi-kd0021/branch-A-JUnit
adi-kd0021 Sep 17, 2020
5b29160
Test markdown commit
e0261621 Sep 28, 2020
e97c7ae
Update README.md
adi-kd0021 Sep 28, 2020
07ce197
A-UserGuide
e0261621 Sep 28, 2020
b562ebf
Merge remote-tracking branch 'origin/master'
e0261621 Sep 28, 2020
552584b
Set theme jekyll-theme-minimal
adi-kd0021 Sep 28, 2020
0cb9d2e
Merge branch 'add-gradle-support' of https://github.com/nus-tic4002-A…
e0261621 Jan 21, 2021
8857138
added-gradle-support
e0261621 Jan 21, 2021
b9ea02e
added-gradle-support
e0261621 Jan 21, 2021
fb616ab
Fixed alot of CheckStyle errors
e0261621 Jan 28, 2021
bcf7b6b
Merge pull request #4 from adi-kd0021/branch-A-Gradle
adi-kd0021 Jan 28, 2021
4be111a
Add javaFX
e0261621 Jan 28, 2021
4227ff1
Add javaFX configuration
e0261621 Jan 29, 2021
aa2b631
Testing out JavaFX stuffs
e0261621 Feb 4, 2021
91ec94c
Added FXML
e0261621 Feb 21, 2021
6b39bcc
Adjusted IP Code to suit JavaFX.
e0261621 Feb 21, 2021
c1ddb5d
Adjusted IP Code to suit JavaFX.
e0261621 Feb 21, 2021
465be55
Merge pull request #6 from adi-kd0021/branch-Level-10
adi-kd0021 Feb 22, 2021
da0687d
Adjusted build.gradle to specify the correct main class for jar file …
e0261621 Feb 22, 2021
0ff6b3a
Added gradle.yml to include CI
e0261621 Feb 22, 2021
81edff9
Fixed CheckStyle errors.
e0261621 Feb 22, 2021
44d2f85
Removed the IO Redirection tests.
e0261621 Feb 22, 2021
457a6f6
Merge pull request #7 from adi-kd0021/branch-A-CI
adi-kd0021 Feb 22, 2021
0481004
Amended the README.md
e0261621 Feb 22, 2021
d41b086
Merge pull request #8 from adi-kd0021/branch-UG-DG-Website
adi-kd0021 Feb 22, 2021
3a03428
Amended Readme.md
e0261621 Feb 23, 2021
71b0195
Changed some images and attempted to style the UI
e0261621 Feb 23, 2021
f200450
Added in Tagging for Tasks.
e0261621 Feb 23, 2021
39bb871
Merge pull request #9 from adi-kd0021/branch-C-Tagging
adi-kd0021 Feb 23, 2021
662c791
Update DeveloperGuide.md
e0261621 Feb 24, 2021
2fb1f7e
Update DeveloperGuide.md
e0261621 Feb 24, 2021
74f6c5f
Update DeveloperGuide.md
e0261621 Feb 24, 2021
d53fd15
Increase Code quality
e0261621 Feb 24, 2021
6c96760
Merge pull request #10 from adi-kd0021/branch-A-HigherCodingQuality
adi-kd0021 Feb 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Duke project template
# main.java.Duke.main.main.java.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.

Expand All @@ -15,7 +15,7 @@ Prerequisites: JDK 11, update Intellij to the most recent version.
1. Click `Open or Import`.
1. Select the project directory, and click `OK`
1. If there are any further prompts, accept the defaults.
1. After the importing is complete, 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:
1. After the importing is complete, locate the `src/main/java/main.java.Duke.main.main.java.Duke.java` file, right-click it, and choose `Run main.java.Duke.main.main.java.Duke.main()`. If the setup is correct, you should see something like the below:
```
Hello from
____ _
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/Duke.java

This file was deleted.

28 changes: 28 additions & 0 deletions src/main/java/Duke/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package Duke;

public class Deadline extends Todo {
private String deadLine;

public Deadline(String description, String deadLine) {
super(description);
this.deadLine = deadLine;
}

public String getDeadLine() {
return this.deadLine;
}

public void setDeadLine(String deadLine) {
this.deadLine = deadLine;
}

@Override
public void setDescription(String description) {
super.setDescription(description);
}

@Override
public String toString() {
return String.format(super.toString() + " (by: " + this.getDeadLine() + ")");
}
}
94 changes: 94 additions & 0 deletions src/main/java/Duke/Duke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package Duke;

import ui.Parser;
import ui.Ui;

public class Duke {

private TaskList tasks;
private Ui ui;

public Duke() {
ui = new Ui();
tasks = new TaskList();
}

public void run() {
ui.printWelcome();

boolean isExit = false;
while (!isExit) {
try {
String fullCommand = ui.readUserCommand();
String commandWord = Parser.getCommandWord(fullCommand);
switch (commandWord) {
case "":
ui.printError("No command input! Please enter a command or type \"help\" to view a list of commands.");
break;
case "exit":
isExit = true;
if (tasks.getNumberOfTasks() > 0) {

} else {
}
ui.printGoodBye();
break;
case "help":
ui.helpMessage();
break;
case "todo":
tasks.addTask(Parser.createTodo(fullCommand));
// ui.showToUser(tasks.getTaskCount());
ui.printTaskAddAck(tasks.getTasks().get(TaskList.getNumberOfTasks() - 1), TaskList.getNumberOfTasks());
break;
case "deadline":
tasks.addTask(Parser.createDeadLine(fullCommand));
// ui.showToUser(tasks.getTaskCount());
ui.printTaskAddAck(tasks.getTasks().get(TaskList.getNumberOfTasks() - 1), TaskList.getNumberOfTasks());
break;
case "event":
tasks.addTask(Parser.createEvent(fullCommand));
// ui.showToUser(tasks.getTaskCount());
ui.printTaskAddAck(tasks.getTasks().get(TaskList.getNumberOfTasks() - 1), TaskList.getNumberOfTasks());
break;
case "print":
// tasks.printTasks();
ui.printTasks(tasks.getTasks());
break;
case "done":
tasks.markAsDone(Parser.parseTaskNum(fullCommand));
ui.printTaskMarkedAsDone(tasks.getTasks().get(Parser.parseTaskNum(fullCommand) - 1));
break;
// case "undone":
// tasks.markAsNotDone(Parser.parseTaskNum(fullCommand));

case "save":
// storage.save(tasks.getTasks());
break;
// case "remove":
// tasks.removeTask(fullCommand);
// ui.showToUser(tasks.getTaskCount());
// break;
// case "backup":
// storage.createBackup(tasks.getTasks());
// break;
default:
ui.printError("Unknown command! please try again. Please type \"help\" to view a list of commands.");
break;
}
} catch (Exception e) {
ui.printError(e.getMessage());
}
}
exit();
}

public static void main(String[] args) {
new Duke().run();
}

public static void exit() {
// System.out.println(0);
}
}

7 changes: 7 additions & 0 deletions src/main/java/Duke/DukeException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package Duke;

public class DukeException extends Exception {
public DukeException(String message) {
super(message);
}
}
28 changes: 28 additions & 0 deletions src/main/java/Duke/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package Duke;

public class Event extends Todo {
private String schedule;

public Event(String description, String schedule) {
super(description);
this.schedule = schedule;
}

public String getSchedule() {
return schedule;
}

public void setSchedule(String schedule) {
this.schedule = schedule;
}

@Override
public void setDescription(String description) {
super.setDescription(description);
}

@Override
public String toString() {
return String.format(super.toString() + " (at: " + this.getSchedule() + ")");
}
}
35 changes: 35 additions & 0 deletions src/main/java/Duke/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package Duke;

public abstract class Task {
protected String description;
protected boolean isDone;

public Task() {
}

public Task(String description) {
this.description = description;
this.isDone = false;
}


public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public boolean completionStatus() {
return isDone;
}

public void setDone(boolean done) {
this.isDone = done;
}

public String toString() {
return String.format("%s", this.getDescription());
}
}
60 changes: 60 additions & 0 deletions src/main/java/Duke/TaskList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package Duke;

import java.util.ArrayList;
import java.util.List;

public class TaskList {

private static List<Task> tasks;

public TaskList() {
tasks = new ArrayList<Task>();
}

public String getDescription() {
String tasksDescription = "";
for (int i = 0; i < tasks.size(); i++) {
tasksDescription += tasks.get(i).getDescription().trim();
if (i == tasks.size() - 1) {

} else {
tasksDescription += "|";
}
}
return tasksDescription;
}

public List<Task> getTasks() {
return this.tasks;
}

public void addTask(Task task) {
this.tasks.add(task);
}

public void printTasks() {
System.out.println("Tasks:");
int i = 1;
for (Task t : this.tasks) {
System.out.println(i + "." + t);
i++;
}
}

public static int getNumberOfTasks() {
return tasks.isEmpty() ? 0 : tasks.size();
}

public void markAsDone(int idx) {
tasks.get(idx - 1).setDone(true);
}

public void markAsNotDone(int idx) {
tasks.get(idx - 1).setDone(false);
}

// public void removeTask(String fullCommand) {
// int index = Integer.parseInt(fullCommand.substring("remove".length()).trim());
// tasks.remove(index - 1);
// }
}
19 changes: 19 additions & 0 deletions src/main/java/Duke/Todo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package Duke;

public class Todo extends Task {

public Todo(String description) {
super(description);
}

@Override
public void setDescription(String description) {
super.setDescription(description);
}

@Override
public String toString() {
return String.format("[is done ? %s] " + super.toString(), this.completionStatus() ? "Yes" : "No");
}

}
45 changes: 45 additions & 0 deletions src/main/java/ui/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package ui;

public class Constants {
public static final String LOGO = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
// System.out.println("Hello from\n" + logo);

public static final String H_LINE = "____________________________________________________________";

public static final String GREETING = LOGO + "\n" + H_LINE + "\n" + "Hello I'm Duke :) What can I do for you ?" + "\n" + H_LINE + "\n";

public static final String FAREWELL = "\nBye. Hope to see you again soon!\n";

public static final String DISPLAY_TASK_LIST = "\nHere are the tasks in your list:\n";

public static final String NUMBER_OF_TASKS = "Now you have %s tasks in the list.";

public static final String ACKNOWLEDGEMENT = "Got it. I've added this task:";

public static final String ACKNOWLEDGEMENT_AS_DONE = "Nice! I've marked this task as done:";

public static final String TODO = "todo";
public static final String DEADLINE = "deadline";
public static final String SAVE = "save";
public static final String PRINT = "print";
public static final String DONE = "done";
public static final String EXIT = "exit";

public static final String TODO_HELP_STATEMENT = "Type \"todo\" \"description of task\" and press 'Enter' to create a new Todo Task." +
" E.g. todo Return textbook";

public static final String DEADLINE_HELP_STATEMENT = "Type \"deadline\" \"description of task\" /by \"description of deadline\" and press 'Enter' to create a new Deadline Task. E.g. deadline Hand in Homework /by Monday 10am ";


public static final String PRINT_HELP_STATEMENT = "Type \"print\" and press 'Enter' to print out the current list of tasks.";

public static final String DONE_HELP_STATEMENT = "Type \"done\" and the number of the task from the list, then press 'Enter'." +
"Use \"print\" to display the tasks and their corresponding number first. E.g. done 1\n" +
"\t\t\t [This will set that task's status to done/ complete]";

public static final String EXIT_HELP_STATEMENT = "Type \"exit\" and press 'Enter' in order to exit the main.java.Duke chatbot application.";
}
Loading