Skip to content

Commit cbc6e40

Browse files
authored
Merge pull request nus-cs2103-AY2021S1#79 from anthony6401/delete-email-branch
Delete email field
2 parents 6889dba + 53829e3 commit cbc6e40

30 files changed

+63
-350
lines changed

docs/tutorials/AddRemark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ save it with `Model#setPerson()`.
341341
}
342342

343343
Person personToEdit = lastShownList.get(index.getZeroBased());
344-
Person editedPerson = new Person(personToEdit.getName(), personToEdit.getPhone(), personToEdit.getEmail(),
344+
Person editedPerson = new Person(personToEdit.getName(), personToEdit.getPhone(),
345345
personToEdit.getAddress(), remark, personToEdit.getTags());
346346

347347
model.setPerson(personToEdit, editedPerson);

docs/tutorials/RemovingFields.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ private Label address;
7575
...
7676
<Label fx:id="phone" styleClass="cell_small_label" text="\$phone" />
7777
<Label fx:id="address" styleClass="cell_small_label" text="\$address" />
78-
<Label fx:id="email" styleClass="cell_small_label" text="\$email" />
7978
...
8079
```
8180

@@ -94,7 +93,6 @@ In `src/test/data/`, data meant for testing purposes are stored. While keeping t
9493
"persons": [ {
9594
"name": "Person with invalid name field: Ha!ns Mu@ster",
9695
"phone": "9482424",
97-
"email": "[email protected]",
9896
"address": "4th street"
9997
} ]
10098
}

docs/tutorials/TracingCode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Now let’s set the breakpoint. First, double-click the item to reach the corres
4747

4848
## Tracing the execution path
4949

50-
Recall from the User Guide that the `edit` command has the format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​` For this tutorial we will be issuing the command `edit 1 n/Alice Yeoh`.
50+
Recall from the User Guide that the `edit` command has the format: `edit INDEX [n/NAME] [p/PHONE] [a/ADDRESS] [t/TAG]…​` For this tutorial we will be issuing the command `edit 1 n/Alice Yeoh`.
5151

5252
<div markdown="span" class="alert alert-primary">
5353

src/main/java/seedu/address/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
*/
2121
public class Main {
2222
public static void main(String[] args) {
23-
Application.launch(NewMainApp.class, args);
23+
Application.launch(MainApp.class, args);
2424
}
2525
}

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

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

33
import static java.util.Objects.requireNonNull;
44
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
5-
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
65
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
76
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
87
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
@@ -22,13 +21,11 @@ public class AddCommand extends Command {
2221
+ "Parameters: "
2322
+ PREFIX_NAME + "NAME "
2423
+ PREFIX_PHONE + "PHONE "
25-
+ PREFIX_EMAIL + "EMAIL "
2624
+ PREFIX_ADDRESS + "ADDRESS "
2725
+ "[" + PREFIX_TAG + "TAG]...\n"
2826
+ "Example: " + COMMAND_WORD + " "
2927
+ PREFIX_NAME + "John Doe "
3028
+ PREFIX_PHONE + "98765432 "
31-
+ PREFIX_EMAIL + "[email protected] "
3229
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
3330
+ PREFIX_TAG + "friends "
3431
+ PREFIX_TAG + "owesMoney";

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

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

33
import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
44
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
5-
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
65
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
76
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
87
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
@@ -13,7 +12,6 @@
1312
import seedu.address.logic.commands.AddCommand;
1413
import seedu.address.logic.parser.exceptions.ParseException;
1514
import seedu.address.model.person.Address;
16-
import seedu.address.model.person.Email;
1715
import seedu.address.model.person.Name;
1816
import seedu.address.model.person.Person;
1917
import seedu.address.model.person.Phone;
@@ -31,20 +29,19 @@ public class AddCommandParser implements Parser<AddCommand> {
3129
*/
3230
public AddCommand parse(String args) throws ParseException {
3331
ArgumentMultimap argMultimap =
34-
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG);
32+
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_ADDRESS, PREFIX_TAG);
3533

36-
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL)
34+
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE)
3735
|| !argMultimap.getPreamble().isEmpty()) {
3836
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE));
3937
}
4038

4139
Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get());
4240
Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
43-
Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
4441
Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
4542
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));
4643

47-
Person person = new Person(name, phone, email, address, tagList);
44+
Person person = new Person(name, phone, address, tagList);
4845

