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

[T7][W11-C3] #75

Open
wants to merge 645 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
645 commits
Select commit Hold shift + click to select a range
39dd1c3
Test case for storage memory
LuMiN0uSaRc Oct 30, 2016
44d4c6a
Testing of deadline for storage memory
LuMiN0uSaRc Oct 30, 2016
8d3bbe1
test for events memory storage
LuMiN0uSaRc Oct 30, 2016
cb4c51f
Merge pull request #177 from CS2103AUG2016-W11-C3/Storage_Memory_Test
LuMiN0uSaRc Oct 30, 2016
4437b72
Updated test cases
LuMiN0uSaRc Oct 30, 2016
ca4b216
fixed test cases
LuMiN0uSaRc Oct 30, 2016
9f5c81c
Merge pull request #178 from CS2103AUG2016-W11-C3/Storage_Memory_Test
LuMiN0uSaRc Oct 30, 2016
47528a8
Refactoring. Added TaskBuilder and AddCommandBuilder.
Oct 30, 2016
f2cd92e
Update comment.
Oct 30, 2016
3b90dd9
Merge pull request #179 from CS2103AUG2016-W11-C3/refactoring/add-com…
Oct 30, 2016
9727586
add ImportCommand
zavfel Oct 30, 2016
bdb1891
Merge pull request #180 from CS2103AUG2016-W11-C3/importCommand
zavfel Oct 30, 2016
15a763f
Merge branch 'master' into importCommand
zavfel Oct 30, 2016
7f4bc43
Refactor isDue to improve SLAP.
Oct 30, 2016
d29727c
Added @@author at appropriate place. Added comments header.
Oct 30, 2016
bb95d46
Merge pull request #181 from CS2103AUG2016-W11-C3/refactor/issue-168-…
Oct 30, 2016
a33d807
refactoring, removing of confirm with user
bertojo Oct 30, 2016
0f989a8
test cases for xmlTaskManagerStorage
bertojo Oct 30, 2016
df06141
more test cases for storage
bertojo Oct 30, 2016
a643737
Merge branch 'master' into RelocateCommandTest
bertojo Oct 30, 2016
bb0c878
Merge pull request #182 from CS2103AUG2016-W11-C3/RelocateCommandTest
bertojo Oct 30, 2016
f1edc03
major refactoring
zavfel Oct 30, 2016
fd96f74
Merge branch 'master' into importCommand
zavfel Oct 30, 2016
49d8135
update UnmarkCommandTest
zavfel Oct 30, 2016
0bb47ec
refactor testcase
zavfel Oct 30, 2016
351ceab
update MarkCommandTest
zavfel Oct 31, 2016
f74d179
hotfix: remove duplicate methods.
Oct 31, 2016
d4800c6
hotfix: temporary fix for generic memory. Need to decouple Command an…
Oct 31, 2016
d768c27
Added ImportIcsCommand to allow importing iCal format into Mastermind.
Oct 31, 2016
fd360dc
Added test cases for Import ICS.
Oct 31, 2016
04541a1
Merge pull request #187 from CS2103AUG2016-W11-C3/feature/import-ics
Oct 31, 2016
91f46b8
Added ExportCommand to export to csv.
Oct 30, 2016
7e14022
remove unnecessary exceptions
zavfel Oct 31, 2016
7b67886
Added test cases.
Oct 31, 2016
7ada980
Merge pull request #184 from CS2103AUG2016-W11-C3/feature/export-csv
Oct 31, 2016
39cc99c
Merge branch 'master' into importCommand
zavfel Nov 1, 2016
eedc3f4
update import
zavfel Nov 1, 2016
1ee6ccf
add relocateSaveLocation back
zavfel Nov 1, 2016
2a5fcd6
UI changes to move Action History to a collapsible titled Pane
Nov 1, 2016
ede18df
Added ActionHistoryCOmmand to toggle UI.
Nov 1, 2016
dcdaaa2
Change the description of empty table.
Nov 1, 2016
9fa9821
Merge pull request #189 from CS2103AUG2016-W11-C3/enhancement/action-…
Nov 1, 2016
854b1d0
import from csv files
zavfel Nov 1, 2016
0ef435e
Merge branch 'master' into importCommand
zavfel Nov 1, 2016
d20baf0
Merge pull request #186 from CS2103AUG2016-W11-C3/importCommand
zavfel Nov 1, 2016
622c6f9
fix test case
zavfel Nov 1, 2016
38a6be9
minor changes to import
zavfel Nov 1, 2016
6dafd69
Merge pull request #190 from CS2103AUG2016-W11-C3/importCommand
zavfel Nov 1, 2016
e975218
Merge branch 'master' into markCommand
zavfel Nov 1, 2016
86793f7
fix bug in import
zavfel Nov 1, 2016
4fb56d6
allow marking of due tasks
zavfel Nov 2, 2016
ce19a3d
Merge pull request #191 from CS2103AUG2016-W11-C3/markCommand
zavfel Nov 2, 2016
0bbb69b
update user/dev guide
zavfel Nov 2, 2016
db678d3
update aboutUs
bertojo Nov 2, 2016
22cdb79
fix test case in logicmanager
zavfel Nov 2, 2016
183a2b3
Merge pull request #193 from CS2103AUG2016-W11-C3/fix-mark-test-case
zavfel Nov 2, 2016
aa1dfa1
update UI image
zavfel Nov 2, 2016
777cf41
Update collate for v0,5rc
Nov 2, 2016
456409f
Merge pull request #196 from CS2103AUG2016-W11-C3/documentation/colla…
Nov 2, 2016
8ebfd96
added assertions
bertojo Oct 30, 2016
95cb887
add comments
bertojo Oct 30, 2016
3d82159
decoupled storage and logic
bertojo Oct 31, 2016
66a8b8a
added comments
bertojo Oct 31, 2016
cd7f92b
removed some unused imports
bertojo Oct 31, 2016
e24c63b
added test cases for storage manager
bertojo Oct 31, 2016
24f3f47
added more test cases
bertojo Oct 31, 2016
0879815
take out unneeded code
bertojo Oct 31, 2016
d3100c8
refactored storage manager
bertojo Nov 1, 2016
6fb7da9
added tests to config
bertojo Nov 1, 2016
fd0eab8
more test cases for config
bertojo Nov 1, 2016
5a2434b
more test cases to config
bertojo Nov 1, 2016
f8ee23f
Minor config fix. Remove duplicate methods.
Nov 2, 2016
5c28bb4
Merge pull request #188 from CS2103AUG2016-W11-C3/RelocateCommandTest
Nov 2, 2016
69d31bd
Merge pull request #198 from CS2103AUG2016-W11-C3/help_popup_window
LuMiN0uSaRc Nov 2, 2016
14cd280
Restyle to Monokai.
Nov 2, 2016
633de9d
Merge pull request #199 from CS2103AUG2016-W11-C3/enhancement/ui
Nov 2, 2016
62ef5bc
add test for helpCommand
bertojo Nov 2, 2016
b736b3f
fixed potential bug and made a ui test folder
bertojo Nov 2, 2016
9d80c58
minor edits to popup window
LuMiN0uSaRc Nov 2, 2016
f02a1fa
Revert "minor edits to popup window"
LuMiN0uSaRc Nov 2, 2016
6b6d002
refactor code and add test cases
bertojo Nov 2, 2016
2ffeb64
dk what i was doing
bertojo Nov 2, 2016
2332190
removed ui test first
bertojo Nov 3, 2016
65eb51e
Merge branch 'master' into helpPopupTestAndRefine
bertojo Nov 3, 2016
0e7bdc6
Merge pull request #201 from CS2103AUG2016-W11-C3/helpPopupTestAndRefine
bertojo Nov 3, 2016
b09ffc0
trying to make a table view
bertojo Nov 3, 2016
e0a33c0
updated help popup's content
bertojo Nov 3, 2016
728b8dd
hotfix: missing brackets.
Nov 3, 2016
f64f036
Updated popup
LuMiN0uSaRc Nov 3, 2016
6e9953b
Merge branch 'master' of https://github.com/CS2103AUG2016-W11-C3/main
LuMiN0uSaRc Nov 3, 2016
f67b065
created table for popup, does not show in mastermind though
bertojo Nov 3, 2016
da7dd8b
some refactoring and bug fixing
bertojo Nov 3, 2016
0219a0d
improve code quality
bertojo Nov 3, 2016
a121138
Added Import command test.
Nov 3, 2016
9be9382
Remove git ignore contraint on csv.
Nov 3, 2016
423dc2f
Merge pull request #203 from CS2103AUG2016-W11-C3/test/importCommand
Nov 3, 2016
ab5d4e2
commented out the deprecated constructor.
Nov 3, 2016
5600e21
Merge pull request #204 from CS2103AUG2016-W11-C3/test/add-command
Nov 3, 2016
8e97489
popup with table working but content not set yet.
bertojo Nov 3, 2016
ebda16a
fix mark due
zavfel Nov 3, 2016
6cbf08c
Merge pull request #205 from CS2103AUG2016-W11-C3/markDue
zavfel Nov 3, 2016
ce24c5c
added author
bertojo Nov 3, 2016
ea96f70
update UI
zavfel Nov 3, 2016
5f4cf29
add highlight for marking recurring
zavfel Nov 4, 2016
8996bee
Merge pull request #213 from CS2103AUG2016-W11-C3/highlightMarkTask
zavfel Nov 4, 2016
efa468b
some refactoring and initialising
bertojo Nov 4, 2016
a0535c7
command format init
bertojo Nov 4, 2016
47e43c4
added description list
bertojo Nov 4, 2016
d338011
help popup working with updated content
bertojo Nov 4, 2016
0d6d558
Merge branch 'master' into HelpPopupTableView
bertojo Nov 4, 2016
6776897
Merge pull request #215 from CS2103AUG2016-W11-C3/HelpPopupTableView
bertojo Nov 4, 2016
5ee574e
Merge pull request #197 from CS2103AUG2016-W11-C3/Sort_Memory
LuMiN0uSaRc Nov 5, 2016
0c9c7ac
Separated Memory methods out of Storage interface
LuMiN0uSaRc Nov 5, 2016
5e9a280
Updated storage memory test case
LuMiN0uSaRc Nov 5, 2016
54eb7b9
Merge pull request #219 from CS2103AUG2016-W11-C3/Refactoring_Storage…
LuMiN0uSaRc Nov 5, 2016
831d6a1
getCommand() for memory
LuMiN0uSaRc Nov 5, 2016
ffbc65f
setCommand()
LuMiN0uSaRc Nov 5, 2016
392ad5a
setTaskName()
LuMiN0uSaRc Nov 5, 2016
db92d44
Memory setDescription, setLength, setType
LuMiN0uSaRc Nov 5, 2016
a01be36
Methods for ParserMemory updated
LuMiN0uSaRc Nov 5, 2016
4b236fd
Merge pull request #220 from CS2103AUG2016-W11-C3/Update_Parser_Memory
LuMiN0uSaRc Nov 5, 2016
72d5b73
command, name, description and length for parsermemory test case
LuMiN0uSaRc Nov 5, 2016
b5b290b
Updated more test cases
LuMiN0uSaRc Nov 5, 2016
b577438
test setdate
LuMiN0uSaRc Nov 5, 2016
feafa26
test setTime
LuMiN0uSaRc Nov 5, 2016
e441098
test_reduce() and test_isUselessCommand()
LuMiN0uSaRc Nov 5, 2016
df53e32
Removed lines in ParserSearch for Memory
LuMiN0uSaRc Nov 5, 2016
a3a9300
Merge pull request #221 from CS2103AUG2016-W11-C3/test_parser_memory
LuMiN0uSaRc Nov 5, 2016
d69a0c9
Improve nlp.
Nov 5, 2016
fa76a7f
Merge pull request #222 from CS2103AUG2016-W11-C3/enhancement/add-com…
Nov 5, 2016
2169fcf
TestEvent for Sort function
LuMiN0uSaRc Nov 5, 2016
1621d56
testDeadline and testTask for sort
LuMiN0uSaRc Nov 5, 2016
b74c333
Remove uneccessary lines
LuMiN0uSaRc Nov 5, 2016
ebf656a
Merge pull request #223 from CS2103AUG2016-W11-C3/Sort_Testing
LuMiN0uSaRc Nov 5, 2016
2bb5c98
bug fix for excluding single quotes in capture group.
Nov 5, 2016
e54ea97
Merge pull request #224 from CS2103AUG2016-W11-C3/enhancement/add-com…
Nov 5, 2016
e831a1b
History for Memory
LuMiN0uSaRc Nov 5, 2016
ffd7003
relocate command test cases and bug fix
bertojo Nov 5, 2016
36a3dd0
Merge pull request #225 from CS2103AUG2016-W11-C3/RelocateIntegration…
bertojo Nov 5, 2016
e0a7a5e
Major UI decoupling
Nov 4, 2016
c3a1cd8
Have to recover duplicated tableview so test case will pass :(
Nov 4, 2016
23b772e
Merge pull request #214 from CS2103AUG2016-W11-C3/refactor/ui-class-s…
Nov 5, 2016
4d54cfd
Merge pull request #226 from CS2103AUG2016-W11-C3/History_Memory
LuMiN0uSaRc Nov 5, 2016
7e34f09
Added IMPORTED tag to all task imported through csv and ics. txt base…
Nov 5, 2016
b7aaa39
Merge pull request #227 from CS2103AUG2016-W11-C3/enhancement/issue-1…
Nov 5, 2016
32b280c
updated delete command for memory
LuMiN0uSaRc Nov 5, 2016
33ec13f
finished find and delete for memory!!
LuMiN0uSaRc Nov 6, 2016
18ed8bb
debugging in progress
LuMiN0uSaRc Nov 6, 2016
b6bf628
Edit command now uses comma to separate keywords
Nov 6, 2016
dfdc0a4
Merge pull request #228 from CS2103AUG2016-W11-C3/Delete_Memory
LuMiN0uSaRc Nov 6, 2016
def89bc
Refactoring to improve SLAP
Nov 6, 2016
562ad7f
Merge pull request #229 from CS2103AUG2016-W11-C3/enhancement/edit-co…
Nov 6, 2016
e94fd7f
Bug fix for issue 209
Nov 6, 2016
f736f9f
fix #183
zavfel Nov 6, 2016
48e960b
Merge pull request #231 from CS2103AUG2016-W11-C3/bugs/issue-209-mark…
Nov 6, 2016
7610118
fix column titles
zavfel Nov 6, 2016
8fa32f8
correct typo for author
LuMiN0uSaRc Nov 6, 2016
1aa8df5
add color to archived tasks
zavfel Nov 6, 2016
ab37b75
fix column size
zavfel Nov 6, 2016
6aeb4d6
resolve mainWindow.java
zavfel Nov 6, 2016
985d4f4
fixes #210 #216 #212
zavfel Nov 6, 2016
7db86bc
main collates
LuMiN0uSaRc Nov 6, 2016
e71fa25
test collates
LuMiN0uSaRc Nov 6, 2016
34b2797
Merge pull request #232 from CS2103AUG2016-W11-C3/Refactoring_and_cor…
LuMiN0uSaRc Nov 6, 2016
f541462
Merge pull request #234 from CS2103AUG2016-W11-C3/Updating_collate
LuMiN0uSaRc Nov 6, 2016
d1a91b4
Shorten the actionhistory command to just history
Nov 6, 2016
01a881b
Merge pull request #235 from CS2103AUG2016-W11-C3/enhancement/actionh…
Nov 6, 2016
a34c670
update importing of csv file
zavfel Nov 6, 2016
dbe54b0
remove printouts
zavfel Nov 6, 2016
3129098
Test case for find memory
LuMiN0uSaRc Nov 6, 2016
009af77
remove unnecessary imports
zavfel Nov 6, 2016
87e5be9
Merge pull request #236 from CS2103AUG2016-W11-C3/Test_Memory_Find
LuMiN0uSaRc Nov 6, 2016
76437b6
Merge pull request #237 from CS2103AUG2016-W11-C3/update-features
zavfel Nov 6, 2016
7c8eead
Revert "Merge pull request #237 from CS2103AUG2016-W11-C3/update-feat…
zavfel Nov 6, 2016
974737d
re-oredering the table entries
bertojo Nov 6, 2016
724f2ee
added test case for helpCommand
bertojo Nov 6, 2016
f34eda2
resizing popup
bertojo Nov 6, 2016
14141be
added some logging
bertojo Nov 6, 2016
005b1c9
standardise entry's inputs
bertojo Nov 6, 2016
9febdbc
Merge pull request #238 from CS2103AUG2016-W11-C3/RefactoringHelpCommand
bertojo Nov 6, 2016
30659f7
bunch of testcases
LuMiN0uSaRc Nov 7, 2016
af882f3
fix test case and update config file for testing
zavfel Nov 7, 2016
6fe469c
fix configUtilTest
zavfel Nov 7, 2016
3889ca8
more testcases to cover more lines
LuMiN0uSaRc Nov 7, 2016
45d4c02
removes printlns
zavfel Nov 7, 2016
7fd53e9
resolve conflict in import
zavfel Nov 7, 2016
c43a9ef
Merge branch 'update-features'
zavfel Nov 7, 2016
2051572
And more test cases...
LuMiN0uSaRc Nov 7, 2016
fde854e
fix configTest file
zavfel Nov 7, 2016
fced710
test cases for comparison between memory objects
LuMiN0uSaRc Nov 7, 2016
e486ce0
testcases for generic memory done! ;A;
LuMiN0uSaRc Nov 7, 2016
e351ce3
fix highlight
zavfel Nov 7, 2016
b53ba69
debugging in progress
LuMiN0uSaRc Nov 7, 2016
58d1f87
Merge pull request #241 from CS2103AUG2016-W11-C3/fix-config-test
zavfel Nov 7, 2016
bd9aea9
Covering more lines in progress under events
LuMiN0uSaRc Nov 7, 2016
2c81d67
Fix test cases
LuMiN0uSaRc Nov 7, 2016
7b44bfb
Merge pull request #240 from CS2103AUG2016-W11-C3/Test_cases_for_Gene…
LuMiN0uSaRc Nov 7, 2016
bccba43
Fix typo for
Nov 7, 2016
10c7e0b
Merge pull request #242 from CS2103AUG2016-W11-C3/hotfix/highlight-la…
Nov 7, 2016
fc84ca9
allow finding in specific tabs
zavfel Nov 7, 2016
db82d8f
Merge pull request #243 from CS2103AUG2016-W11-C3/fix-find
zavfel Nov 7, 2016
6ed1e42
increase coverage for CommandBox
zavfel Nov 7, 2016
0ecf388
fix test case in memoryFind
zavfel Nov 7, 2016
c819d0a
add mark due test
zavfel Nov 7, 2016
5d63f66
Merge pull request #244 from CS2103AUG2016-W11-C3/increase-coverage
zavfel Nov 7, 2016
d22a13d
Improve SLAP.
Nov 7, 2016
f71bd5c
remove unnecessary author tags.
Nov 7, 2016
4ca97a7
Refactor UI.
Nov 7, 2016
44fc6ed
Added author tag.
Nov 7, 2016
1ca8954
updated help to show find tag and updated test case
bertojo Nov 7, 2016
0c1b0ed
add Edit test
zavfel Nov 7, 2016
3c7290e
removed unused class
zavfel Nov 7, 2016
8573238
Merge pull request #245 from CS2103AUG2016-W11-C3/addCoverage
zavfel Nov 7, 2016
0858153
remove unused import
zavfel Nov 7, 2016
e793157
updated help for find tag
bertojo Nov 7, 2016
9e50fd2
remove the sort by pressing table header functionality
bertojo Nov 7, 2016
b45f8a5
update TestTask
zavfel Nov 7, 2016
46cd53d
Merge pull request #246 from CS2103AUG2016-W11-C3/UpdatingHelpTable
bertojo Nov 7, 2016
45d5eba
removed testrecusrivesearchterms
LuMiN0uSaRc Nov 7, 2016
f95def9
Merge pull request #247 from CS2103AUG2016-W11-C3/Debug_Test_Memory_Find
LuMiN0uSaRc Nov 7, 2016
850c418
i tried
LuMiN0uSaRc Nov 7, 2016
a7460ab
add Upcoming test
zavfel Nov 7, 2016
e98e1d0
add find tag test
zavfel Nov 7, 2016
f3cf096
Merge pull request #249 from CS2103AUG2016-W11-C3/updateTest
zavfel Nov 7, 2016
5907c87
magic
LuMiN0uSaRc Nov 7, 2016
a476a9c
Merge pull request #250 from CS2103AUG2016-W11-C3/removing_println()
LuMiN0uSaRc Nov 7, 2016
41803b5
Merge pull request #248 from CS2103AUG2016-W11-C3/Test_ParserSearch
LuMiN0uSaRc Nov 7, 2016
6cdb495
update author
LuMiN0uSaRc Nov 7, 2016
5837f29
removed unusued code
LuMiN0uSaRc Nov 7, 2016
7868e01
Added manual testing step.
Nov 7, 2016
788b6ce
Merge pull request #252 from CS2103AUG2016-W11-C3/test/manual-testing
Nov 7, 2016
7905e78
removed lines of code
LuMiN0uSaRc Nov 7, 2016
1942535
remove unused lines...
LuMiN0uSaRc Nov 7, 2016
022f192
commeneted
LuMiN0uSaRc Nov 7, 2016
295e334
Merge pull request #251 from CS2103AUG2016-W11-C3/Refactoring_and_add…
LuMiN0uSaRc Nov 7, 2016
3816baa
Merge pull request #253 from CS2103AUG2016-W11-C3/Remove_history_code
LuMiN0uSaRc Nov 7, 2016
6529316
tagging and comments
bertojo Nov 7, 2016
092002c
editted comments
LuMiN0uSaRc Nov 7, 2016
38fec63
Merge pull request #255 from CS2103AUG2016-W11-C3/Hui_Qi_editting_com…
LuMiN0uSaRc Nov 7, 2016
f61cf1b
Merge pull request #254 from CS2103AUG2016-W11-C3/0.5AlbertTagging
Nov 7, 2016
d031d08
updated tags
bertojo Nov 7, 2016
85572f1
Merge pull request #256 from CS2103AUG2016-W11-C3/0.5DylanTagging
bertojo Nov 7, 2016
1923799
added DG & UG.
Nov 7, 2016
77619bb
Added logger.
Nov 7, 2016
9579aec
Update about me.
Nov 7, 2016
ee29ad3
update images
zavfel Nov 7, 2016
5559f47
added in memory
bertojo Nov 7, 2016
1a85fe6
Merge pull request #258 from CS2103AUG2016-W11-C3/fixImage
zavfel Nov 7, 2016
92608aa
Collate.
Nov 7, 2016
07ae40a
Merge branch 'master' of github.com:CS2103AUG2016-W11-C3/main
Nov 7, 2016
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -16,3 +16,4 @@ classes/
/bin/
gradle.prefs
org.eclipse.jdt.core.prefs
data.txt
80 changes: 41 additions & 39 deletions src/main/java/harmony/mastermind/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
@@ -32,28 +32,6 @@ public class AddCommand extends Command implements Undoable, Redoable {
public static final String COMMAND_KEYWORD_ADD = "add";
public static final String COMMAND_KEYWORD_DO = "do";


// The main idea of capturing parameters in any order is inspired by (author
// velop):
// http://stackoverflow.com/questions/1177081/mulitple-words-in-any-order-using-regex

// As for capturing optional group AND in any order:
// http://stackoverflow.com/questions/24472120/match-optional-components-in-any-order

// We wrote the regular expression and tested at:
// https://regex101.com/r/bFQrP6/1
// @@author A0138862W
//
// the following regex is no longer in used, replaced by better one (NLP)
/*
public static final String COMMAND_ARGUMENTS_REGEX = "(?=(?:.*?r\\/'(?<recur>.+?)')?)"
+ "(?=(?:.*?\\s\\'(?<name>.+?)'))"
+ "(?=(?:.*?sd\\/'(?<startDate>.+?)')?)"
+ "(?=(?:.*?ed\\/'(?<endDate>.+?)')?)"
+ "(?=(?:.*t\\/'(?<tags>\\w+(?:,\\w+)*)?')?)"
+ ".*";
*/

// Better regex, support better NLP:
// general form: add some task name from tomorrow 8pm to next friday 8pm daily #recurring,awesome
// https://regex101.com/r/M2A3tB/8
@@ -92,6 +70,7 @@ public class AddCommand extends Command implements Undoable, Redoable {

private final Task toAdd;


private static final String TASK = "Task";
private static final String DEADLINE = "Deadline";
private static final String EVENT = "Event";
@@ -100,12 +79,6 @@ public class AddCommand extends Command implements Undoable, Redoable {
static GenericMemory deadline;
static GenericMemory event;

/**
* Convenience constructor using raw values.<br><br>
*
* Throws IllegalValueException if any of the raw values are invalid<br>
* Throws InvalidEventDateException if event type has start date after end date
*/
// event
// @@author A0124797R
public AddCommand(String name, String startDate, String endDate, Set<String> tags, String recurVal, Memory mem) throws IllegalValueException, InvalidEventDateException {
@@ -134,17 +107,20 @@ public AddCommand(String name, String startDate, String endDate, Set<String> tag
}

// deadline
// @@author A0138862W
// @@author A0138862W-unused
/**
* The builder constructor has taken care of all the construction of event, floating and deadline
* @see AddCommand(AddCommandBuilder)
*
*/
public AddCommand(String name, String endDateStr, Set<String> tags, String recur, Memory mem) throws IllegalValueException {
final Set<Tag> tagSet = new HashSet<>();
for (String tagName : tags) {
tagSet.add(new Tag(tagName));
}

// fix for #132
List<Date> endDates = prettyTimeParser.parse(endDateStr);
Date endDate = (endDates.isEmpty())? null: endDates.get(0);
Date createdDate = new Date();
Date endDate = prettyTimeParser.parse(endDateStr).get(0);


this.toAdd = new Task(name, endDate, new UniqueTagList(tagSet), recur, createdDate);

@@ -157,7 +133,12 @@ public AddCommand(String name, String endDateStr, Set<String> tags, String recur
}

// floating
// @@author A0138862W
// @@author A0138862W-unused
/**
* The builder constructor has taken care of all the construction of event, floating and deadline
* @see AddCommand(AddCommandBuilder)
*
*/
public AddCommand(String name, Set<String> tags, Memory mem) throws IllegalValueException {
final Set<Tag> tagSet = new HashSet<>();
for (String tagName : tags) {
@@ -172,7 +153,32 @@ public AddCommand(String name, Set<String> tags, Memory mem) throws IllegalValue
mem.add(task);
}

// @@author A0138862W
/**
* Build the AddCommand using addCommandBuilder. Depending on the builder attributes, the taskBuilder will return the appropriate event/floating/deadline task.
*
* @param addCommandBuilder to build the command safely
*
*/
protected AddCommand(AddCommandBuilder addCommandBuilder) throws IllegalValueException, InvalidEventDateException{
TaskBuilder taskBuilder = new TaskBuilder(addCommandBuilder.getName());
taskBuilder.withTags(addCommandBuilder.getTags());

if(addCommandBuilder.isDeadline()){
taskBuilder.asDeadline(addCommandBuilder.getEndDate());
}else if(addCommandBuilder.isEvent()){
taskBuilder.asEvent(addCommandBuilder.getStartDate(), addCommandBuilder.getEndDate());
}

if(addCommandBuilder.isRecurring()){
taskBuilder.asRecurring(addCommandBuilder.getRecur());
}

toAdd = taskBuilder.build();
}

@Override
//@@author A0138862W
public CommandResult execute() {
assert model != null;
try {
@@ -234,16 +240,12 @@ private void executeAdd() throws DuplicateTaskException {
model.addTask(toAdd);
}

// @@author A0138862W
private void requestHighlightLastActionedRow(Task task){
EventsCenter.getInstance().post(new HighlightLastActionedRowRequestEvent(task));
}

//@@author A0143378Y
private Calendar dateToCalendar(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package harmony.mastermind.logic.commands;

import java.util.Date;
import java.util.Set;

import harmony.mastermind.commons.exceptions.IllegalValueException;
import harmony.mastermind.commons.exceptions.InvalidEventDateException;


//@@author A0138862W
/*
* AddCommandBuilder provides a safe way to create an AddCommand
*
*/
public class AddCommandBuilder {
public String name;
public Date startDate;
public Date endDate;
public Set<String> tags;
public String recur;

public AddCommandBuilder(String name) {
this.name = name;
}

public AddCommandBuilder asEvent(Date startDate, Date endDate) throws InvalidEventDateException{
if (startDate.after(endDate)) {
throw new InvalidEventDateException();
}

this.startDate = startDate;
this.endDate = endDate;
return this;
}

public AddCommandBuilder asDeadline(Date endDate) {
this.startDate = null;
this.endDate = endDate;
return this;
}

public AddCommandBuilder withTags(Set<String> tags) throws IllegalValueException {
this.tags = tags;
return this;
}

public AddCommandBuilder asRecurring(String recur) {
this.recur = recur;
return this;
}

public AddCommand build() throws IllegalValueException, InvalidEventDateException {
return new AddCommand(this);
}

public boolean isFloating() {
return startDate == null
&& endDate == null;
}

public boolean isDeadline() {
return startDate == null
&& endDate != null;
}

public boolean isEvent() {
return startDate != null
&& endDate != null;
}

public boolean isRecurring() {
return this.recur != null;
}

public String getName() {
return name;
}

public Date getStartDate() {
return startDate;
}

public Date getEndDate() {
return endDate;
}

public Set<String> getTags() {
return tags;
}

public String getRecur() {
return recur;
}

}
15 changes: 14 additions & 1 deletion src/main/java/harmony/mastermind/logic/commands/Command.java
Original file line number Diff line number Diff line change
@@ -7,8 +7,10 @@
import harmony.mastermind.commons.core.EventsCenter;
import harmony.mastermind.commons.core.Messages;
import harmony.mastermind.commons.events.ui.ExecuteCommandEvent;
import harmony.mastermind.commons.events.ui.HighlightLastActionedRowRequestEvent;
import harmony.mastermind.commons.events.ui.IncorrectCommandAttemptedEvent;
import harmony.mastermind.model.Model;
import harmony.mastermind.model.task.Task;
import harmony.mastermind.storage.Storage;
import harmony.mastermind.storage.StorageManager;

@@ -18,7 +20,6 @@
public abstract class Command {

// Social date parser
// @@author A0138862W
protected static final PrettyTimeParser prettyTimeParser = new PrettyTimeParser();

protected Model model;
@@ -58,4 +59,16 @@ protected void indicateAttemptToExecuteIncorrectCommand() {
EventsCenter.getInstance().post(new IncorrectCommandAttemptedEvent(this));
}

// @@author A0138862W
/**
* Raises an event to highlight the last action row in table
* This event should be subscribed by UiManager to update the table
*
* @param the row that contain the task that needs to be highlighted
*
*/
protected void requestHighlightLastActionedRow(Task task){
EventsCenter.getInstance().post(new HighlightLastActionedRowRequestEvent(task));
}

}
Original file line number Diff line number Diff line change
@@ -112,10 +112,5 @@ private void executeDelete() throws TaskNotFoundException, IndexOutOfBoundsExcep
model.deleteTask(toDelete);
}
}

// @@author A0138862W
private void requestHighlightLastActionedRow(Task task){
EventsCenter.getInstance().post(new HighlightLastActionedRowRequestEvent(task));
}

}
Original file line number Diff line number Diff line change
@@ -192,9 +192,4 @@ private void executeEdit() throws TaskNotFoundException, DuplicateTaskException,
model.addTask(editedTask);
}

// @@author A0138862W
private void requestHighlightLastActionedRow(Task task){
EventsCenter.getInstance().post(new HighlightLastActionedRowRequestEvent(task));
}

}
Original file line number Diff line number Diff line change
@@ -126,9 +126,4 @@ private void executeMark() throws TaskAlreadyMarkedException, IndexOutOfBoundsEx
}

}

// @@author A0138862W
private void requestHighlightLastActionedRow(Task task){
EventsCenter.getInstance().post(new HighlightLastActionedRowRequestEvent(task));
}
}
Original file line number Diff line number Diff line change
@@ -117,8 +117,4 @@ private void executeUnmark() throws IndexOutOfBoundsException, TaskNotFoundExcep
model.unmarkTask(taskToUnmark);
}

// @@author A0138862W
private void requestHighlightLastActionedRow(Task task){
EventsCenter.getInstance().post(new HighlightLastActionedRowRequestEvent(task));
}
}
130 changes: 52 additions & 78 deletions src/main/java/harmony/mastermind/logic/parser/Parser.java
Original file line number Diff line number Diff line change
@@ -142,98 +142,72 @@ public Command parseCommand(String userInput, String currentTab) {
*/
// @@author A0138862W
private Command prepareAdd(String args) {
final Matcher matcher = AddCommand.COMMAND_ARGUMENTS_PATTERN.matcher(args.trim());

// Validate arg string format
if (!matcher.matches()) {
return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_EXAMPLES));
}

