From 248cebbca26ea37873f99694e9c692358beb7913 Mon Sep 17 00:00:00 2001 From: CYX22222003 Date: Mon, 11 Nov 2024 20:32:44 +0800 Subject: [PATCH 1/2] Improve quality of code --- .../seedu/address/logic/commands/DeleteTagCommand.java | 4 ++-- .../address/logic/parser/DeleteTagCommandParser.java | 5 ++--- src/main/java/seedu/address/model/CampusConnect.java | 10 +++------- src/main/java/seedu/address/model/Model.java | 8 ++++---- .../seedu/address/model/VersionedCampusConnect.java | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/DeleteTagCommand.java b/src/main/java/seedu/address/logic/commands/DeleteTagCommand.java index 50231c00699..c22db357c7d 100644 --- a/src/main/java/seedu/address/logic/commands/DeleteTagCommand.java +++ b/src/main/java/seedu/address/logic/commands/DeleteTagCommand.java @@ -12,8 +12,8 @@ import seedu.address.model.tag.Tag; /** - * Implements command to delete a tag from a person - * format: deltag [INDEX] t/[TAG NAME] + * Implements command to delete a tag from a person. + * format: deltag [INDEX] t/[TAG NAME]. */ public class DeleteTagCommand extends Command { public static final String COMMAND_WORD = "deltag"; diff --git a/src/main/java/seedu/address/logic/parser/DeleteTagCommandParser.java b/src/main/java/seedu/address/logic/parser/DeleteTagCommandParser.java index 8b7212c6975..07edf19b938 100644 --- a/src/main/java/seedu/address/logic/parser/DeleteTagCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/DeleteTagCommandParser.java @@ -12,17 +12,16 @@ import seedu.address.model.tag.Tag; /** - * Parse the delete tag command. + * Parses the delete tag command. */ public class DeleteTagCommandParser implements Parser { /** - * Parses the given string of arguments in the context of Delete tag command. + * Parses the given string of arguments in the context of delete tag command. * and returns DeleteTagCommand object for execution. * @throws ParseException if user input does not conform the expected input */ public DeleteTagCommand parse(String args) throws ParseException { requireNonNull(args); - // assert !args.isEmpty(); // This causes error to not be displayed properly ArgumentMultimap argMultiMap = ArgumentTokenizer.tokenize(args, PREFIX_TAG); Index index; diff --git a/src/main/java/seedu/address/model/CampusConnect.java b/src/main/java/seedu/address/model/CampusConnect.java index fc1e5019b1a..0a543457db5 100644 --- a/src/main/java/seedu/address/model/CampusConnect.java +++ b/src/main/java/seedu/address/model/CampusConnect.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Set; -import java.util.Stack; import javafx.collections.ObservableList; import seedu.address.commons.util.ToStringBuilder; @@ -22,9 +21,6 @@ public class CampusConnect implements ReadOnlyCampusConnect { private final UniquePersonList persons; - private final Stack prev = new Stack<>(); - private final Stack future = new Stack<>(); - private final VersionedCampusConnect versionedCampusConnect = new VersionedCampusConnect(); /* @@ -60,7 +56,7 @@ public void saveCurrentState() { } /** - * Recovers from previous states + * Recovers from previous state. */ public ReadOnlyCampusConnect recoverPreviousState() throws UndoException { ReadOnlyCampusConnect out = versionedCampusConnect.extractOldData(); @@ -69,7 +65,7 @@ public ReadOnlyCampusConnect recoverPreviousState() throws UndoException { } /** - * Recovers previously undone states + * Recovers the previously undone state. */ public ReadOnlyCampusConnect recoverUndoneState() throws RedoException { ReadOnlyCampusConnect out = versionedCampusConnect.extractUndoneData(); @@ -151,7 +147,7 @@ public void removePersonTag(Person p, Tag t) { } /** - * Adds a new Tag to person + * Adds a new Tag to a person. */ public void addPersonTags(Person p, Set tagList) { persons.addPersonTags(p, tagList); diff --git a/src/main/java/seedu/address/model/Model.java b/src/main/java/seedu/address/model/Model.java index 6ae2d53299f..90546ca187f 100644 --- a/src/main/java/seedu/address/model/Model.java +++ b/src/main/java/seedu/address/model/Model.java @@ -74,12 +74,12 @@ public interface Model { /** * Deletes a tag from a person. - * The person must exist as well as the tag + * The person must exist as well as the tag. */ void deletePersonTag(Person p, Tag tag); /** - * Adds a set of tag to person + * Adds a set of tag to person. */ void addPersonTags(Person p, Sett); @@ -131,12 +131,12 @@ public interface Model { void updateFilteredPersonList(Predicate predicate); /** - * Undoes the previous actions of users + * Undoes the previous actions of users. */ void undoCampusConnect() throws CommandException; /** - * Restores state before previous undo actions of users + * Restores state before previous undo actions of users. */ void redoCampusConnect() throws CommandException; diff --git a/src/main/java/seedu/address/model/VersionedCampusConnect.java b/src/main/java/seedu/address/model/VersionedCampusConnect.java index ea3aeca3a4f..9758da55d46 100644 --- a/src/main/java/seedu/address/model/VersionedCampusConnect.java +++ b/src/main/java/seedu/address/model/VersionedCampusConnect.java @@ -59,7 +59,7 @@ public void saveCurrentData(ReadOnlyCampusConnect data) { } /** - * Clear all undone data in the future stack. + * Clears all undone data in the future stack. */ public void clearUndoneData() { future.clear(); From bd6fe6c2e59c702a0bf9029f112c352a779c5124 Mon Sep 17 00:00:00 2001 From: CYX22222003 Date: Mon, 11 Nov 2024 20:33:44 +0800 Subject: [PATCH 2/2] Update code comment --- src/main/java/seedu/address/model/CampusConnect.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/model/CampusConnect.java b/src/main/java/seedu/address/model/CampusConnect.java index 0a543457db5..2a0ba23db24 100644 --- a/src/main/java/seedu/address/model/CampusConnect.java +++ b/src/main/java/seedu/address/model/CampusConnect.java @@ -15,8 +15,8 @@ import seedu.address.model.tag.TagCategory; /** - * Wraps all data at the CampusConnect level - * Duplicates are not allowed (by .isSamePerson comparison) + * Wraps all data at the CampusConnect level. + * Duplicates are not allowed. */ public class CampusConnect implements ReadOnlyCampusConnect {