-
Notifications
You must be signed in to change notification settings - Fork 591
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
[Haris-Irfan] iP #618
Open
Haris-Irfan
wants to merge
79
commits into
nus-cs2103-AY2425S1:master
Choose a base branch
from
Haris-Irfan: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
[Haris-Irfan] iP #618
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
68c58c1
Add Gradle support
03523ec
Bump gradle and lib version
Eclipse-Dominator 81a9c53
build.gradle: Prevent generating a second JAR file
aureliony 2063dca
Implement basic skeleton of chatbot
Haris-Irfan 6b9dc47
Implement switch statement and scanner in main
Haris-Irfan b0d0248
Rename project from Duke to KieTwoForOne
Haris-Irfan ba04115
Implement adding and listing of tasks functionality
Haris-Irfan ec3a264
Implement Task class
Haris-Irfan d2db81a
Implement mark and unmark functionality
Haris-Irfan 5a50742
Implement event, todo, and deadline functionality
Haris-Irfan 4ddf73a
Implement automated Text UI testing
Haris-Irfan 9d6ea60
Implement exceptions
Haris-Irfan 6c4874b
Convert Task[] array to ArrayList<Task>
Haris-Irfan c5052c3
Implement deletion functionality
Haris-Irfan fbe0696
Update automated Text UI testing
Haris-Irfan 9017cbf
Implement saving functionality
Haris-Irfan 6000982
Merge branch 'branch-level-7'
Haris-Irfan 25cbb40
Implement date time reading and filtering functionality
Haris-Irfan 83284e2
Merge branch 'branch-level-8'
Haris-Irfan 210ce03
Implement more OOP
Haris-Irfan be5e203
Merge branch 'A-MoreOOP'
Haris-Irfan 9c2fab2
Implement packages
Haris-Irfan 8676b51
Merge branch 'A-Packages'
Haris-Irfan f3e91ac
Merge branch 'A-Gradle'
Haris-Irfan 334e5ba
Implement main package kietwoforone to put all classes in
Haris-Irfan 4de9757
Modify build.gradle from duke to KieTwoForOne
Haris-Irfan c95e66d
Implement JUnit testing
Haris-Irfan 61de17d
Merge branch 'A-JUnit'
Haris-Irfan 6665b95
Configue build.gradle to create JAR file
Haris-Irfan 32c53e3
Merge branch 'A-Jar'
Haris-Irfan 10f4954
Implement filter by word functionality
Haris-Irfan 80081a1
Merge branch 'Level-9'
Haris-Irfan 287a95e
Implement Java documentation
Haris-Irfan e96ae01
Merge branch 'A-JavaDoc'
Haris-Irfan 6b0be98
Add one line space between showSameDate and showMatchingTask methods
Haris-Irfan 2aa1b6d
Edit code in line with coding standards
Haris-Irfan 1140ada
Merge branch 'A-CodingStandard'
Haris-Irfan 2fcd098
Fix issue: missing FIND case in switch statement
Haris-Irfan eacfb9f
Separate logic statements in the parse method
Haris-Irfan e92ac18
Configure build.gradle to support checkstyle usage
Haris-Irfan 7b8243b
Merge branch 'A-CheckStyle'
Haris-Irfan 70ce235
Implement GUI
Haris-Irfan e7a3da0
Merge branch 'Level-10'
Haris-Irfan f32a11f
Update README.md
Haris-Irfan 1062188
Update README.md
Haris-Irfan 8ae70b7
Update README.md
Haris-Irfan e84194a
Update README.md
Haris-Irfan d42180b
Update README.md
Haris-Irfan ff32694
Update README.md
Haris-Irfan 4589e51
Update README.md
Haris-Irfan ff73301
Merge branch 'master' of https://github.com/Haris-Irfan/ip
Haris-Irfan aa8c95d
Implement chatbot closing functionality
Haris-Irfan 9609f22
Implement assertions
Haris-Irfan 4907902
Improve code quality
Haris-Irfan f71046a
Merge pull request #2 from Haris-Irfan/branch-A-Assertions
Haris-Irfan 298bc46
Merge branch 'master' of https://github.com/Haris-Irfan/ip
Haris-Irfan 3657837
Merge branch 'master' into branch-A-CodeQuality
Haris-Irfan 22fcc86
Merge pull request #3 from Haris-Irfan/branch-A-CodeQuality
Haris-Irfan 4c99dea
Merge branch 'master' of https://github.com/Haris-Irfan/ip
Haris-Irfan b326900
Implement tagging functionality
Haris-Irfan 27d469e
Merge branch 'branch-C-Tagging'
Haris-Irfan 652fe01
Finalize features.
Haris-Irfan 3468419
Added file path creation functionality in the Storage class.
Haris-Irfan aa99a00
Update README.md
Haris-Irfan f729335
Include information on bye command to exit the application
Haris-Irfan bf6ba66
Update Ui.png
Haris-Irfan a63ad8f
Clean up syntax in README.md
Haris-Irfan 7b8e920
Fix tagging functionality
Haris-Irfan bc8a2d4
Fixed JavaDoc Comments.
Haris-Irfan 74446b5
Update README.md
Haris-Irfan fed83dd
Update README.md
Haris-Irfan 853d82c
Update README.md
Haris-Irfan d538e9c
Update README.md
Haris-Irfan 88b7389
Update README.md
Haris-Irfan ca1515e
Update README.md
Haris-Irfan 675cb81
Update README.md
Haris-Irfan 2fd90d8
Update README.md
Haris-Irfan 616d902
Update README.md
Haris-Irfan fb37bce
Update README.md
Haris-Irfan 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,44 @@ | |
|
||
public class KieTwoForOne { | ||
|
||
private static String[] tasks = new String[100]; | ||
private static Task[] tasks = new Task[100]; | ||
private static int count = 0; | ||
static String separationLine = "_________________________________________"; | ||
static String chatBotName = "KieTwoForOne"; | ||
|
||
public static void addTasks(String task) { | ||
tasks[count] = task; | ||
public enum Instructions { | ||
LIST, BLAH, MARK, UNMARK, BYE, READ, FIND | ||
} | ||
public static void addTasks(Task newtask) { | ||
tasks[count] = newtask; | ||
count++; | ||
System.out.println(String.format("added: %s", task)); | ||
System.out.println(String.format("added: %s", newtask.toString())); | ||
System.out.println(separationLine); | ||
} | ||
|
||
public static void listTasks() { | ||
for (int i = 0; tasks[i] != null; i++) { | ||
System.out.println(String.format("%d. %s", i + 1, tasks[i])); | ||
System.out.println(String.format("%d. %s", i + 1, tasks[i].toString())); | ||
} | ||
System.out.println(separationLine); | ||
} | ||
|
||
public static void markTask(int position) { | ||
Task markedTask = tasks[position - 1]; | ||
markedTask.setTrue(); | ||
System.out.println("Nice! I've marked this task as done:"); | ||
System.out.println(markedTask); | ||
System.out.println(separationLine); | ||
} | ||
|
||
public static void unmarkTask(int position) { | ||
Task unmarkedTask = tasks[position - 1]; | ||
unmarkedTask.setFalse(); | ||
System.out.println("Ok. I've marked this task as not done yet:"); | ||
System.out.println(unmarkedTask); | ||
System.out.println(separationLine); | ||
} | ||
|
||
public static void main(String[] args) { | ||
Scanner scanner = new Scanner(System.in); | ||
|
||
|
@@ -30,24 +49,34 @@ public static void main(String[] args) { | |
System.out.println(separationLine); | ||
|
||
while(true) { | ||
String instruction = scanner.nextLine(); | ||
switch (instruction.toUpperCase()) { | ||
case "LIST": | ||
String input = scanner.nextLine().toUpperCase(); | ||
String[] instruction = input.split(" ", 2); | ||
|
||
switch (Instructions.valueOf(instruction[0])) { | ||
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. Shouldn't there be no indentation for |
||
case LIST: | ||
KieTwoForOne.listTasks(); | ||
break; | ||
case "BYE": | ||
case BYE: | ||
System.out.println("Bye. Hope to see you again soon!"); | ||
System.out.println(separationLine); | ||
break; | ||
case "BLAH": | ||
case BLAH: | ||
System.out.println("blah"); | ||
System.out.println(separationLine); | ||
break; | ||
case MARK: | ||
KieTwoForOne.markTask(Integer.valueOf(instruction[1])); | ||
break; | ||
case UNMARK: | ||
KieTwoForOne.unmarkTask(Integer.valueOf(instruction[1])); | ||
break; | ||
case READ, FIND: | ||
KieTwoForOne.addTasks(new Task(String.format("%s %s", instruction[0], instruction[1]))); | ||
break; | ||
default: | ||
KieTwoForOne.addTasks(instruction); | ||
break; | ||
} | ||
if (instruction.equalsIgnoreCase("bye")) { | ||
if (instruction[0].equalsIgnoreCase("bye")) { | ||
break; | ||
} | ||
} | ||
|
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.
I like how you use
enum
to represent all the instructions.