try {

// mandatory
// there's no need to check for existence as the regex only capture full match of mandatory components
final Matcher matcher = AddCommand.COMMAND_ARGUMENTS_PATTERN.matcher(args.trim());

// Validate user command input
if (!matcher.matches()) {
return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_EXAMPLES));
}

// mandatory field
final String name = matcher.group("name");

// at this point name variable should never be null because the regex only capture full match of mandatory components
// check for bug in regex expression if the following throws assertion error
assert name != null;

// optionals
final Optional<String> recur = Optional.ofNullable(matcher.group("recur"));
final Optional<String> dates = Optional.ofNullable(matcher.group("dates"));
Optional<String> startDate = Optional.empty();
Optional<String> endDate = Optional.empty();
final Optional<String> tags = Optional.ofNullable(matcher.group("tags"));

if(dates.isPresent()){
PrettyTimeParser ptp = new PrettyTimeParser();
List<DateGroup> dateGroups = ptp.parseSyntax(dates.get());

if(!dateGroups.isEmpty()){
List<Date> startEndDates = dateGroups.get(0).getDates();

if(startEndDates.size() == 1){ // only 1 date is found, assume deadline
startDate = Optional.empty();
endDate = Optional.ofNullable(startEndDates.get(0).toString());
}else if(startEndDates.size() == 2){ // 2 date value is found, assume event
startDate = Optional.ofNullable(startEndDates.get(0).toString());
endDate = Optional.ofNullable(startEndDates.get(1).toString());
}
}
}