4946
return new AddCommand(person);
5047
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public class CliSyntax {
88
/* Prefix definitions */
99
public static final Prefix PREFIX_NAME = new Prefix("n/");
1010
public static final Prefix PREFIX_PHONE = new Prefix("p/");
11-
public static final Prefix PREFIX_EMAIL = new Prefix("e/");
1211
public static final Prefix PREFIX_ADDRESS = new Prefix("a/");
1312
public static final Prefix PREFIX_TAG = new Prefix("t/");
1413

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import seedu.address.commons.util.StringUtil;
1111
import seedu.address.logic.parser.exceptions.ParseException;
1212
import seedu.address.model.person.Address;
13-
import seedu.address.model.person.Email;
1413
import seedu.address.model.person.Name;
1514
import seedu.address.model.person.Phone;
1615
import seedu.address.model.tag.Tag;
@@ -80,21 +79,6 @@ public static Address parseAddress(String address) throws ParseException {
8079
return new Address(trimmedAddress);
8180
}
8281

83-
/**
84-
* Parses a {@code String email} into an {@code Email}.
85-
* Leading and trailing whitespaces will be trimmed.
86-
*
87-
* @throws ParseException if the given {@code email} is invalid.
88-
*/
89-
public static Email parseEmail(String email) throws ParseException {
90-
requireNonNull(email);
91-
String trimmedEmail = email.trim();
92-
if (!Email.isValidEmail(trimmedEmail)) {
93-
throw new ParseException(Email.MESSAGE_CONSTRAINTS);
94-
}
95-
return new Email(trimmedEmail);
96-
}
97-
9882
/**
9983
* Parses a {@code String tag} into a {@code Tag}.
10084
* Leading and trailing whitespaces will be trimmed.

src/main/java/seedu/address/model/person/Email.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/main/java/seedu/address/model/person/Person.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class Person {
1818
// Identity fields
1919
private final Name name;
2020
private final Phone phone;
21-
private final Email email;
2221

2322
// Data fields
2423
private final Address address;
@@ -27,11 +26,10 @@ public class Person {
2726
/**
2827
* Every field must be present and not null.
2928
*/
30-
public Person(Name name, Phone phone, Email email, Address address, Set<Tag> tags) {
31-
requireAllNonNull(name, phone, email, address, tags);
29+
public Person(Name name, Phone phone, Address address, Set<Tag> tags) {
30+
requireAllNonNull(name, phone, address, tags);
3231
this.name = name;
3332
this.phone = phone;
34-
this.email = email;
3533
this.address = address;
3634
this.tags.addAll(tags);
3735
}
@@ -44,10 +42,6 @@ public Phone getPhone() {
4442
return phone;
4543
}
4644

47-
public Email getEmail() {
48-
return email;
49-
}
50-
5145
public Address getAddress() {
5246
return address;
5347
}
@@ -71,7 +65,7 @@ public boolean isSamePerson(Person otherPerson) {
7165

7266
return otherPerson != null
7367
&& otherPerson.getName().equals(getName())
74-
&& (otherPerson.getPhone().equals(getPhone()) || otherPerson.getEmail().equals(getEmail()));
68+
&& (otherPerson.getPhone().equals(getPhone()));
7569
}
7670

7771
/**
@@ -91,15 +85,14 @@ public boolean equals(Object other) {
9185
Person otherPerson = (Person) other;
9286
return otherPerson.getName().equals(getName())
9387
&& otherPerson.getPhone().equals(getPhone())
94-
&& otherPerson.getEmail().equals(getEmail())
9588
&& otherPerson.getAddress().equals(getAddress())
9689
&& otherPerson.getTags().equals(getTags());
9790
}
9891

9992
@Override
10093
public int hashCode() {
10194
// use this method for custom fields hashing instead of implementing your own
102-
return Objects.hash(name, phone, email, address, tags);
95+
return Objects.hash(name, phone, address, tags);
10396
}
10497

10598
@Override
@@ -108,8 +101,6 @@ public String toString() {
108101
builder.append(getName())
109102
.append(" Phone: ")
110103
.append(getPhone())
111-
.append(" Email: ")
112-
.append(getEmail())
113104
.append(" Address: ")
114105
.append(getAddress())
115106
.append(" Tags: ");

src/main/java/seedu/address/model/util/SampleDataUtil.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import seedu.address.model.AddressBook;
88
import seedu.address.model.ReadOnlyAddressBook;
99
import seedu.address.model.person.Address;
10-
import seedu.address.model.person.Email;
1110
import seedu.address.model.person.Name;
1211
import seedu.address.model.person.Person;
1312
import seedu.address.model.person.Phone;
@@ -19,22 +18,22 @@
1918
public class SampleDataUtil {
2019
public static Person[] getSamplePersons() {
2120
return new Person[] {
22-
new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("[email protected]"),
21+
new Person(new Name("Alex Yeoh"), new Phone("87438807"),
2322
new Address("Blk 30 Geylang Street 29, #06-40"),
2423
getTagSet("friends")),
25-
new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("[email protected]"),
24+
new Person(new Name("Bernice Yu"), new Phone("99272758"),
2625
new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"),
2726
getTagSet("colleagues", "friends")),
28-
new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("[email protected]"),
27+
new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"),
2928
new Address("Blk 11 Ang Mo Kio Street 74, #11-04"),
3029
getTagSet("neighbours")),
31-
new Person(new Name("David Li"), new Phone("91031282"), new Email("[email protected]"),
30+
new Person(new Name("David Li"), new Phone("91031282"),
3231
new Address("Blk 436 Serangoon Gardens Street 26, #16-43"),
3332
getTagSet("family")),
34-
new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("[email protected]"),
33+
new Person(new Name("Irfan Ibrahim"), new Phone("92492021"),
3534
new Address("Blk 47 Tampines Street 20, #17-35"),
3635
getTagSet("classmates")),
37-
new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("[email protected]"),
36+
new Person(new Name("Roy Balakrishnan"), new Phone("92624417"),
3837
new Address("Blk 45 Aljunied Street 85, #11-31"),
3938
getTagSet("colleagues"))
4039
};

src/main/java/seedu/address/storage/JsonAdaptedPerson.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import seedu.address.commons.exceptions.IllegalValueException;
1313
import seedu.address.model.person.Address;
14-
import seedu.address.model.person.Email;
1514
import seedu.address.model.person.Name;
1615
import seedu.address.model.person.Person;
1716
import seedu.address.model.person.Phone;
@@ -26,7 +25,6 @@ class JsonAdaptedPerson {
2625

2726
private final String name;
2827
private final String phone;
29-
private final String email;
3028
private final String address;
3129
private final List<JsonAdaptedTag> tagged = new ArrayList<>();
3230

@@ -35,11 +33,10 @@ class JsonAdaptedPerson {
3533
*/
3634
@JsonCreator
3735
public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone,
38-
@JsonProperty("email") String email, @JsonProperty("address") String address,
39-
@JsonProperty("tagged") List<JsonAdaptedTag> tagged) {
36+
@JsonProperty("address") String address,
37+
@JsonProperty("tagged") List<JsonAdaptedTag> tagged) {
4038
this.name = name;
4139
this.phone = phone;
42-
this.email = email;
4340
this.address = address;
4441
if (tagged != null) {
4542
this.tagged.addAll(tagged);
@@ -52,7 +49,6 @@ public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone
5249
public JsonAdaptedPerson(Person source) {
5350
name = source.getName().fullName;
5451
phone = source.getPhone().value;
55-
email = source.getEmail().value;
5652
address = source.getAddress().value;
5753
tagged.addAll(source.getTags().stream()
5854
.map(JsonAdaptedTag::new)
@@ -86,14 +82,6 @@ public Person toModelType() throws IllegalValueException {
8682
}
8783
final Phone modelPhone = new Phone(phone);
8884

89-
if (email == null) {
90-
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Email.class.getSimpleName()));
91-
}
92-
if (!Email.isValidEmail(email)) {
93-
throw new IllegalValueException(Email.MESSAGE_CONSTRAINTS);
94-
}
95-
final Email modelEmail = new Email(email);
96-
9785
if (address == null) {
9886
throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Address.class.getSimpleName()));
9987
}
@@ -103,7 +91,7 @@ public Person toModelType() throws IllegalValueException {
10391
final Address modelAddress = new Address(address);
10492

10593
final Set<Tag> modelTags = new HashSet<>(personTags);
106-
return new Person(modelName, modelPhone, modelEmail, modelAddress, modelTags);
94+
return new Person(modelName, modelPhone, modelAddress, modelTags);
10795
}
10896

10997
}

src/main/java/seedu/address/ui/PersonCard.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public class PersonCard extends UiPart<Region> {
3737
@FXML
3838
private Label address;
3939
@FXML
40-
private Label email;
41-
@FXML
4240
private FlowPane tags;
4341

4442
/**
@@ -51,7 +49,6 @@ public PersonCard(Person person, int displayedIndex) {
5149
name.setText(person.getName().fullName);
5250
phone.setText(person.getPhone().value);
5351
address.setText(person.getAddress().value);
54-
email.setText(person.getEmail().value);
5552
person.getTags().stream()
5653
.sorted(Comparator.comparing(tag -> tag.tagName))
5754
.forEach(tag -> tags.getChildren().add(new Label(tag.tagName)));

0 commit comments

Comments
 (0)