From beb44a0ae1b37cf7e82a4583a071c5be3c317208 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Sat, 27 Aug 2016 17:04:55 +0800 Subject: [PATCH 01/12] Encapsulate CommandResult --- src/seedu/addressbook/commands/CommandResult.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/seedu/addressbook/commands/CommandResult.java b/src/seedu/addressbook/commands/CommandResult.java index cf4e72585..f234ff506 100644 --- a/src/seedu/addressbook/commands/CommandResult.java +++ b/src/seedu/addressbook/commands/CommandResult.java @@ -11,7 +11,7 @@ public class CommandResult { /** The feedback message to be shown to the user. Contains a description of the execution result */ - public final String feedbackToUser; + private final String feedbackToUser; /** The list of persons that was produced by the command */ private final List relevantPersons; @@ -26,6 +26,10 @@ public CommandResult(String feedbackToUser, List relev this.relevantPersons = relevantPersons; } + public String getFeedbackToUser() { + return feedbackToUser; + } + /** * Returns list of persons relevant to the command command result, if any. */ From 45b1c4005bd5e574df949100e6f0f941c1d6978c Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Fri, 2 Sep 2016 00:25:24 +0800 Subject: [PATCH 02/12] Split Address into different classes --- .../addressbook/data/person/Address.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/seedu/addressbook/data/person/Address.java b/src/seedu/addressbook/data/person/Address.java index 8ac726444..c749c1ccc 100644 --- a/src/seedu/addressbook/data/person/Address.java +++ b/src/seedu/addressbook/data/person/Address.java @@ -14,6 +14,11 @@ public class Address { public final String value; private boolean isPrivate; + private String theBlock; + private String theStreet; + private String theUnit; + private String thePostalCode; + /** * Validates given address. @@ -26,11 +31,37 @@ public Address(String address, boolean isPrivate) throws IllegalValueException { throw new IllegalValueException(MESSAGE_ADDRESS_CONSTRAINTS); } this.value = address; + splitAddress(); } - + /** - * Returns true if a given string is a valid person email. + * Splits address into different classes */ + public void splitAddress() { + String[] parts = new String[4]; + parts = value.split(", "); + theBlock = parts[0]; + theStreet = parts[1]; + theUnit = parts[2]; + thePostalCode = parts[3]; + } + + public String getTheBlock() { + return theBlock; + } + + public String getTheStreet() { + return theStreet; + } + + public String getTheUnit() { + return theUnit; + } + + public String getThePostalCode() { + return thePostalCode; + } + public static boolean isValidAddress(String test) { return test.matches(ADDRESS_VALIDATION_REGEX); } From d5b16db06bd484d985a9e8ce4a0ea3d4353e2bfa Mon Sep 17 00:00:00 2001 From: Leow Yijin Date: Sat, 27 Aug 2016 10:23:28 +0800 Subject: [PATCH 03/12] Revert "regression test for #35" This reverts commit 1ed45b79f8ba48919029686b83aa63a1bcc12603. --- test/expected.txt | 9 --------- test/input.txt | 9 --------- 2 files changed, 18 deletions(-) diff --git a/test/expected.txt b/test/expected.txt index 7196c699f..37d60c78a 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -30,15 +30,6 @@ || exit: Exits the program. || Example: exit || =================================================== -|| Enter command: || [Command entered: delete 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: view 1] -|| The person index provided is invalid -|| =================================================== -|| Enter command: || [Command entered: viewall 1] -|| The person index provided is invalid -|| =================================================== || Enter command: || [Command entered: clear] || Address book has been cleared! || =================================================== diff --git a/test/input.txt b/test/input.txt index 5ecae97f8..3d8d88237 100644 --- a/test/input.txt +++ b/test/input.txt @@ -5,15 +5,6 @@ # should recognise invalid command sfdfd -########################################################## -# commands using list index before any listing created -########################################################## - - # should show appropriate message when no listing has happened yet - delete 1 - view 1 - viewall 1 - ########################################################## # clean and check state ########################################################## From 1c42022d7df3c974165e31a0620f341eadf45a47 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Thu, 8 Sep 2016 21:42:16 +0800 Subject: [PATCH 04/12] Convert Parser to class-level method --- src/seedu/addressbook/parser/Parser.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java index 7d8b944d7..c733d1115 100644 --- a/src/seedu/addressbook/parser/Parser.java +++ b/src/seedu/addressbook/parser/Parser.java @@ -50,7 +50,7 @@ public Parser() {} * @param userInput full user input string * @return the command based on the user input */ - public Command parseCommand(String userInput) { + public static Command parseCommand(String userInput) { final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim()); if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE)); @@ -96,7 +96,7 @@ public Command parseCommand(String userInput) { * @param args full command args string * @return the prepared command */ - private Command prepareAdd(String args){ + private static Command prepareAdd(String args){ final Matcher matcher = PERSON_DATA_ARGS_FORMAT.matcher(args.trim()); // Validate arg string format if (!matcher.matches()) { @@ -150,7 +150,7 @@ private static Set getTagsFromArgs(String tagArguments) throws IllegalVa * @param args full command args string * @return the prepared command */ - private Command prepareDelete(String args) { + private static Command prepareDelete(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); return new DeleteCommand(targetIndex); @@ -167,7 +167,7 @@ private Command prepareDelete(String args) { * @param args full command args string * @return the prepared command */ - private Command prepareView(String args) { + private static Command prepareView(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); @@ -186,7 +186,7 @@ private Command prepareView(String args) { * @param args full command args string * @return the prepared command */ - private Command prepareViewAll(String args) { + private static Command prepareViewAll(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); @@ -207,7 +207,7 @@ private Command prepareViewAll(String args) { * @throws ParseException if no region of the args string could be found for the index * @throws NumberFormatException the args string region is not a valid number */ - private int parseArgsAsDisplayedIndex(String args) throws ParseException, NumberFormatException { + private static int parseArgsAsDisplayedIndex(String args) throws ParseException, NumberFormatException { final Matcher matcher = PERSON_INDEX_ARGS_FORMAT.matcher(args.trim()); if (!matcher.matches()) { throw new ParseException("Could not find index number to parse"); @@ -222,7 +222,7 @@ private int parseArgsAsDisplayedIndex(String args) throws ParseException, Number * @param args full command args string * @return the prepared command */ - private Command prepareFind(String args) { + private static Command prepareFind(String args) { final Matcher matcher = KEYWORDS_ARGS_FORMAT.matcher(args.trim()); if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, From 8c69e0dc8e18f3329b6901adb819b13f67e0d111 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Thu, 8 Sep 2016 21:42:16 +0800 Subject: [PATCH 05/12] Revert "Convert Parser to class-level method" This reverts commit 1c42022d7df3c974165e31a0620f341eadf45a47. --- src/seedu/addressbook/parser/Parser.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java index c733d1115..7d8b944d7 100644 --- a/src/seedu/addressbook/parser/Parser.java +++ b/src/seedu/addressbook/parser/Parser.java @@ -50,7 +50,7 @@ public Parser() {} * @param userInput full user input string * @return the command based on the user input */ - public static Command parseCommand(String userInput) { + public Command parseCommand(String userInput) { final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim()); if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE)); @@ -96,7 +96,7 @@ public static Command parseCommand(String userInput) { * @param args full command args string * @return the prepared command */ - private static Command prepareAdd(String args){ + private Command prepareAdd(String args){ final Matcher matcher = PERSON_DATA_ARGS_FORMAT.matcher(args.trim()); // Validate arg string format if (!matcher.matches()) { @@ -150,7 +150,7 @@ private static Set getTagsFromArgs(String tagArguments) throws IllegalVa * @param args full command args string * @return the prepared command */ - private static Command prepareDelete(String args) { + private Command prepareDelete(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); return new DeleteCommand(targetIndex); @@ -167,7 +167,7 @@ private static Command prepareDelete(String args) { * @param args full command args string * @return the prepared command */ - private static Command prepareView(String args) { + private Command prepareView(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); @@ -186,7 +186,7 @@ private static Command prepareView(String args) { * @param args full command args string * @return the prepared command */ - private static Command prepareViewAll(String args) { + private Command prepareViewAll(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); @@ -207,7 +207,7 @@ private static Command prepareViewAll(String args) { * @throws ParseException if no region of the args string could be found for the index * @throws NumberFormatException the args string region is not a valid number */ - private static int parseArgsAsDisplayedIndex(String args) throws ParseException, NumberFormatException { + private int parseArgsAsDisplayedIndex(String args) throws ParseException, NumberFormatException { final Matcher matcher = PERSON_INDEX_ARGS_FORMAT.matcher(args.trim()); if (!matcher.matches()) { throw new ParseException("Could not find index number to parse"); @@ -222,7 +222,7 @@ private static int parseArgsAsDisplayedIndex(String args) throws ParseException, * @param args full command args string * @return the prepared command */ - private static Command prepareFind(String args) { + private Command prepareFind(String args) { final Matcher matcher = KEYWORDS_ARGS_FORMAT.matcher(args.trim()); if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, From 30d7ec3aa69e7af1f5d146a0d43566ab65cdef82 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Thu, 8 Sep 2016 22:01:28 +0800 Subject: [PATCH 06/12] Convert to class-level method --- src/seedu/addressbook/parser/Parser.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/seedu/addressbook/parser/Parser.java b/src/seedu/addressbook/parser/Parser.java index 7d8b944d7..c733d1115 100644 --- a/src/seedu/addressbook/parser/Parser.java +++ b/src/seedu/addressbook/parser/Parser.java @@ -50,7 +50,7 @@ public Parser() {} * @param userInput full user input string * @return the command based on the user input */ - public Command parseCommand(String userInput) { + public static Command parseCommand(String userInput) { final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim()); if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE)); @@ -96,7 +96,7 @@ public Command parseCommand(String userInput) { * @param args full command args string * @return the prepared command */ - private Command prepareAdd(String args){ + private static Command prepareAdd(String args){ final Matcher matcher = PERSON_DATA_ARGS_FORMAT.matcher(args.trim()); // Validate arg string format if (!matcher.matches()) { @@ -150,7 +150,7 @@ private static Set getTagsFromArgs(String tagArguments) throws IllegalVa * @param args full command args string * @return the prepared command */ - private Command prepareDelete(String args) { + private static Command prepareDelete(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); return new DeleteCommand(targetIndex); @@ -167,7 +167,7 @@ private Command prepareDelete(String args) { * @param args full command args string * @return the prepared command */ - private Command prepareView(String args) { + private static Command prepareView(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); @@ -186,7 +186,7 @@ private Command prepareView(String args) { * @param args full command args string * @return the prepared command */ - private Command prepareViewAll(String args) { + private static Command prepareViewAll(String args) { try { final int targetIndex = parseArgsAsDisplayedIndex(args); @@ -207,7 +207,7 @@ private Command prepareViewAll(String args) { * @throws ParseException if no region of the args string could be found for the index * @throws NumberFormatException the args string region is not a valid number */ - private int parseArgsAsDisplayedIndex(String args) throws ParseException, NumberFormatException { + private static int parseArgsAsDisplayedIndex(String args) throws ParseException, NumberFormatException { final Matcher matcher = PERSON_INDEX_ARGS_FORMAT.matcher(args.trim()); if (!matcher.matches()) { throw new ParseException("Could not find index number to parse"); @@ -222,7 +222,7 @@ private int parseArgsAsDisplayedIndex(String args) throws ParseException, Number * @param args full command args string * @return the prepared command */ - private Command prepareFind(String args) { + private static Command prepareFind(String args) { final Matcher matcher = KEYWORDS_ARGS_FORMAT.matcher(args.trim()); if (!matcher.matches()) { return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, From fd0e9f2381c56e915ecaccec1b543a28e18e3de7 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Fri, 9 Sep 2016 00:05:08 +0800 Subject: [PATCH 07/12] Add sequence to persons --- src/seedu/addressbook/data/person/Person.java | 5 +++++ src/seedu/addressbook/ui/TextUi.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/seedu/addressbook/data/person/Person.java b/src/seedu/addressbook/data/person/Person.java index cf6211841..a4b5e649c 100644 --- a/src/seedu/addressbook/data/person/Person.java +++ b/src/seedu/addressbook/data/person/Person.java @@ -14,8 +14,10 @@ public class Person implements ReadOnlyPerson { private Phone phone; private Email email; private Address address; + public int sequenceNumber; private final UniqueTagList tags; + public static int nextSequenceNumber = 0; /** * Assumption: Every field must be present and not null. */ @@ -25,6 +27,9 @@ public Person(Name name, Phone phone, Email email, Address address, UniqueTagLis this.email = email; this.address = address; this.tags = new UniqueTagList(tags); // protect internal tags from changes in the arg list + nextSequenceNumber++; + this.sequenceNumber = nextSequenceNumber; + } /** diff --git a/src/seedu/addressbook/ui/TextUi.java b/src/seedu/addressbook/ui/TextUi.java index 39a2c6615..8442aa2fe 100644 --- a/src/seedu/addressbook/ui/TextUi.java +++ b/src/seedu/addressbook/ui/TextUi.java @@ -126,7 +126,7 @@ public void showResultToUser(CommandResult result) { if(resultPersons.isPresent()) { showPersonListView(resultPersons.get()); } - showToUser(result.feedbackToUser, DIVIDER); + showToUser(result.getFeedbackToUser(), DIVIDER); } /** From 08ed384f5cafdf56e68c2e6ba1078f4d8e7ab181 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Fri, 9 Sep 2016 01:44:36 +0800 Subject: [PATCH 08/12] Use inheritance by creating contact class --- .../addressbook/data/person/Address.java | 60 ++----------------- .../addressbook/data/person/Contact.java | 21 +++++++ src/seedu/addressbook/data/person/Email.java | 24 +------- src/seedu/addressbook/data/person/Phone.java | 22 +------ 4 files changed, 30 insertions(+), 97 deletions(-) create mode 100644 src/seedu/addressbook/data/person/Contact.java diff --git a/src/seedu/addressbook/data/person/Address.java b/src/seedu/addressbook/data/person/Address.java index c749c1ccc..4dbd68e9c 100644 --- a/src/seedu/addressbook/data/person/Address.java +++ b/src/seedu/addressbook/data/person/Address.java @@ -6,84 +6,34 @@ * Represents a Person's address in the address book. * Guarantees: immutable; is valid as declared in {@link #isValidAddress(String)} */ -public class Address { +public class Address extends Contact{ public static final String EXAMPLE = "123, some street"; public static final String MESSAGE_ADDRESS_CONSTRAINTS = "Person addresses can be in any format"; public static final String ADDRESS_VALIDATION_REGEX = ".+"; - public final String value; - private boolean isPrivate; - private String theBlock; - private String theStreet; - private String theUnit; - private String thePostalCode; - - /** * Validates given address. * * @throws IllegalValueException if given address string is invalid. */ public Address(String address, boolean isPrivate) throws IllegalValueException { - this.isPrivate = isPrivate; + super(address, isPrivate); + //this.isPrivate = isPrivate; if (!isValidAddress(address)) { throw new IllegalValueException(MESSAGE_ADDRESS_CONSTRAINTS); } - this.value = address; - splitAddress(); - } - - /** - * Splits address into different classes - */ - public void splitAddress() { - String[] parts = new String[4]; - parts = value.split(", "); - theBlock = parts[0]; - theStreet = parts[1]; - theUnit = parts[2]; - thePostalCode = parts[3]; - } - - public String getTheBlock() { - return theBlock; - } - - public String getTheStreet() { - return theStreet; } - - public String getTheUnit() { - return theUnit; - } - - public String getThePostalCode() { - return thePostalCode; - } - + public static boolean isValidAddress(String test) { return test.matches(ADDRESS_VALIDATION_REGEX); } - @Override - public String toString() { - return value; - } - @Override public boolean equals(Object other) { return other == this // short circuit if same object || (other instanceof Address // instanceof handles nulls && this.value.equals(((Address) other).value)); // state check } - - @Override - public int hashCode() { - return value.hashCode(); - } - - public boolean isPrivate() { - return isPrivate; - } + } \ No newline at end of file diff --git a/src/seedu/addressbook/data/person/Contact.java b/src/seedu/addressbook/data/person/Contact.java new file mode 100644 index 000000000..c1d737d2b --- /dev/null +++ b/src/seedu/addressbook/data/person/Contact.java @@ -0,0 +1,21 @@ +package seedu.addressbook.data.person; + +public class Contact { + public final String value; + private boolean isPrivate; + + public Contact(String newStr, boolean isPrivate) { + this.isPrivate = isPrivate; + value = newStr.trim(); + } + + public int hashCode() { + return value.hashCode(); + } + public boolean isPrivate() { + return isPrivate; + } + public String toString() { + return value; + } +} diff --git a/src/seedu/addressbook/data/person/Email.java b/src/seedu/addressbook/data/person/Email.java index c946f1eb3..0f9f5e163 100644 --- a/src/seedu/addressbook/data/person/Email.java +++ b/src/seedu/addressbook/data/person/Email.java @@ -6,28 +6,23 @@ * Represents a Person's email in the address book. * Guarantees: immutable; is valid as declared in {@link #isValidEmail(String)} */ -public class Email { +public class Email extends Contact { public static final String EXAMPLE = "valid@e.mail"; public static final String MESSAGE_EMAIL_CONSTRAINTS = "Person emails should be 2 alphanumeric/period strings separated by '@'"; public static final String EMAIL_VALIDATION_REGEX = "[\\w\\.]+@[\\w\\.]+"; - public final String value; - private boolean isPrivate; - /** * Validates given email. * * @throws IllegalValueException if given email address string is invalid. */ public Email(String email, boolean isPrivate) throws IllegalValueException { - this.isPrivate = isPrivate; - email = email.trim(); + super(email, isPrivate); if (!isValidEmail(email)) { throw new IllegalValueException(MESSAGE_EMAIL_CONSTRAINTS); } - this.value = email; } /** @@ -37,25 +32,10 @@ public static boolean isValidEmail(String test) { return test.matches(EMAIL_VALIDATION_REGEX); } - @Override - public String toString() { - return value; - } - @Override public boolean equals(Object other) { return other == this // short circuit if same object || (other instanceof Email // instanceof handles nulls && this.value.equals(((Email) other).value)); // state check } - - @Override - public int hashCode() { - return value.hashCode(); - } - - - public boolean isPrivate() { - return isPrivate; - } } \ No newline at end of file diff --git a/src/seedu/addressbook/data/person/Phone.java b/src/seedu/addressbook/data/person/Phone.java index b5a556de4..38a842d0f 100644 --- a/src/seedu/addressbook/data/person/Phone.java +++ b/src/seedu/addressbook/data/person/Phone.java @@ -6,14 +6,12 @@ * Represents a Person's phone number in the address book. * Guarantees: immutable; is valid as declared in {@link #isValidPhone(String)} */ -public class Phone { +public class Phone extends Contact { public static final String EXAMPLE = "123456789"; public static final String MESSAGE_PHONE_CONSTRAINTS = "Person phone numbers should only contain numbers"; public static final String PHONE_VALIDATION_REGEX = "\\d+"; - public final String value; - private boolean isPrivate; /** * Validates given phone number. @@ -21,12 +19,10 @@ public class Phone { * @throws IllegalValueException if given phone string is invalid. */ public Phone(String phone, boolean isPrivate) throws IllegalValueException { - this.isPrivate = isPrivate; - phone = phone.trim(); + super(phone, isPrivate); if (!isValidPhone(phone)) { throw new IllegalValueException(MESSAGE_PHONE_CONSTRAINTS); } - this.value = phone; } /** @@ -36,24 +32,10 @@ public static boolean isValidPhone(String test) { return test.matches(PHONE_VALIDATION_REGEX); } - @Override - public String toString() { - return value; - } - @Override public boolean equals(Object other) { return other == this // short circuit if same object || (other instanceof Phone // instanceof handles nulls && this.value.equals(((Phone) other).value)); // state check } - - @Override - public int hashCode() { - return value.hashCode(); - } - - public boolean isPrivate() { - return isPrivate; - } } From 6ba8f6e638ea89e397f8579b2f452f3cf133c0a1 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Fri, 16 Sep 2016 16:54:50 +0800 Subject: [PATCH 09/12] Insert user story --- doc/DeveloperGuide.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/DeveloperGuide.md b/doc/DeveloperGuide.md index 0714750cf..fcc0a3345 100644 --- a/doc/DeveloperGuide.md +++ b/doc/DeveloperGuide.md @@ -7,6 +7,20 @@ * JDK 8 or later * Eclipse IDE +**UserStories** +Level of Importance(*, * *, * * *) | Name of function | Purpose of function +1. *** | Find Command | To find the person in the address book. +2. *** | List Command | To present all persons in the address book in a list. +3. *** | Add Command | To add new person into the address book. +3. *** | Edit Command | To edit details of the persons in the address book. +4. *** | Help Command | To help persons familiarize with the address book interface and commands. +5. * * | Delete Command | To remove the persons from the address book. +6. * * | Tag Command | To tag the persons with a tag (e.g. friends, family). +7. * | RemoveTag Command | Removing the tag from a person. +8. * | Edit Tag Command | Editing a person's tag. +9. * | Exit command | Exit the program. + + **Importing the project into Eclipse** 0. Fork this repo, and clone the fork to your computer From 89460a9df6c09f185fd61fa1f7e17c2fe101d7e2 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Sat, 17 Sep 2016 09:46:01 +0800 Subject: [PATCH 10/12] Add Use Case --- doc/DeveloperGuide.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/DeveloperGuide.md b/doc/DeveloperGuide.md index fcc0a3345..4c8185e7b 100644 --- a/doc/DeveloperGuide.md +++ b/doc/DeveloperGuide.md @@ -20,6 +20,13 @@ Level of Importance(*, * *, * * *) | Name of function | Purpose of function 8. * | Edit Tag Command | Editing a person's tag. 9. * | Exit command | Exit the program. +**Use Case for Rename Tag** +1. User will use list command to request for the list of persons in address book. +2. AddressBook will list the persons. +3. User will find the specific person and request to change the tag of the person. +4. AddressBook will ask to confirm the change. +5. User will confirm the change and a notification will appear showing the change is successful. + **Importing the project into Eclipse** From e4e1ee77cf7cba06b399b9c0854a6cbe1f579ccf Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Sat, 17 Sep 2016 09:53:31 +0800 Subject: [PATCH 11/12] Add non-functional requirement --- doc/DeveloperGuide.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/DeveloperGuide.md b/doc/DeveloperGuide.md index 4c8185e7b..dfcde048c 100644 --- a/doc/DeveloperGuide.md +++ b/doc/DeveloperGuide.md @@ -27,6 +27,11 @@ Level of Importance(*, * *, * * *) | Name of function | Purpose of function 4. AddressBook will ask to confirm the change. 5. User will confirm the change and a notification will appear showing the change is successful. +**Non-Functional Requirements ** +1. AddressBook should be able to store up to 1000 person. +2. AddressBook should be user friendly. +3. AddressBook should run fast (~1/2 seconds) +4. The size of the program should be small. **Importing the project into Eclipse** From cb8082ca8babd4a73e5ba596544827aafca639f3 Mon Sep 17 00:00:00 2001 From: Lim Hong Wei Date: Sat, 17 Sep 2016 10:17:24 +0800 Subject: [PATCH 12/12] Add polymorphic is mutating method --- src/seedu/addressbook/commands/AddCommand.java | 3 +++ src/seedu/addressbook/commands/ClearCommand.java | 4 ++++ src/seedu/addressbook/commands/DeleteCommand.java | 5 ++++- src/seedu/addressbook/commands/ExitCommand.java | 5 +++++ src/seedu/addressbook/commands/FindCommand.java | 4 ++++ src/seedu/addressbook/commands/HelpCommand.java | 3 +++ src/seedu/addressbook/commands/IncorrectCommand.java | 4 ++++ src/seedu/addressbook/commands/ListCommand.java | 5 +++++ src/seedu/addressbook/commands/ViewAllCommand.java | 5 +++++ 9 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/seedu/addressbook/commands/AddCommand.java b/src/seedu/addressbook/commands/AddCommand.java index 7ed3cf359..086990a8c 100644 --- a/src/seedu/addressbook/commands/AddCommand.java +++ b/src/seedu/addressbook/commands/AddCommand.java @@ -67,4 +67,7 @@ public CommandResult execute() { } } + public boolean isMutating() { + return true; + } } diff --git a/src/seedu/addressbook/commands/ClearCommand.java b/src/seedu/addressbook/commands/ClearCommand.java index f1bafb8a2..b72f3179b 100644 --- a/src/seedu/addressbook/commands/ClearCommand.java +++ b/src/seedu/addressbook/commands/ClearCommand.java @@ -22,4 +22,8 @@ public CommandResult execute() { addressBook.clear(); return new CommandResult(MESSAGE_SUCCESS); } + + public boolean isMutating() { + return true; + } } diff --git a/src/seedu/addressbook/commands/DeleteCommand.java b/src/seedu/addressbook/commands/DeleteCommand.java index 493d75da6..425c5cb63 100644 --- a/src/seedu/addressbook/commands/DeleteCommand.java +++ b/src/seedu/addressbook/commands/DeleteCommand.java @@ -38,5 +38,8 @@ public CommandResult execute() { return new CommandResult(Messages.MESSAGE_PERSON_NOT_IN_ADDRESSBOOK); } } - + + public boolean isMutating() { + return true; + } } diff --git a/src/seedu/addressbook/commands/ExitCommand.java b/src/seedu/addressbook/commands/ExitCommand.java index 2f280395c..5ab924297 100644 --- a/src/seedu/addressbook/commands/ExitCommand.java +++ b/src/seedu/addressbook/commands/ExitCommand.java @@ -19,4 +19,9 @@ public CommandResult execute() { public static boolean isExit(Command command) { return command instanceof ExitCommand; // instanceof returns false if it is null } + public boolean isMutating() { + return false; + } + + } diff --git a/src/seedu/addressbook/commands/FindCommand.java b/src/seedu/addressbook/commands/FindCommand.java index 8937e08da..eb97b241a 100644 --- a/src/seedu/addressbook/commands/FindCommand.java +++ b/src/seedu/addressbook/commands/FindCommand.java @@ -52,5 +52,9 @@ private List getPersonsWithNameContainingAnyKeyword(Set } return matchedPersons; } + + public boolean isMutating() { + return false; + } } diff --git a/src/seedu/addressbook/commands/HelpCommand.java b/src/seedu/addressbook/commands/HelpCommand.java index 8a36e8337..d9ec028db 100644 --- a/src/seedu/addressbook/commands/HelpCommand.java +++ b/src/seedu/addressbook/commands/HelpCommand.java @@ -27,4 +27,7 @@ public CommandResult execute() { + "\n" + ExitCommand.MESSAGE_USAGE ); } + public boolean isMutating() { + return false; + } } diff --git a/src/seedu/addressbook/commands/IncorrectCommand.java b/src/seedu/addressbook/commands/IncorrectCommand.java index 81abba7a1..0d532c857 100644 --- a/src/seedu/addressbook/commands/IncorrectCommand.java +++ b/src/seedu/addressbook/commands/IncorrectCommand.java @@ -17,4 +17,8 @@ public CommandResult execute() { return new CommandResult(feedbackToUser); } + public boolean isMutating() { + return false; + } + } diff --git a/src/seedu/addressbook/commands/ListCommand.java b/src/seedu/addressbook/commands/ListCommand.java index d76d48297..be6eeb4a5 100644 --- a/src/seedu/addressbook/commands/ListCommand.java +++ b/src/seedu/addressbook/commands/ListCommand.java @@ -22,4 +22,9 @@ public CommandResult execute() { List allPersons = addressBook.getAllPersons().immutableListView(); return new CommandResult(getMessageForPersonListShownSummary(allPersons), allPersons); } + + public boolean isMutating() { + return false; + } + } diff --git a/src/seedu/addressbook/commands/ViewAllCommand.java b/src/seedu/addressbook/commands/ViewAllCommand.java index 0067304bb..9fa3ae0af 100644 --- a/src/seedu/addressbook/commands/ViewAllCommand.java +++ b/src/seedu/addressbook/commands/ViewAllCommand.java @@ -37,4 +37,9 @@ public CommandResult execute() { return new CommandResult(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); } } + + public boolean isMutating() { + return false; + } + }