final Optional<String> recur = Optional.ofNullable(matcher.group("recur"));

// return internal value if present. else, return empty string
Set<String> tagSet = getTagsFromArgs(tags.map(val -> val).orElse(""));
String recurVal = null;
final Set<String> tagSet = getTagsFromArgs(tags.map(val -> val).orElse(""));

//check if recur has a valid keyword
if (recur.isPresent()) {
recurVal = recur.get();
}
// after init every capturing groups, we start to build the command
AddCommandBuilder addCommandBuilder = buildAddCommand(name, dates, recur, tagSet);

if (startDate.isPresent() && endDate.isPresent()) {
// event
String start = startDate.get().toLowerCase();
String end = endDate.get().toLowerCase();

if (start.equals("today")) {
start += " 2359";
}else if (start.equals("tomorrow")) {
start += " 2359";
}
if (end.equals("today")) {
end += " 2359";
}else if (start.equals("tomorrow")) {
end += " 2359";
}


try {
return new AddCommand(name, start, end, tagSet, recurVal, mem);
} catch (InvalidEventDateException iede) {
return new IncorrectCommand(iede.getMessage());
}
} else if (!startDate.isPresent() && endDate.isPresent()) {
// deadline
String end = endDate.get().toLowerCase();
return addCommandBuilder.build();
} catch (IllegalValueException | InvalidEventDateException e) {
return new IncorrectCommand(e.getMessage());
}
}

