From 337aa48e54f82b771927dbc7d544e72af866f1bc Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 17:21:20 +0800 Subject: [PATCH 01/17] Add sort command to sort list by name --- .../address/logic/commands/SortCommand.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/main/java/seedu/address/logic/commands/SortCommand.java diff --git a/src/main/java/seedu/address/logic/commands/SortCommand.java b/src/main/java/seedu/address/logic/commands/SortCommand.java new file mode 100644 index 00000000000..9c86b1fa6e4 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/SortCommand.java @@ -0,0 +1,23 @@ +package seedu.address.logic.commands; + +import static java.util.Objects.requireNonNull; + +import seedu.address.model.AddressBook; +import seedu.address.model.Model; + +/** + * Clears the address book. + */ +public class ClearCommand extends Command { + + public static final String COMMAND_WORD = "clear"; + public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; + + + @Override + public CommandResult execute(Model model) { + requireNonNull(model); + model.setAddressBook(new AddressBook()); + return new CommandResult(MESSAGE_SUCCESS); + } +} From 0b0c838b360f5c902b4aa77dae1bf38bec865aa3 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 17:35:14 +0800 Subject: [PATCH 02/17] Fix build.gradle issue with SortCommand --- .../address/logic/commands/SortCommand.java | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/SortCommand.java b/src/main/java/seedu/address/logic/commands/SortCommand.java index 9c86b1fa6e4..4bbc829395b 100644 --- a/src/main/java/seedu/address/logic/commands/SortCommand.java +++ b/src/main/java/seedu/address/logic/commands/SortCommand.java @@ -1,23 +1,2 @@ -package seedu.address.logic.commands; - -import static java.util.Objects.requireNonNull; - -import seedu.address.model.AddressBook; -import seedu.address.model.Model; - -/** - * Clears the address book. - */ -public class ClearCommand extends Command { - - public static final String COMMAND_WORD = "clear"; - public static final String MESSAGE_SUCCESS = "Address book has been cleared!"; - - - @Override - public CommandResult execute(Model model) { - requireNonNull(model); - model.setAddressBook(new AddressBook()); - return new CommandResult(MESSAGE_SUCCESS); - } +package seedu.address.logic.commands;public class SortCommand { } From b01c5541e38e7f8768991b409d516e42a4f7c2a6 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 17:42:09 +0800 Subject: [PATCH 03/17] Fix checkstyle --- .../address/logic/commands/ListCommand.java | 1 - .../address/logic/commands/SortCommand.java | 22 ++++++++++++++++++- .../logic/parser/AddressBookParser.java | 14 ++++-------- .../java/seedu/address/model/AddressBook.java | 9 +++++++- src/main/java/seedu/address/model/Model.java | 3 +++ .../seedu/address/model/ModelManager.java | 21 ++++++++++++------ .../seedu/address/model/person/Person.java | 4 ++++ .../model/person/UniquePersonList.java | 9 ++++++++ 8 files changed, 63 insertions(+), 20 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/ListCommand.java b/src/main/java/seedu/address/logic/commands/ListCommand.java index 84be6ad2596..8e040763bb4 100644 --- a/src/main/java/seedu/address/logic/commands/ListCommand.java +++ b/src/main/java/seedu/address/logic/commands/ListCommand.java @@ -14,7 +14,6 @@ public class ListCommand extends Command { public static final String MESSAGE_SUCCESS = "Listed all persons"; - @Override public CommandResult execute(Model model) { requireNonNull(model); diff --git a/src/main/java/seedu/address/logic/commands/SortCommand.java b/src/main/java/seedu/address/logic/commands/SortCommand.java index 4bbc829395b..6d0b6c56cf9 100644 --- a/src/main/java/seedu/address/logic/commands/SortCommand.java +++ b/src/main/java/seedu/address/logic/commands/SortCommand.java @@ -1,2 +1,22 @@ -package seedu.address.logic.commands;public class SortCommand { +package seedu.address.logic.commands; + +import seedu.address.model.Model; + +import static java.util.Objects.requireNonNull; + +/** + * Sorts the address book by name in alphabetic order. + */ +public class SortCommand extends Command { + + public static final String COMMAND_WORD = "sort"; + + public static final String MESSAGE_SUCCESS = "Address book has been sorted by name!"; + + @Override + public CommandResult execute(Model model) { + requireNonNull(model); + model.sortFilteredPersonList(); + return new CommandResult(MESSAGE_SUCCESS); + } } diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 51f2c3fc12a..1f7748911cc 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -6,16 +6,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import seedu.address.logic.commands.AddCommand; -import seedu.address.logic.commands.AddTagCommand; -import seedu.address.logic.commands.ClearCommand; -import seedu.address.logic.commands.Command; -import seedu.address.logic.commands.DeleteCommand; -import seedu.address.logic.commands.EditCommand; -import seedu.address.logic.commands.ExitCommand; -import seedu.address.logic.commands.FindCommand; -import seedu.address.logic.commands.HelpCommand; -import seedu.address.logic.commands.ListCommand; +import seedu.address.logic.commands.*; import seedu.address.logic.parser.exceptions.ParseException; /** @@ -72,6 +63,9 @@ public Command parseCommand(String userInput) throws ParseException { case HelpCommand.COMMAND_WORD: return new HelpCommand(); + case SortCommand.COMMAND_WORD: + return new SortCommand(); + default: throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index 1a943a0781a..be3d2465145 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -2,7 +2,11 @@ import static java.util.Objects.requireNonNull; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; import javafx.collections.ObservableList; import seedu.address.model.person.Person; @@ -81,7 +85,6 @@ public void addPerson(Person p) { */ public void setPerson(Person target, Person editedPerson) { requireNonNull(editedPerson); - persons.setPerson(target, editedPerson); } @@ -106,6 +109,10 @@ public ObservableList getPersonList() { return persons.asUnmodifiableObservableList(); } + public void sort() { + persons.sort(); + } + @Override public boolean equals(Object other) { return other == this // short circuit if same object diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index d54df471c1f..89b91ce7e0d 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -84,4 +84,7 @@ public interface Model { * @throws NullPointerException if {@code predicate} is null. */ void updateFilteredPersonList(Predicate predicate); + + /** Sorts filteredList by name in alphabetical order. */ + void sortFilteredPersonList(); } diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index 86c1df298d7..bb6607c0ecf 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -1,18 +1,18 @@ package seedu.address.model; -import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; - -import java.nio.file.Path; -import java.util.function.Predicate; -import java.util.logging.Logger; - import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; import seedu.address.model.person.Person; +import java.nio.file.Path; +import java.util.function.Predicate; +import java.util.logging.Logger; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; + /** * Represents the in-memory model of the address book data. */ @@ -122,6 +122,13 @@ public ObservableList getFilteredPersonList() { return filteredPersons; } + /** + * + */ + public void sortFilteredPersonList() { + this.addressBook.sort(); + } + @Override public void updateFilteredPersonList(Predicate predicate) { requireNonNull(predicate); diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 8ff1d83fe89..93d278f27c6 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -40,6 +40,10 @@ public Name getName() { return name; } + public String getNameString() { + return name.toString(); + } + public Phone getPhone() { return phone; } diff --git a/src/main/java/seedu/address/model/person/UniquePersonList.java b/src/main/java/seedu/address/model/person/UniquePersonList.java index 0fee4fe57e6..6280093a68e 100644 --- a/src/main/java/seedu/address/model/person/UniquePersonList.java +++ b/src/main/java/seedu/address/model/person/UniquePersonList.java @@ -3,6 +3,7 @@ import static java.util.Objects.requireNonNull; import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import java.util.Comparator; import java.util.Iterator; import java.util.List; @@ -48,6 +49,13 @@ public void add(Person toAdd) { internalList.add(toAdd); } + /** + * Sorts the list according to name in alphabetical order. + */ + public void sort() { + internalList.sort(Comparator.comparing(Person::getNameString)); + } + /** * Replaces the person {@code target} in the list with {@code editedPerson}. * {@code target} must exist in the list. @@ -104,6 +112,7 @@ public ObservableList asUnmodifiableObservableList() { return internalUnmodifiableList; } + @Override public Iterator iterator() { return internalList.iterator(); From f3f647e7c7818bc451515b56c77d2291e8f1ce39 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 17:46:22 +0800 Subject: [PATCH 04/17] Fix to checkstyle --- README.md | 3 +-- src/main/java/seedu/address/model/AddressBook.java | 6 +++--- .../java/seedu/address/model/person/UniquePersonList.java | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 99005012a90..5604608d0c1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ [![CI Status](https://github.com/AY2223S1-CS2103T-W13-1/tp/workflows/Java%20CI/badge.svg)](https://github.com/AY2223S1-CS2103T-W13-1/tp/actions) StudMap (SM) is a desktop app for managing your students, optimized for use via a Command Line Interface (CLI) -while still having the benefits of a Graphical User Interface (GUI). If you can type fast, SM can get your -student management tasks done faster than traditional GUI apps. +while still having the benefits of a Graphical User Interface (GUI). If you can type fast, SM can get your student management tasks done faster than traditional GUI apps. ![Ui](docs/images/Ui.png) diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index be3d2465145..f7063f510ff 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -26,12 +26,12 @@ public class AddressBook implements ReadOnlyAddressBook { * * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication * among constructors. - */ - { + */ { persons = new UniquePersonList(); } - public AddressBook() {} + public AddressBook() { + } /** * Creates an AddressBook using the Persons in the {@code toBeCopied} diff --git a/src/main/java/seedu/address/model/person/UniquePersonList.java b/src/main/java/seedu/address/model/person/UniquePersonList.java index 6280093a68e..2ab3a8334dd 100644 --- a/src/main/java/seedu/address/model/person/UniquePersonList.java +++ b/src/main/java/seedu/address/model/person/UniquePersonList.java @@ -18,7 +18,7 @@ * persons uses Person#isSamePerson(Person) for equality so as to ensure that the person being added or updated is * unique in terms of identity in the UniquePersonList. However, the removal of a person uses Person#equals(Object) so * as to ensure that the person with exactly the same fields will be removed. - * + *

* Supports a minimal set of list operations. * * @see Person#isSamePerson(Person) @@ -122,7 +122,7 @@ public Iterator iterator() { public boolean equals(Object other) { return other == this // short circuit if same object || (other instanceof UniquePersonList // instanceof handles nulls - && internalList.equals(((UniquePersonList) other).internalList)); + && internalList.equals(((UniquePersonList) other).internalList)); } @Override From d77bdc300e12fe34ed027081492117305ae8f3a3 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 20:38:35 +0800 Subject: [PATCH 05/17] Fix Checkstyle --- .../address/logic/commands/SortCommand.java | 4 ++-- .../address/logic/parser/AddressBookParser.java | 16 +++++++++++++--- .../java/seedu/address/model/AddressBook.java | 8 ++------ .../java/seedu/address/model/ModelManager.java | 6 +++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/SortCommand.java b/src/main/java/seedu/address/logic/commands/SortCommand.java index 6d0b6c56cf9..7f07033d8ec 100644 --- a/src/main/java/seedu/address/logic/commands/SortCommand.java +++ b/src/main/java/seedu/address/logic/commands/SortCommand.java @@ -1,9 +1,9 @@ package seedu.address.logic.commands; -import seedu.address.model.Model; - import static java.util.Objects.requireNonNull; +import seedu.address.model.Model; + /** * Sorts the address book by name in alphabetic order. */ diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 1f7748911cc..45179ba2edd 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -3,12 +3,22 @@ import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND; +import seedu.address.logic.commands.AddCommand; +import seedu.address.logic.commands.AddTagCommand; +import seedu.address.logic.commands.ClearCommand; +import seedu.address.logic.commands.Command; +import seedu.address.logic.commands.DeleteCommand; +import seedu.address.logic.commands.EditCommand; +import seedu.address.logic.commands.ExitCommand; +import seedu.address.logic.commands.FindCommand; +import seedu.address.logic.commands.HelpCommand; +import seedu.address.logic.commands.ListCommand; +import seedu.address.logic.commands.SortCommand; +import seedu.address.logic.parser.exceptions.ParseException; + import java.util.regex.Matcher; import java.util.regex.Pattern; -import seedu.address.logic.commands.*; -import seedu.address.logic.parser.exceptions.ParseException; - /** * Parses user input. */ diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index f7063f510ff..49f58217546 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -2,16 +2,12 @@ import static java.util.Objects.requireNonNull; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - import javafx.collections.ObservableList; import seedu.address.model.person.Person; import seedu.address.model.person.UniquePersonList; +import java.util.List; + /** * Wraps all data at the address-book level * Duplicates are not allowed (by .isSamePerson comparison) diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index bb6607c0ecf..7a3f89f1d77 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -1,5 +1,8 @@ package seedu.address.model; +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; + import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import seedu.address.commons.core.GuiSettings; @@ -10,9 +13,6 @@ import java.util.function.Predicate; import java.util.logging.Logger; -import static java.util.Objects.requireNonNull; -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; - /** * Represents the in-memory model of the address book data. */ From 886192135d8c5f6d3d512e121cf4d460b3781649 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 20:43:07 +0800 Subject: [PATCH 06/17] Fix Checkstyle --- .../seedu/address/logic/parser/AddressBookParser.java | 6 +++--- src/main/java/seedu/address/model/ModelManager.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 45179ba2edd..22324cf2c28 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -3,6 +3,9 @@ import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.commons.core.Messages.MESSAGE_UNKNOWN_COMMAND; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import seedu.address.logic.commands.AddCommand; import seedu.address.logic.commands.AddTagCommand; import seedu.address.logic.commands.ClearCommand; @@ -16,9 +19,6 @@ import seedu.address.logic.commands.SortCommand; import seedu.address.logic.parser.exceptions.ParseException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * Parses user input. */ diff --git a/src/main/java/seedu/address/model/ModelManager.java b/src/main/java/seedu/address/model/ModelManager.java index 7a3f89f1d77..651434498d5 100644 --- a/src/main/java/seedu/address/model/ModelManager.java +++ b/src/main/java/seedu/address/model/ModelManager.java @@ -3,16 +3,16 @@ import static java.util.Objects.requireNonNull; import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; +import java.nio.file.Path; +import java.util.function.Predicate; +import java.util.logging.Logger; + import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import seedu.address.commons.core.GuiSettings; import seedu.address.commons.core.LogsCenter; import seedu.address.model.person.Person; -import java.nio.file.Path; -import java.util.function.Predicate; -import java.util.logging.Logger; - /** * Represents the in-memory model of the address book data. */ From 52866d158d3ac1324d1baf88d761df818bc2938a Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 20:45:54 +0800 Subject: [PATCH 07/17] Fix Checkstyle AddressBook.java --- .../java/seedu/address/model/AddressBook.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index 49f58217546..a46698c7a9a 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -2,12 +2,12 @@ import static java.util.Objects.requireNonNull; +import java.util.List; + import javafx.collections.ObservableList; import seedu.address.model.person.Person; import seedu.address.model.person.UniquePersonList; -import java.util.List; - /** * Wraps all data at the address-book level * Duplicates are not allowed (by .isSamePerson comparison) @@ -16,13 +16,14 @@ public class AddressBook implements ReadOnlyAddressBook { private final UniquePersonList persons; - /* - * The 'unusual' code block below is a non-static initialization block, sometimes used to avoid duplication - * between constructors. See https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html - * - * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication - * among constructors. - */ { + /* + * The 'unusual' code block below is a non-static initialization block, sometimes used to avoid duplication + * between constructors. See https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html + * + * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication + * among constructors. + */ + { persons = new UniquePersonList(); } From 2ad2000e9d51930c9a4e353b7f42df69f50fde79 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 23:00:09 +0800 Subject: [PATCH 08/17] Fix Checkstyle in AddressBook.java --- src/main/java/seedu/address/model/AddressBook.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/seedu/address/model/AddressBook.java b/src/main/java/seedu/address/model/AddressBook.java index a46698c7a9a..a3233a7fab1 100644 --- a/src/main/java/seedu/address/model/AddressBook.java +++ b/src/main/java/seedu/address/model/AddressBook.java @@ -16,13 +16,13 @@ public class AddressBook implements ReadOnlyAddressBook { private final UniquePersonList persons; - /* - * The 'unusual' code block below is a non-static initialization block, sometimes used to avoid duplication - * between constructors. See https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html - * - * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication - * among constructors. - */ + /* + * The 'unusual' code block below is a non-static initialization block, sometimes used to avoid duplication + * between constructors. See https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html + * + * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication + * among constructors. + */ { persons = new UniquePersonList(); } From ba46d8da01b92c632a9af9a929afd04967609063 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 23:26:08 +0800 Subject: [PATCH 09/17] Fix checkstyle --- .../java/seedu/address/logic/parser/AddressBookParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index bb0d63e0694..fdaba953567 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -76,7 +76,7 @@ public Command parseCommand(String userInput) throws ParseException { case SortCommand.COMMAND_WORD: return new SortCommand(); - + case FilterCommand.COMMAND_WORD: return new FilterCommandParser().parse(arguments); @@ -84,5 +84,5 @@ public Command parseCommand(String userInput) throws ParseException { throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } } - + } From d41fa8ca4580e89046bbd8108b28a70ec0a27179 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 23:32:19 +0800 Subject: [PATCH 10/17] Fix Checkstyle --- .../seedu/address/logic/parser/AddressBookParser.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index fdaba953567..68840f78fc5 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -74,15 +74,15 @@ public Command parseCommand(String userInput) throws ParseException { case HelpCommand.COMMAND_WORD: return new HelpCommand(); - case SortCommand.COMMAND_WORD: - return new SortCommand(); - case FilterCommand.COMMAND_WORD: return new FilterCommandParser().parse(arguments); + case SortCommand.COMMAND_WORD: + return new SortCommand(); + default: throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } } - + } From 22eb63c91e452f661d1256517ac2fa9b567df04f Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 23:34:57 +0800 Subject: [PATCH 11/17] Fix checkstyle --- src/main/java/seedu/address/logic/parser/AddressBookParser.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index 68840f78fc5..ea36e72b17e 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -79,7 +79,6 @@ public Command parseCommand(String userInput) throws ParseException { case SortCommand.COMMAND_WORD: return new SortCommand(); - default: throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } From 22c03ce8d5243d5f91ed7df723c6c1acfe3b8019 Mon Sep 17 00:00:00 2001 From: highorbit25 Date: Sun, 9 Oct 2022 23:42:23 +0800 Subject: [PATCH 12/17] Fix ModelStub in AddCommandTest.java --- .../java/seedu/address/logic/commands/AddCommandTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index 5865713d5dd..20da26f88bf 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -147,6 +147,11 @@ public ObservableList getFilteredPersonList() { public void updateFilteredPersonList(Predicate predicate) { throw new AssertionError("This method should not be called."); } + + @Override + public void sortFilteredPersonList() { + throw new AssertionError("This method should not be called."); + } } /** From e470c2593f251a40ccbd750c79073e48d7edd17d Mon Sep 17 00:00:00 2001 From: highorbit25 <74848536+highorbit25@users.noreply.github.com> Date: Mon, 10 Oct 2022 09:57:46 +0800 Subject: [PATCH 13/17] Update AddressBookParser.java Added newline before default --- src/main/java/seedu/address/logic/parser/AddressBookParser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index ea36e72b17e..3c7e3fd4f5b 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -79,6 +79,7 @@ public Command parseCommand(String userInput) throws ParseException { case SortCommand.COMMAND_WORD: return new SortCommand(); + default: throw new ParseException(MESSAGE_UNKNOWN_COMMAND); } From 2b7564a29f5e16ba0567df31b4772f7ff9431359 Mon Sep 17 00:00:00 2001 From: highorbit25 <74848536+highorbit25@users.noreply.github.com> Date: Mon, 10 Oct 2022 10:53:00 +0800 Subject: [PATCH 14/17] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb1f4fd11cb..3acf5b873e8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ [![CI Status](https://github.com/AY2223S1-CS2103T-W13-1/tp/workflows/Java%20CI/badge.svg)](https://github.com/AY2223S1-CS2103T-W13-1/tp/actions) StudMap (SM) is a desktop app for managing your students, optimized for use via a Command Line Interface (CLI) -while still having the benefits of a Graphical User Interface (GUI). If you can type fast, SM can get your student management tasks done faster than traditional GUI apps. +while still having the benefits of a Graphical User Interface (GUI). If you can type fast, SM can get your student +management tasks done faster than traditional GUI apps. ![Ui](docs/images/Ui.png) From e3d04d10c7a4542108fd3172a321e1aea7ff69ed Mon Sep 17 00:00:00 2001 From: highorbit25 <74848536+highorbit25@users.noreply.github.com> Date: Mon, 10 Oct 2022 10:56:38 +0800 Subject: [PATCH 15/17] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3acf5b873e8..494fc89c998 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ StudMap (SM) is a desktop app for managing your students, optimized for use via while still having the benefits of a Graphical User Interface (GUI). If you can type fast, SM can get your student management tasks done faster than traditional GUI apps. - ![Ui](docs/images/Ui.png) ## Site Map From c789bcd6df565cf9af877cf6f1a2ec092f0d13ef Mon Sep 17 00:00:00 2001 From: highorbit25 <74848536+highorbit25@users.noreply.github.com> Date: Mon, 10 Oct 2022 11:30:05 +0800 Subject: [PATCH 16/17] Update SortCommand.java Specified sorted in alphabetical order for success message --- src/main/java/seedu/address/logic/commands/SortCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/logic/commands/SortCommand.java b/src/main/java/seedu/address/logic/commands/SortCommand.java index 7f07033d8ec..eab0d6eb5ea 100644 --- a/src/main/java/seedu/address/logic/commands/SortCommand.java +++ b/src/main/java/seedu/address/logic/commands/SortCommand.java @@ -11,7 +11,7 @@ public class SortCommand extends Command { public static final String COMMAND_WORD = "sort"; - public static final String MESSAGE_SUCCESS = "Address book has been sorted by name!"; + public static final String MESSAGE_SUCCESS = "Address book has been sorted by name in alphabetical order!"; @Override public CommandResult execute(Model model) { From e8cac9032cf7546b633e97f523a3ff2b525a2e0c Mon Sep 17 00:00:00 2001 From: highorbit25 <74848536+highorbit25@users.noreply.github.com> Date: Mon, 10 Oct 2022 15:23:21 +0800 Subject: [PATCH 17/17] Update AddressBookParser.java --- src/main/java/seedu/address/logic/parser/AddressBookParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/logic/parser/AddressBookParser.java b/src/main/java/seedu/address/logic/parser/AddressBookParser.java index d9130b27b9d..7fc70628865 100644 --- a/src/main/java/seedu/address/logic/parser/AddressBookParser.java +++ b/src/main/java/seedu/address/logic/parser/AddressBookParser.java @@ -17,8 +17,8 @@ import seedu.address.logic.commands.FindCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.ListCommand; -import seedu.address.logic.commands.SortCommand; import seedu.address.logic.commands.MarkCommand; +import seedu.address.logic.commands.SortCommand; import seedu.address.logic.commands.UnmarkCommand; import seedu.address.logic.parser.exceptions.ParseException;