Skip to content

Commit 5dc987a

Browse files
authored
Merge pull request #49 from hengyiqun/branch-group
Branch group
2 parents 56eac74 + a94e756 commit 5dc987a

45 files changed

Lines changed: 446 additions & 449 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/UserGuide.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ MeetBuddy is a **desktop app for managing contacts and daily tasks, optimized fo
4848
e.g. in `add n/NAME`, `NAME` is a parameter which can be used as `add n/John Doe`.
4949

5050
* Items in square brackets are optional.<br>
51-
e.g `n/NAME [t/TAG]` can be used as `n/John Doe t/friend` or as `n/John Doe`.
51+
e.g `n/NAME [g/GROUP]` can be used as `n/John Doe g/friend` or as `n/John Doe`.
5252

5353
* Items with ``​ after them can be used multiple times including zero times.<br>
54-
e.g. `[t/TAG]…​` can be used as ` ` (i.e. 0 times), `t/friend`, `t/friend t/family` etc.
54+
e.g. `[g/GROUP]…​` can be used as ` ` (i.e. 0 times), `g/friend`, `g/friend g/family` etc.
5555

5656
* Parameters can be in any order.<br>
5757
e.g. if the command specifies `n/NAME p/PHONE_NUMBER`, `p/PHONE_NUMBER n/NAME` is also acceptable.
@@ -77,10 +77,10 @@ Format: `help`
7777

7878
Adds a person to the address book.
7979

80-
Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG] [g/GROUP]…​`
80+
Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [g/GROUP]…​`
8181

8282
<div markdown="span" class="alert alert-primary">:bulb: **Tip:**
83-
A person can have any number of tags (including 0)
83+
A person can have any number of groups (including 0)
8484
</div>
8585

8686
* Assigning Priorities:
@@ -94,7 +94,7 @@ A person can have any number of tags (including 0)
9494

9595
Examples:
9696
* `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01`
97-
* `add n/Betsy Crowe t/friend e/betsycrowe@example.com a/Newgate Prison p/1234567 t/criminal`
97+
* `add n/Betsy Crowe g/CS2103 e/betsycrowe@example.com a/Newgate Prison p/1234567 g/badminton`
9898

9999
### Listing all persons : `list`
100100

@@ -106,18 +106,18 @@ Format: `list`
106106

107107
Edits an existing person in the address book.
108108

109-
Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`
109+
Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [g/GROUP]…​`
110110

111111
* Edits the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, …​
112112
* At least one of the optional fields must be provided.
113113
* Existing values will be updated to the input values.
114-
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
115-
* You can remove all the person’s tags by typing `t/` without
116-
specifying any tags after it.
114+
* When editing groups, the existing groups of the person will be removed i.e adding of groups is not cumulative.
115+
* You can remove all the person’s groups by typing `g/` without
116+
specifying any groups after it.
117117