private AddCommandBuilder buildAddCommand(final String name, final Optional<String> dates, final Optional<String> recur, final Set<String> tagSet) throws IllegalValueException, InvalidEventDateException {
AddCommandBuilder addCommandBuilder = new AddCommandBuilder(name);
addCommandBuilder.withTags(tagSet);
recur.ifPresent(recurVal -> addCommandBuilder.asRecurring(recurVal));

if(dates.isPresent()){
PrettyTimeParser ptp = new PrettyTimeParser();
List<DateGroup> parsedDates = ptp.parseSyntax(dates.get());

if(!parsedDates.isEmpty()){
List<Date> startEndDates = parsedDates.get(0).getDates();

if (end.equals("today")) {
end += " 2359";
}else if (end.equals("tomorrow")) {
end += " 2359";
/*
* We assume two conditions after parsing nlp dates:
* 1. Found only 1 date, then we assume it is a deadline
* 2. Found 2 dates, then we assume it is an event
*/
if(shouldParseAsDeadline(startEndDates)){
addCommandBuilder.asDeadline(startEndDates.get(0));
}else if(shouldParseAsEvent(startEndDates)){
addCommandBuilder.asEvent(startEndDates.get(0), startEndDates.get(1));
}

return new AddCommand(name, end, tagSet, recurVal, mem);
} else if (startDate.isPresent() && !endDate.isPresent()) {
// task with only startdate is not supported.
throw new IllegalValueException("Cannot create a task with only start date.");
} else {
// floating
return new AddCommand(name, tagSet, mem);
}


} catch (IllegalValueException ive) {
return new IncorrectCommand(ive.getMessage());
}
};
return addCommandBuilder;
}

