Skip to content

Commit aab7595

Browse files
authored
Merge pull request #118 from gremmyz/branch-update-tags
Update tags to remarks
2 parents 80fb2fd + b5253ca commit aab7595

37 files changed

+527
-581
lines changed

src/main/java/seedu/connectus/logic/commands/AddCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_MODULE;
1010
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_NAME;
1111
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_PHONE;
12+
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_REMARK;
1213
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_SOCMED_INSTAGRAM;
1314
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_SOCMED_TELEGRAM;
1415
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_SOCMED_WHATSAPP;
15-
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_TAG;
1616

1717
import seedu.connectus.logic.commands.exceptions.CommandException;
1818
import seedu.connectus.model.Model;
@@ -39,7 +39,7 @@ public class AddCommand extends Command {
3939
+ "[" + PREFIX_MODULE + "MODULE]... "
4040
+ "[" + PREFIX_CCA + "CCA]... "
4141
+ "[" + PREFIX_CCA_POSITION + "CCA POSITION]... "
42-
+ "[" + PREFIX_TAG + "TAG]...\n"
42+
+ "[" + PREFIX_REMARK + "REMARK]...\n"
4343
+ "Example: " + COMMAND_WORD + " "
4444
+ PREFIX_NAME + "John Doe "
4545
+ PREFIX_PHONE + "98765432 "
@@ -55,8 +55,8 @@ public class AddCommand extends Command {
5555
+ PREFIX_CCA + "ICS "
5656
+ PREFIX_CCA_POSITION + "Director "
5757
+ PREFIX_CCA_POSITION + "President "
58-
+ PREFIX_TAG + "friends "
59-
+ PREFIX_TAG + "owesMoney";
58+
+ PREFIX_REMARK + "friends "
59+
+ PREFIX_REMARK + "owesMoney";
6060

6161
public static final String MESSAGE_SUCCESS = "New person added: %1$s";
6262
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the ConnectUS";

src/main/java/seedu/connectus/logic/commands/AddTagToPersonCommand.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import static java.util.Objects.requireNonNull;
44
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_MODULE;
5-
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_TAG;
5+
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_REMARK;
66
import static seedu.connectus.model.Model.PREDICATE_SHOW_ALL_PERSONS;
77

88
import java.util.Collections;
@@ -17,21 +17,21 @@
1717
import seedu.connectus.model.Model;
1818
import seedu.connectus.model.person.Person;
1919
import seedu.connectus.model.tag.Module;
20-
import seedu.connectus.model.tag.Tag;
20+
import seedu.connectus.model.tag.Remark;
2121

2222
/**
23-
* Adds a tag (or module) to a person identified using its displayed index from ConnectUS.
23+
* Adds a tag to a person identified using its displayed index from ConnectUS.
2424
*/
2525
public class AddTagToPersonCommand extends Command {
2626
public static final String COMMAND_WORD = "addt";
27-
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a tag (or module) to the person identified "
27+
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a tag to the person identified "
2828
+ "by the index number used in the displayed person list. \n"
2929
+ "Parameters: INDEX (must be a positive integer) "
30-
+ "[" + PREFIX_TAG + "TAG] "
30+
+ "[" + PREFIX_REMARK + "REMARK] "
3131
+ "[" + PREFIX_MODULE + "MODULE]"
3232
+ "\n"
3333
+ "Example: " + COMMAND_WORD + " 1 "
34-
+ PREFIX_TAG + "friend "
34+
+ PREFIX_REMARK + "friend "
3535
+ PREFIX_MODULE + "CS1231";
3636

3737
public static final String MESSAGE_ADD_TAG_SUCCESS = "Added %2$s to Person: %1$s";
@@ -70,10 +70,10 @@ public CommandResult execute(Model model) throws CommandException {
7070

7171
private String getTagSuccessDetailsMessage() {
7272
StringBuilder sb = new StringBuilder(MESSAGE_ADD_TAG_SUCCESS.length() * 2);
73-
if (!addTagDescriptor.tags.isEmpty()) {
74-
sb.append("tag");
75-
sb.append(addTagDescriptor.tags.size() > 1 ? "s " : " ");
76-
sb.append(addTagDescriptor.tags.stream().map(tag -> tag.tagName)
73+
if (!addTagDescriptor.remarks.isEmpty()) {
74+
sb.append("remark");
75+
sb.append(addTagDescriptor.remarks.size() > 1 ? "s " : " ");
76+
sb.append(addTagDescriptor.remarks.stream().map(remark -> remark.remarkName)
7777
.collect(Collectors.joining(", ")));
7878
}
7979

@@ -89,13 +89,13 @@ private String getTagSuccessDetailsMessage() {
8989
}
9090

9191
private Person createEditedPerson(Person personToEdit, AddTagDescriptor addTagDescriptor) {
92-
var tags = new HashSet<>(personToEdit.getTags());
92+
var remarks = new HashSet<>(personToEdit.getRemarks());
9393
var modules = new HashSet<>(personToEdit.getModules());
9494

95-
tags.addAll(addTagDescriptor.tags);
95+
remarks.addAll(addTagDescriptor.remarks);
9696
modules.addAll(addTagDescriptor.modules);
9797

98-
return new Person(personToEdit, tags, modules);
98+
return new Person(personToEdit, remarks, modules);
9999
}
100100

101101
@Override
@@ -122,34 +122,34 @@ public boolean equals(Object other) {
122122
* corresponding field value of the person.
123123
*/
124124
public static class AddTagDescriptor {
125-
private final Set<Tag> tags;
125+
private final Set<Remark> remarks;
126126
private final Set<Module> modules;
127127

128128

129129
/**
130130
* Constructor.
131131
*/
132-
public AddTagDescriptor(Set<Tag> tags, Set<Module> modules) {
133-
this.tags = tags;
132+
public AddTagDescriptor(Set<Remark> remarks, Set<Module> modules) {
133+
this.remarks = remarks;
134134
this.modules = modules;
135135
}
136136

137137
/**
138138
* Copy constructor.
139139
*/
140140
public AddTagDescriptor(AddTagDescriptor addTagDescriptor) {
141-
tags = addTagDescriptor.tags;
141+
remarks = addTagDescriptor.remarks;
142142
modules = addTagDescriptor.modules;
143143
}
144144

145145
/**
146-
* Returns an unmodifiable tag set, which throws
146+
* Returns an unmodifiable remark set, which throws
147147
* {@code UnsupportedOperationException}
148148
* if modification is attempted.
149-
* Returns {@code Optional#empty()} if {@code tags} is null.
149+
* Returns {@code Optional#empty()} if {@code remarks} is null.
150150
*/
151-
public Optional<Set<Tag>> getTags() {
152-
return (tags != null) ? Optional.of(Collections.unmodifiableSet(tags)) : Optional.empty();
151+
public Optional<Set<Remark>> getRemarks() {
152+
return (remarks != null) ? Optional.of(Collections.unmodifiableSet(remarks)) : Optional.empty();
153153
}
154154

155155
/**
@@ -163,7 +163,7 @@ public Optional<Set<Module>> getModules() {
163163
}
164164

165165
public boolean isEmpty() {
166-
return (tags == null || tags.isEmpty()) && (modules == null || modules.isEmpty());
166+
return (remarks == null || remarks.isEmpty()) && (modules == null || modules.isEmpty());
167167
}
168168

169169
@Override
@@ -181,7 +181,7 @@ public boolean equals(Object other) {
181181
// state check
182182
var e = (AddTagDescriptor) other;
183183

184-
return getTags().equals(e.getTags()) && getModules().equals(e.getModules());
184+
return getRemarks().equals(e.getRemarks()) && getModules().equals(e.getModules());
185185
}
186186
}
187187
}

src/main/java/seedu/connectus/logic/commands/DeleteTagFromPersonCommand.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import static seedu.connectus.logic.commands.CommandUtil.convertSetToList;
55
import static seedu.connectus.logic.commands.CommandUtil.isIndexValid;
66
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_MODULE;
7-
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_TAG;
7+
import static seedu.connectus.logic.parser.CliSyntax.PREFIX_REMARK;
88
import static seedu.connectus.model.Model.PREDICATE_SHOW_ALL_PERSONS;
99

1010
import java.util.HashSet;
@@ -17,7 +17,7 @@
1717
import seedu.connectus.model.Model;
1818
import seedu.connectus.model.person.Person;
1919
import seedu.connectus.model.tag.Module;
20-
import seedu.connectus.model.tag.Tag;
20+
import seedu.connectus.model.tag.Remark;
2121

2222
/**
2323
* Deletes a tag from a person using their displayed indexes from ConnectUS.
@@ -27,28 +27,28 @@ public class DeleteTagFromPersonCommand extends Command {
2727
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Delete a tag from the person identified"
2828
+ "by the index number used in the displayed person list. \n"
2929
+ "Parameters: PERSON_INDEX (must be a positive integer) "
30-
+ "[" + PREFIX_TAG + "TAG_INDEX] "
30+
+ "[" + PREFIX_REMARK + "REMARK_INDEX] "
3131
+ "[" + PREFIX_MODULE + "MODULE_INDEX]"
3232
+ "\n"
3333
+ "Example: " + COMMAND_WORD + " 1 "
34-
+ PREFIX_TAG + "1 "
34+
+ PREFIX_REMARK + "1 "
3535
+ PREFIX_MODULE + "1";
3636

3737
public static final String MESSAGE_DELETE_TAG_SUCCESS = "Deleted tag from Person: %1$s";
3838

3939
private final Index personIndex;
40-
private final Index tagIndex;
40+
private final Index remarkIndex;
4141
private final Index moduleIndex;
4242

4343
/**
4444
* @param personIndex of the person in the filtered person list to edit
45-
* @param tagIndex of the tag in the tag list to delete
45+
* @param remarkIndex of the remark in the remark list to delete
4646
* @param moduleIndex of the module in the module list to delete
4747
*/
48-
public DeleteTagFromPersonCommand(Index personIndex, Index tagIndex, Index moduleIndex) {
48+
public DeleteTagFromPersonCommand(Index personIndex, Index remarkIndex, Index moduleIndex) {
4949
requireNonNull(personIndex);
5050
this.personIndex = personIndex;
51-
this.tagIndex = tagIndex;
51+
this.remarkIndex = remarkIndex;
5252
this.moduleIndex = moduleIndex;
5353
}
5454

@@ -63,15 +63,15 @@ public CommandResult execute(Model model) throws CommandException {
6363

6464
var personToEdit = lastShownList.get(personIndex.getZeroBased());
6565

66-
Set<Tag> editedTags = personToEdit.getTags();
66+
Set<Remark> editedRemarks = personToEdit.getRemarks();
6767
Set<Module> editedModules = personToEdit.getModules();
6868

69-
if (tagIndex != null) {
70-
var originalTags = convertSetToList(personToEdit.getTags());
71-
if (!isIndexValid(tagIndex, originalTags)) {
69+
if (remarkIndex != null) {
70+
var originalRemarks = convertSetToList(personToEdit.getRemarks());
71+
if (!isIndexValid(remarkIndex, originalRemarks)) {
7272
throw new CommandException(String.format(Messages.MESSAGE_INVALID_DISPLAYED_INDEX, "tag"));
7373
}
74-
editedTags = createEditedTagList(originalTags, tagIndex);
74+
editedRemarks = createEditedTagList(originalRemarks, remarkIndex);
7575
}
7676

7777
if (moduleIndex != null) {
@@ -83,7 +83,7 @@ public CommandResult execute(Model model) throws CommandException {
8383
}
8484

8585

86-
var editedPerson = new Person(personToEdit, editedTags, editedModules);
86+
var editedPerson = new Person(personToEdit, editedRemarks, editedModules);
8787

8888
model.setPerson(personToEdit, editedPerson);
8989
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
@@ -110,7 +110,7 @@ public boolean equals(Object other) {
110110
// state check
111111
var e = (DeleteTagFromPersonCommand) other;
112112
return personIndex.equals(e.personIndex)
113-
&& tagIndex.equals(e.tagIndex)
113+
&& remarkIndex.equals(e.remarkIndex)
114114
&& moduleIndex.equals(e.moduleIndex);
115115
}
116116
}

0 commit comments

Comments
 (0)