From 92350cfb7d9769d01e9090caff40e0767c995676 Mon Sep 17 00:00:00 2001 From: njyjn Date: Sat, 8 Oct 2016 01:27:02 +0800 Subject: [PATCH 001/196] Tags have been modified to accomodate '-' instead of 't/' --- src/main/java/seedu/address/logic/parser/Parser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/Parser.java b/src/main/java/seedu/address/logic/parser/Parser.java index 959b2cd0383c..3685f3349c76 100644 --- a/src/main/java/seedu/address/logic/parser/Parser.java +++ b/src/main/java/seedu/address/logic/parser/Parser.java @@ -31,7 +31,7 @@ public class Parser { + " (?p?)p/(?[^/]+)" + " (?p?)e/(?[^/]+)" + " (?p?)a/(?
[^/]+)" - + "(?(?: t/[^/]+)*)"); // variable number of tags + + "(?(?: -[^/]+)*)"); // variable number of tags public Parser() {} @@ -115,7 +115,7 @@ private static Set getTagsFromArgs(String tagArguments) throws IllegalVa return Collections.emptySet(); } // replace first delimiter prefix, then split - final Collection tagStrings = Arrays.asList(tagArguments.replaceFirst(" t/", "").split(" t/")); + final Collection tagStrings = Arrays.asList(tagArguments.replaceFirst(" -", "").split(" -")); return new HashSet<>(tagStrings); } From f916c2a0fc82da2bda72cf95ecfad5af935591d6 Mon Sep 17 00:00:00 2001 From: njyjn Date: Sat, 8 Oct 2016 01:31:34 +0800 Subject: [PATCH 002/196] Refactored PERSON... into TASK --- .../seedu/address/logic/parser/Parser.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/Parser.java b/src/main/java/seedu/address/logic/parser/Parser.java index 3685f3349c76..beec1fcbb0ff 100644 --- a/src/main/java/seedu/address/logic/parser/Parser.java +++ b/src/main/java/seedu/address/logic/parser/Parser.java @@ -21,12 +21,12 @@ public class Parser { */ private static final Pattern BASIC_COMMAND_FORMAT = Pattern.compile("(?\\S+)(?.*)"); - private static final Pattern PERSON_INDEX_ARGS_FORMAT = Pattern.compile("(?.+)"); + private static final Pattern TASK_INDEX_ARGS_FORMAT = Pattern.compile("(?.+)"); private static final Pattern KEYWORDS_ARGS_FORMAT = Pattern.compile("(?\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace - private static final Pattern PERSON_DATA_ARGS_FORMAT = // '/' forward slashes are reserved for delimiter prefixes + private static final Pattern TASK_DATA_ARGS_FORMAT = // '/' forward slashes are reserved for delimiter prefixes Pattern.compile("(?[^/]+)" + " (?p?)p/(?[^/]+)" + " (?p?)e/(?[^/]+)" @@ -81,13 +81,13 @@ public Command parseCommand(String userInput) { } /** - * Parses arguments in the context of the add person command. + * Parses arguments in the context of the add task command. * * @param args full command args string * @return the prepared command */ private Command prepareAdd(String args){ - final Matcher matcher = PERSON_DATA_ARGS_FORMAT.matcher(args.trim()); + final Matcher matcher = TASK_DATA_ARGS_FORMAT.matcher(args.trim()); // Validate arg string format if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); @@ -106,7 +106,7 @@ private Command prepareAdd(String args){ } /** - * Extracts the new person's tags from the add command's tag arguments string. + * Extracts the new task's tags from the add command's tag arguments string. * Merges duplicate tag strings. */ private static Set getTagsFromArgs(String tagArguments) throws IllegalValueException { @@ -120,7 +120,7 @@ private static Set getTagsFromArgs(String tagArguments) throws IllegalVa } /** - * Parses arguments in the context of the delete person command. + * Parses arguments in the context of the delete task command. * * @param args full command args string * @return the prepared command @@ -137,7 +137,7 @@ private Command prepareDelete(String args) { } /** - * Parses arguments in the context of the select person command. + * Parses arguments in the context of the select task command. * * @param args full command args string * @return the prepared command @@ -157,7 +157,7 @@ private Command prepareSelect(String args) { * Returns an {@code Optional.empty()} otherwise. */ private Optional parseIndex(String command) { - final Matcher matcher = PERSON_INDEX_ARGS_FORMAT.matcher(command.trim()); + final Matcher matcher = TASK_INDEX_ARGS_FORMAT.matcher(command.trim()); if (!matcher.matches()) { return Optional.empty(); } @@ -171,7 +171,7 @@ private Optional parseIndex(String command) { } /** - * Parses arguments in the context of the find person command. + * Parses arguments in the context of the find task command. * * @param args full command args string * @return the prepared command From 6f47c2c25531a2317bb9d75f10c127f76ec33617 Mon Sep 17 00:00:00 2001 From: njyjn Date: Sat, 8 Oct 2016 21:07:18 +0800 Subject: [PATCH 003/196] Created new regex string for data arguments format. To test. --- src/main/java/seedu/address/logic/parser/Parser.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/Parser.java b/src/main/java/seedu/address/logic/parser/Parser.java index beec1fcbb0ff..843319cc1c2a 100644 --- a/src/main/java/seedu/address/logic/parser/Parser.java +++ b/src/main/java/seedu/address/logic/parser/Parser.java @@ -27,10 +27,10 @@ public class Parser { Pattern.compile("(?\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace private static final Pattern TASK_DATA_ARGS_FORMAT = // '/' forward slashes are reserved for delimiter prefixes - Pattern.compile("(?[^/]+)" - + " (?p?)p/(?[^/]+)" - + " (?p?)e/(?[^/]+)" - + " (?p?)a/(?
[^/]+)" + Pattern.compile("(?
[^/-]+)" + + "\\sby\\s(?[^/-]+)|\\son\\s(?[^/-]+)" + + "\\sat\\s(?[^/-]+)" + + " /(?high|medium|low)" + "(?(?: -[^/]+)*)"); // variable number of tags public Parser() {} From c384aa28b935adc8abbdf760476e4c8f79be5eec Mon Sep 17 00:00:00 2001 From: njyjn Date: Sat, 8 Oct 2016 21:09:33 +0800 Subject: [PATCH 004/196] We modify pattern matcher grouping to fit our new regex. --- src/main/java/seedu/address/logic/parser/Parser.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/Parser.java b/src/main/java/seedu/address/logic/parser/Parser.java index 843319cc1c2a..41406cf13fc4 100644 --- a/src/main/java/seedu/address/logic/parser/Parser.java +++ b/src/main/java/seedu/address/logic/parser/Parser.java @@ -94,10 +94,10 @@ private Command prepareAdd(String args){ } try { return new AddCommand( - matcher.group("name"), - matcher.group("phone"), - matcher.group("email"), - matcher.group("address"), + matcher.group("details"), + matcher.group("dueByDate"), + matcher.group("dueByTime"), + matcher.group("priority"), getTagsFromArgs(matcher.group("tagArguments")) ); } catch (IllegalValueException ive) { From e5ed994cc9b3de2d12e071360ef95980f9a44c40 Mon Sep 17 00:00:00 2001 From: njyjn Date: Sat, 8 Oct 2016 22:13:59 +0800 Subject: [PATCH 005/196] We have begun refactoring instances of AddressBook, Person(s). --- .../seedu/address/commons/core/Messages.java | 2 +- .../address/logic/commands/AddCommand.java | 45 +++-- .../address/logic/commands/DeleteCommand.java | 2 +- .../address/logic/commands/SelectCommand.java | 2 +- .../java/seedu/address/model/AddressBook.java | 163 ------------------ ...AddressBook.java => ReadOnlyToDoList.java} | 6 +- .../java/seedu/address/model/ToDoList.java | 163 ++++++++++++++++++ ...sBookStorage.java => ToDoListStorage.java} | 0 .../seedu/address/logic/LogicManagerTest.java | 2 +- ...sBookBuilder.java => ToDoListBuilder.java} | 20 +-- 10 files changed, 207 insertions(+), 198 deletions(-) delete mode 100644 src/main/java/seedu/address/model/AddressBook.java rename src/main/java/seedu/address/model/{ReadOnlyAddressBook.java => ReadOnlyToDoList.java} (79%) create mode 100644 src/main/java/seedu/address/model/ToDoList.java rename src/main/java/seedu/address/storage/{AddressBookStorage.java => ToDoListStorage.java} (100%) rename src/test/java/seedu/address/testutil/{AddressBookBuilder.java => ToDoListBuilder.java} (51%) diff --git a/src/main/java/seedu/address/commons/core/Messages.java b/src/main/java/seedu/address/commons/core/Messages.java index 1deb3a1e4695..935f9965cda3 100644 --- a/src/main/java/seedu/address/commons/core/Messages.java +++ b/src/main/java/seedu/address/commons/core/Messages.java @@ -8,6 +8,6 @@ public class Messages { public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command"; public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s"; public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid"; - public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!"; + public static final String MESSAGE_TASKS_LISTED_OVERVIEW = "%1$d persons listed!"; } diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index 2860a9ab2a85..0262f76a1ab1 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -15,46 +15,55 @@ public class AddCommand extends Command { public static final String COMMAND_WORD = "add"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " - + "Parameters: NAME p/PHONE e/EMAIL a/ADDRESS [t/TAG]...\n" + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a task to the address book. " + + "Parameters:
by/on at