private boolean shouldParseAsDeadline(List<Date> dates){
return dates.size() == 1;
}

private boolean shouldParseAsEvent(List<Date> dates){
return dates.size() == 2;
}

/**
10 changes: 10 additions & 0 deletions src/main/java/harmony/mastermind/model/task/Task.java
Original file line number Diff line number Diff line change
@@ -20,6 +20,16 @@ public class Task implements ReadOnlyTask {
private boolean isMarked;


public Task(TaskBuilder taskBuilder){
this.name = taskBuilder.getName();
this.startDate = taskBuilder.getStartDate();
this.endDate = taskBuilder.getEndDate();
this.createdDate = taskBuilder.getCreatedDate();
this.tags = taskBuilder.getTags();
this.recur = taskBuilder.getRecur();
this.isMarked = taskBuilder.isMarked();
}

// event
// @@author A0138862W
public Task(String name, Date startDate, Date endDate, UniqueTagList tags, String recur, Date createdDate) {
165 changes: 165 additions & 0 deletions src/main/java/harmony/mastermind/model/task/TaskBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
package harmony.mastermind.model.task;


//@@author A0138862W
import java.util.Date;
import java.util.Set;

import harmony.mastermind.commons.exceptions.IllegalValueException;
import harmony.mastermind.commons.exceptions.InvalidEventDateException;
import harmony.mastermind.model.tag.Tag;
import harmony.mastermind.model.tag.UniqueTagList;
import harmony.mastermind.model.tag.UniqueTagList.DuplicateTagException;

/**
* The TaskBuilder is a safe way to create a task object instead of relying on constructors.
* The Task has numerous attributes which depends on the nature of the task (event, floating, deadline),
* it must be build independently.
* <br/>
* The task builder provide a systematic way to build a task object and is future proof.
* Task Builder mitigates the problem of having too many parameters in Task constructor.
*
*/
public class TaskBuilder {

private final String name;
private Date startDate;
private Date endDate;
private Date createdDate;
private UniqueTagList tags;
private String recur;
private boolean isMarked;

/**
* creation date will automatically assigned upon initializing.
*
* @param name is mandatory field. The task name.
*
*/
public TaskBuilder(String name){
this.name = name;
this.createdDate = new Date();
}

/**
* build a floating task with both start and end dates are null
*
*/
public TaskBuilder asFloating(){
startDate = null;
endDate = null;
return this;
}

/**
* build an event with both valid start and end dates
*
* @param startDate is the start date of the event
* @param endDate is the end date of the event
*
* @throws InvalidEventDateException if start date is after end date
*
*/
public TaskBuilder asEvent(Date startDate, Date endDate) throws InvalidEventDateException{
if (startDate.after(endDate)) {
throw new InvalidEventDateException();
}

this.startDate = startDate;
this.endDate = endDate;

return this;
}

/**
* build a deadline task with only end date
*
* @param endDate is the due date.
*
*/
public TaskBuilder asDeadline(Date endDate){
this.startDate = null;
this.endDate = endDate;
return this;
}

public TaskBuilder withTags(Set<String> tagSet) throws IllegalValueException {
tags = new UniqueTagList();
for (String tag: tagSet) {
this.tags.add(new Tag(tag));
}
return this;
}

/**
* build a recurring task.
*
* @param recur can be daily, weekly, monthly, yearly
*
*/
public TaskBuilder asRecurring(String recur){
this.recur = recur;
return this;
}

/**
* Set a custom creation date. This will overwrite the auto assigned date.
*
* @param createdDate is the customized creation date
*
*/
public TaskBuilder withCreationDate(Date createdDate){
this.createdDate = createdDate;
return this;
}

/**
* build a task as marked task
*
*/
public TaskBuilder asMarked(){
this.isMarked = true;
return this;
}


/**
* finalize build and return a Task object
*
*/
public Task build(){
return new Task(this);
}

//@@author generated
public String getName() {
return name;
}
//@@author generated
public Date getStartDate() {
return startDate;
}
//@@author generated
public Date getEndDate() {
return endDate;
}
//@@author generated
public Date getCreatedDate() {
return createdDate;
}
//@@author generated
public UniqueTagList getTags() {
return tags;
}
//@@author generated
public String getRecur() {
return recur;
}
//@@author generated
public boolean isMarked() {
return isMarked;
}



}
4 changes: 2 additions & 2 deletions src/test/java/guitests/AddCommandTest.java
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import static org.junit.Assert.assertTrue;