118118
Examples:
119119
* `edit 1 p/91234567 e/johndoe@example.com` Edits the phone number and email address of the 1st person to be `91234567` and `johndoe@example.com` respectively.
120-
* `edit 2 n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags.
120+
* `edit 2 n/Betsy Crower g/` Edits the name of the 2nd person to be `Betsy Crower` and clears all existing groups.
121121

122122
### Locating persons by name: `find`
123123

@@ -207,10 +207,10 @@ _Details coming soon ..._
207207

208208
Action | Format, Examples
209209
--------|------------------
210-
**Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​` <br> e.g., `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 t/friend t/colleague`
210+
**Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [g/GROUP]…​` <br> e.g., `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 g/CS2106 g/badminton`
211211
**Clear** | `clear`
212212
**Delete** | `delete INDEX`<br> e.g., `delete 3`
213-
**Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`<br> e.g.,`edit 2 n/James Lee e/jameslee@example.com`
213+
**Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [g/GROUP]…​`<br> e.g.,`edit 2 n/James Lee e/jameslee@example.com`
214214
**Find** | `find KEYWORD [MORE_KEYWORDS]`<br> e.g., `find James Jake`
215215
**List** | `list`
216216
**Help** | `help`

src/main/java/seedu/address/logic/commands/persons/AddPersonCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
66
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
77
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
8-
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
8+
import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP;
99

1010
import seedu.address.logic.commands.Command;
1111
import seedu.address.logic.commands.CommandResult;
@@ -26,14 +26,14 @@ public class AddPersonCommand extends Command {
2626
+ PREFIX_PHONE + "PHONE "
2727
+ PREFIX_EMAIL + "EMAIL "
2828
+ PREFIX_ADDRESS + "ADDRESS "
29-
+ "[" + PREFIX_TAG + "TAG]...\n"
29+
+ "[" + PREFIX_GROUP + "GROUP]...\n"
3030
+ "Example: " + COMMAND_WORD + " "
3131
+ PREFIX_NAME + "John Doe "
3232
+ PREFIX_PHONE + "98765432 "
3333
+ PREFIX_EMAIL + "johnd@example.com "
3434
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
35-
+ PREFIX_TAG + "friends "
36-
+ PREFIX_TAG + "owesMoney";
35+
+ PREFIX_GROUP + "friends "
36+
+ PREFIX_GROUP + "owesMoney";
3737

3838
public static final String MESSAGE_SUCCESS = "New person added: %1$s";
3939
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book";

src/main/java/seedu/address/logic/commands/persons/EditPersonCommand.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
66
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
77
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
8-
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
8+
import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP;
99
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
1010

1111
import java.util.Collections;
@@ -26,7 +26,7 @@
2626
import seedu.address.model.person.Name;
2727
import seedu.address.model.person.Person;
2828
import seedu.address.model.person.Phone;
29-
import seedu.address.model.tag.Tag;
29+
import seedu.address.model.group.Group;
3030

3131
/**
3232
* Edits the details of an existing person in the address book.
@@ -43,7 +43,7 @@ public class EditPersonCommand extends Command {
4343
+ "[" + PREFIX_PHONE + "PHONE] "
4444
+ "[" + PREFIX_EMAIL + "EMAIL] "
4545
+ "[" + PREFIX_ADDRESS + "ADDRESS] "
46-
+ "[" + PREFIX_TAG + "TAG]...\n"
46+
+ "[" + PREFIX_GROUP + "GROUP]...\n"
4747
+ "Example: " + COMMAND_WORD + " 1 "
4848
+ PREFIX_PHONE + "91234567 "
4949
+ PREFIX_EMAIL + "johndoe@example.com";
@@ -99,9 +99,9 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript
9999
Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone());
100100
Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail());
101101
Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress());
102-
Set<Tag> updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags());
102+
Set<Group> updatedGroups = editPersonDescriptor.getGroups().orElse(personToEdit.getGroups());
103103

104-
return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags);
104+
return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedGroups);
105105
}
106106

107107
@Override
@@ -131,27 +131,27 @@ public static class EditPersonDescriptor {
131131
private Phone phone;
132132
private Email email;
133133
private Address address;
134-
private Set<Tag> tags;
134+
private Set<Group> groups;
135135

136136
public EditPersonDescriptor() {}
137137

138138
/**
139139
* Copy constructor.
140-
* A defensive copy of {@code tags} is used internally.
140+
* A defensive copy of {@code groups} is used internally.
141141
*/
142142
public EditPersonDescriptor(EditPersonDescriptor toCopy) {
143143
setName(toCopy.name);
144144
setPhone(toCopy.phone);
145145
setEmail(toCopy.email);
146146
setAddress(toCopy.address);
147-
setTags(toCopy.tags);
147+
setGroups(toCopy.groups);
148148
}
149149

150150
/**
151151
* Returns true if at least one field is edited.
152152
*/
153153
public boolean isAnyFieldEdited() {
154-
return CollectionUtil.isAnyNonNull(name, phone, email, address, tags);
154+
return CollectionUtil.isAnyNonNull(name, phone, email, address, groups);
155155
}
156156

157157
public void setName(Name name) {
@@ -187,20 +187,20 @@ public Optional<Address> getAddress() {
187187
}
188188

189189
/**
190-
* Sets {@code tags} to this object's {@code tags}.
191-
* A defensive copy of {@code tags} is used internally.
190+
* Sets {@code groups} to this object's {@code groups}.
191+
* A defensive copy of {@code groups} is used internally.
192192
*/
193-
public void setTags(Set<Tag> tags) {
194-
this.tags = (tags != null) ? new HashSet<>(tags) : null;
193+
public void setGroups(Set<Group> groups) {
194+
this.groups = (groups != null) ? new HashSet<>(groups) : null;
195195
}
196196

197197
/**
198-
* Returns an unmodifiable tag set, which throws {@code UnsupportedOperationException}
198+
* Returns an unmodifiable group set, which throws {@code UnsupportedOperationException}
199199
* if modification is attempted.
200-
* Returns {@code Optional#empty()} if {@code tags} is null.
200+
* Returns {@code Optional#empty()} if {@code groups} is null.
201201
*/
202-
public Optional<Set<Tag>> getTags() {
203-
return (tags != null) ? Optional.of(Collections.unmodifiableSet(tags)) : Optional.empty();
202+
public Optional<Set<Group>> getGroups() {
203+
return (groups != null) ? Optional.of(Collections.unmodifiableSet(groups)) : Optional.empty();
204204
}
205205

206206
@Override
@@ -222,7 +222,7 @@ public boolean equals(Object other) {
222222
&& getPhone().equals(e.getPhone())
223223
&& getEmail().equals(e.getEmail())
224224
&& getAddress().equals(e.getAddress())
225-
&& getTags().equals(e.getTags());
225+
&& getGroups().equals(e.getGroups());
226226
}
227227
}
228228
}

src/main/java/seedu/address/logic/parser/CliSyntax.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ public class CliSyntax {
1010
public static final Prefix PREFIX_PHONE = new Prefix("p/");
1111
public static final Prefix PREFIX_EMAIL = new Prefix("e/");
1212
public static final Prefix PREFIX_ADDRESS = new Prefix("a/");
13-
public static final Prefix PREFIX_TAG = new Prefix("t/");
13+
public static final Prefix PREFIX_GROUP = new Prefix("g/");
1414

1515
}

src/main/java/seedu/address/logic/parser/ParserUtil.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import seedu.address.model.person.Email;
1414
import seedu.address.model.person.Name;
1515
import seedu.address.model.person.Phone;
16-
import seedu.address.model.tag.Tag;
16+
import seedu.address.model.group.Group;
1717

1818
/**
1919
* Contains utility methods used for parsing strings in the various *Parser classes.
@@ -96,29 +96,29 @@ public static Email parseEmail(String email) throws ParseException {
9696
}
9797

9898
/**
99-
* Parses a {@code String tag} into a {@code Tag}.
99+
* Parses a {@code String group} into a {@code group}.
100100
* Leading and trailing whitespaces will be trimmed.
101101
*
102-
* @throws ParseException if the given {@code tag} is invalid.
102+
* @throws ParseException if the given {@code group} is invalid.
103103
*/
104-
public static Tag parseTag(String tag) throws ParseException {
105-
requireNonNull(tag);
106-
String trimmedTag = tag.trim();
107-
if (!Tag.isValidTagName(trimmedTag)) {
108-
throw new ParseException(Tag.MESSAGE_CONSTRAINTS);
104+
public static Group parseGroup(String group) throws ParseException {
105+
requireNonNull(group);
106+
String trimmedGroup = group.trim();
107+
if (!Group.isValidGroupName(trimmedGroup)) {
108+
throw new ParseException(Group.MESSAGE_CONSTRAINTS);
109109
}
110-
return new Tag(trimmedTag);
110+
return new Group(trimmedGroup);
111111
}
112112

113113
/**
114-
* Parses {@code Collection<String> tags} into a {@code Set<Tag>}.
114+
* Parses {@code Collection<String> groups} into a {@code Set<Group>}.
115115
*/
116-
public static Set<Tag> parseTags(Collection<String> tags) throws ParseException {
117-
requireNonNull(tags);
118-
final Set<Tag> tagSet = new HashSet<>();
119-
for (String tagName : tags) {
120-
tagSet.add(parseTag(tagName));
116+
public static Set<Group> parseGroups(Collection<String> groups) throws ParseException {
117+
requireNonNull(groups);
118+
final Set<Group> groupSet = new HashSet<>();
119+
for (String groupName : groups) {
120+
groupSet.add(parseGroup(groupName));
121121
}
122-
return tagSet;
122+
return groupSet;
123123
}
124124
}

src/main/java/seedu/address/logic/parser/meetings/AddMeetingCommandParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
66
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
77
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
8-
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
8+
import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP;
99

1010
import java.util.Set;
1111
import java.util.stream.Stream;
1212

1313
import seedu.address.logic.commands.persons.AddPersonCommand;
1414
import seedu.address.logic.parser.*;
1515
import seedu.address.logic.parser.exceptions.ParseException;
16+
import seedu.address.model.group.Group;
1617
import seedu.address.model.person.Address;
1718
import seedu.address.model.person.Email;
1819
import seedu.address.model.person.Name;
1920
import seedu.address.model.person.Person;
2021
import seedu.address.model.person.Phone;
21-
import seedu.address.model.tag.Tag;
2222

2323
/**
2424
* Parses input arguments and creates a new AddPersonCommand object
@@ -32,7 +32,7 @@ public class AddMeetingCommandParser implements Parser<AddPersonCommand> {
3232
*/
3333
public AddPersonCommand parse(String args) throws ParseException {
3434
ArgumentMultimap argMultimap =
35-
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG);
35+
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_GROUP);
3636

3737
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL)
3838
|| !argMultimap.getPreamble().isEmpty()) {
@@ -43,7 +43,7 @@ public AddPersonCommand parse(String args) throws ParseException {
4343
Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
4444
Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
4545
Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
46-
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));
46+
Set<Group> tagList = ParserUtil.parseGroups(argMultimap.getAllValues(PREFIX_GROUP));
4747

4848
Person person = new Person(name, phone, email, address, tagList);
4949

src/main/java/seedu/address/logic/parser/persons/AddPersonCommandParser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
66
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
77
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
8-
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
8+
import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP;
99

1010
import java.util.Set;
1111
import java.util.stream.Stream;
@@ -18,7 +18,7 @@
1818
import seedu.address.model.person.Name;
1919
import seedu.address.model.person.Person;
2020
import seedu.address.model.person.Phone;
21-
import seedu.address.model.tag.Tag;
21+
import seedu.address.model.group.Group;
2222

2323
/**
2424
* Parses input arguments and creates a new AddPersonCommand object
@@ -32,7 +32,7 @@ public class AddPersonCommandParser implements Parser<AddPersonCommand> {
3232
*/
3333
public AddPersonCommand parse(String args) throws ParseException {
3434
ArgumentMultimap argMultimap =
35-
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG);
35+
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_GROUP);
3636

3737
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL)
3838
|| !argMultimap.getPreamble().isEmpty()) {
@@ -43,9 +43,9 @@ public AddPersonCommand parse(String args) throws ParseException {
4343
Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
4444
Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
4545
Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
46-
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));
46+
Set<Group> groupList = ParserUtil.parseGroups(argMultimap.getAllValues(PREFIX_GROUP));
4747

48-
Person person = new Person(name, phone, email, address, tagList);
48+
Person person = new Person(name, phone, email, address, groupList);
4949

5050
return new AddPersonCommand(person);
5151
}

0 commit comments

Comments
 (0)