2
2
3
3
import static java .util .Objects .requireNonNull ;
4
4
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 ;
6
6
import static seedu .connectus .model .Model .PREDICATE_SHOW_ALL_PERSONS ;
7
7
8
8
import java .util .Collections ;
17
17
import seedu .connectus .model .Model ;
18
18
import seedu .connectus .model .person .Person ;
19
19
import seedu .connectus .model .tag .Module ;
20
- import seedu .connectus .model .tag .Tag ;
20
+ import seedu .connectus .model .tag .Remark ;
21
21
22
22
/**
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.
24
24
*/
25
25
public class AddTagToPersonCommand extends Command {
26
26
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 "
28
28
+ "by the index number used in the displayed person list. \n "
29
29
+ "Parameters: INDEX (must be a positive integer) "
30
- + "[" + PREFIX_TAG + "TAG ] "
30
+ + "[" + PREFIX_REMARK + "REMARK ] "
31
31
+ "[" + PREFIX_MODULE + "MODULE]"
32
32
+ "\n "
33
33
+ "Example: " + COMMAND_WORD + " 1 "
34
- + PREFIX_TAG + "friend "
34
+ + PREFIX_REMARK + "friend "
35
35
+ PREFIX_MODULE + "CS1231" ;
36
36
37
37
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 {
70
70
71
71
private String getTagSuccessDetailsMessage () {
72
72
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 )
77
77
.collect (Collectors .joining (", " )));
78
78
}
79
79
@@ -89,13 +89,13 @@ private String getTagSuccessDetailsMessage() {
89
89
}
90
90
91
91
private Person createEditedPerson (Person personToEdit , AddTagDescriptor addTagDescriptor ) {
92
- var tags = new HashSet <>(personToEdit .getTags ());
92
+ var remarks = new HashSet <>(personToEdit .getRemarks ());
93
93
var modules = new HashSet <>(personToEdit .getModules ());
94
94
95
- tags .addAll (addTagDescriptor .tags );
95
+ remarks .addAll (addTagDescriptor .remarks );
96
96
modules .addAll (addTagDescriptor .modules );
97
97
98
- return new Person (personToEdit , tags , modules );
98
+ return new Person (personToEdit , remarks , modules );
99
99
}
100
100
101
101
@ Override
@@ -122,34 +122,34 @@ public boolean equals(Object other) {
122
122
* corresponding field value of the person.
123
123
*/
124
124
public static class AddTagDescriptor {
125
- private final Set <Tag > tags ;
125
+ private final Set <Remark > remarks ;
126
126
private final Set <Module > modules ;
127
127
128
128
129
129
/**
130
130
* Constructor.
131
131
*/
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 ;
134
134
this .modules = modules ;
135
135
}
136
136
137
137
/**
138
138
* Copy constructor.
139
139
*/
140
140
public AddTagDescriptor (AddTagDescriptor addTagDescriptor ) {
141
- tags = addTagDescriptor .tags ;
141
+ remarks = addTagDescriptor .remarks ;
142
142
modules = addTagDescriptor .modules ;
143
143
}
144
144
145
145
/**
146
- * Returns an unmodifiable tag set, which throws
146
+ * Returns an unmodifiable remark set, which throws
147
147
* {@code UnsupportedOperationException}
148
148
* if modification is attempted.
149
- * Returns {@code Optional#empty()} if {@code tags } is null.
149
+ * Returns {@code Optional#empty()} if {@code remarks } is null.
150
150
*/
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 ();
153
153
}
154
154
155
155
/**
@@ -163,7 +163,7 @@ public Optional<Set<Module>> getModules() {
163
163
}
164
164
165
165
public boolean isEmpty () {
166
- return (tags == null || tags .isEmpty ()) && (modules == null || modules .isEmpty ());
166
+ return (remarks == null || remarks .isEmpty ()) && (modules == null || modules .isEmpty ());
167
167
}
168
168
169
169
@ Override
@@ -181,7 +181,7 @@ public boolean equals(Object other) {
181
181
// state check
182
182
var e = (AddTagDescriptor ) other ;
183
183
184
- return getTags ().equals (e .getTags ()) && getModules ().equals (e .getModules ());
184
+ return getRemarks ().equals (e .getRemarks ()) && getModules ().equals (e .getModules ());
185
185
}
186
186
}
187
187
}
0 commit comments