public class AddCommandTest extends TaskManagerGuiTest {
/*

@Test
//@@author A0124797R
public void add() {
@@ -48,5 +48,5 @@ private void assertAddSuccess(TestTask taskToAdd, TestTask... currentList) {
assertTrue(taskListPanel.isListMatching(expectedList));

}
*/

}
19 changes: 14 additions & 5 deletions src/test/java/harmony/mastermind/testutil/TaskBuilder.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package harmony.mastermind.testutil;

import java.util.Set;

import harmony.mastermind.commons.exceptions.IllegalValueException;
import harmony.mastermind.model.tag.Tag;
import harmony.mastermind.model.tag.UniqueTagList.DuplicateTagException;
import harmony.mastermind.model.task.*;

/**
@@ -38,11 +41,17 @@ public TaskBuilder withRecur(String recur) {
this.task.setRecur(recur);
return this;
}


public TaskBuilder withTags(String ... tags) throws IllegalValueException {
for (String tag: tags) {
task.getTags().add(new Tag(tag));

public TaskBuilder withTags(String... tags) throws IllegalValueException{
for (String tagName : tags) {
task.getTags().add(new Tag(tagName));
}
return this;
}

public TaskBuilder withTags(Set<String> tags) throws IllegalValueException{
for (String tagName : tags) {
task.getTags().add(new Tag(tagName));
}
return this;
}