From 3a8a321d5fb7e67c1d1eeeb4763c906fb37e33a2 Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 01:44:44 +0800 Subject: [PATCH 001/568] created enum for Role --- .../java/seedu/address/model/role/Role.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/seedu/address/model/role/Role.java diff --git a/src/main/java/seedu/address/model/role/Role.java b/src/main/java/seedu/address/model/role/Role.java new file mode 100644 index 000000000000..45885e6b88f4 --- /dev/null +++ b/src/main/java/seedu/address/model/role/Role.java @@ -0,0 +1,26 @@ +package seedu.address.model.role; + + +/** + * Determines the level of privilege of the student based on the role assigned. + * Smaller number means more privilege. + * + * e.g. HOUSE_HEAD will have more privilege compared to OGL (1 is less than 2). + */ +public enum Role { + PROJECT_DIRECTOR(0), + HOUSE_HEAD(1), + OGL(2), + PARTICIPANTS(3); + + private final int privilegeNumber; + + Role(int privilegeNumber){ + this.privilegeNumber = privilegeNumber; + } + + public int getPrivilegeNumber(){ + return this.privilegeNumber; + } + +} From 38e0d3c6ac105f4d8615afe10ac2bb9381f81200 Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 01:52:20 +0800 Subject: [PATCH 002/568] created skeleton class for appointments in FOP --- .../model/camp_appointment/HouseHead.java | 25 +++++++++++++++++++ .../address/model/camp_appointment/OGL.java | 25 +++++++++++++++++++ .../model/camp_appointment/Participant.java | 4 +++ .../camp_appointment/ProjectDirector.java | 25 +++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 src/main/java/seedu/address/model/camp_appointment/HouseHead.java create mode 100644 src/main/java/seedu/address/model/camp_appointment/OGL.java create mode 100644 src/main/java/seedu/address/model/camp_appointment/Participant.java create mode 100644 src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java diff --git a/src/main/java/seedu/address/model/camp_appointment/HouseHead.java b/src/main/java/seedu/address/model/camp_appointment/HouseHead.java new file mode 100644 index 000000000000..8fe721d0dc99 --- /dev/null +++ b/src/main/java/seedu/address/model/camp_appointment/HouseHead.java @@ -0,0 +1,25 @@ +package seedu.address.model.camp_appointment; + +import seedu.address.model.person.Address; +import seedu.address.model.person.Email; +import seedu.address.model.person.Name; +import seedu.address.model.person.Person; +import seedu.address.model.person.Phone; +import seedu.address.model.tag.Tag; + +import java.util.Set; + +public class HouseHead extends Person { + /** + * Every field must be present and not null. + * + * @param name + * @param phone + * @param email + * @param address + * @param tags + */ + public HouseHead(Name name, Phone phone, Email email, Address address, Set tags) { + super(name, phone, email, address, tags); + } +} diff --git a/src/main/java/seedu/address/model/camp_appointment/OGL.java b/src/main/java/seedu/address/model/camp_appointment/OGL.java new file mode 100644 index 000000000000..e0b03c7d89ec --- /dev/null +++ b/src/main/java/seedu/address/model/camp_appointment/OGL.java @@ -0,0 +1,25 @@ +package seedu.address.model.camp_appointment; + +import seedu.address.model.person.Address; +import seedu.address.model.person.Email; +import seedu.address.model.person.Name; +import seedu.address.model.person.Person; +import seedu.address.model.person.Phone; +import seedu.address.model.tag.Tag; + +import java.util.Set; + +public class OGL extends Person { + /** + * Every field must be present and not null. + * + * @param name + * @param phone + * @param email + * @param address + * @param tags + */ + public OGL(Name name, Phone phone, Email email, Address address, Set tags) { + super(name, phone, email, address, tags); + } +} diff --git a/src/main/java/seedu/address/model/camp_appointment/Participant.java b/src/main/java/seedu/address/model/camp_appointment/Participant.java new file mode 100644 index 000000000000..28ebbe24b981 --- /dev/null +++ b/src/main/java/seedu/address/model/camp_appointment/Participant.java @@ -0,0 +1,4 @@ +package seedu.address.model.camp_appointment; + +public class Participant { +} diff --git a/src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java b/src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java new file mode 100644 index 000000000000..bd7acedd0cf1 --- /dev/null +++ b/src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java @@ -0,0 +1,25 @@ +package seedu.address.model.camp_appointment; + +import seedu.address.model.person.Address; +import seedu.address.model.person.Email; +import seedu.address.model.person.Name; +import seedu.address.model.person.Person; +import seedu.address.model.person.Phone; +import seedu.address.model.tag.Tag; + +import java.util.Set; + +public class ProjectDirector extends Person { + /** + * Every field must be present and not null. + * + * @param name + * @param phone + * @param email + * @param address + * @param tags + */ + public ProjectDirector(Name name, Phone phone, Email email, Address address, Set tags) { + super(name, phone, email, address, tags); + } +} From 4c152a78b5f6d1f636648013fe5f81bbbc4dab8d Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 02:26:19 +0800 Subject: [PATCH 003/568] renamed OGL to Ogl --- .../address/model/camp_appointment/{OGL.java => Ogl.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/main/java/seedu/address/model/camp_appointment/{OGL.java => Ogl.java} (85%) diff --git a/src/main/java/seedu/address/model/camp_appointment/OGL.java b/src/main/java/seedu/address/model/camp_appointment/Ogl.java similarity index 85% rename from src/main/java/seedu/address/model/camp_appointment/OGL.java rename to src/main/java/seedu/address/model/camp_appointment/Ogl.java index e0b03c7d89ec..221b7b86cbb6 100644 --- a/src/main/java/seedu/address/model/camp_appointment/OGL.java +++ b/src/main/java/seedu/address/model/camp_appointment/Ogl.java @@ -9,7 +9,7 @@ import java.util.Set; -public class OGL extends Person { +public class Ogl extends Person { /** * Every field must be present and not null. * @@ -19,7 +19,7 @@ public class OGL extends Person { * @param address * @param tags */ - public OGL(Name name, Phone phone, Email email, Address address, Set tags) { + public Ogl(Name name, Phone phone, Email email, Address address, Set tags) { super(name, phone, email, address, tags); } } From 4db1c685da9a6540a03b862bb43b5f94181ce348 Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 02:54:08 +0800 Subject: [PATCH 004/568] changed naming convention attempt on fixing code style --- .../address/model/camp_appointment/Participant.java | 4 ---- .../{role/Role.java => privilege/Privilege.java} | 12 ++++++------ .../model/{camp_appointment => role}/HouseHead.java | 10 +++++++++- .../model/{camp_appointment => role}/Ogl.java | 5 ++++- .../java/seedu/address/model/role/Participant.java | 7 +++++++ .../{camp_appointment => role}/ProjectDirector.java | 5 ++++- 6 files changed, 30 insertions(+), 13 deletions(-) delete mode 100644 src/main/java/seedu/address/model/camp_appointment/Participant.java rename src/main/java/seedu/address/model/{role/Role.java => privilege/Privilege.java} (71%) rename src/main/java/seedu/address/model/{camp_appointment => role}/HouseHead.java (80%) rename src/main/java/seedu/address/model/{camp_appointment => role}/Ogl.java (91%) create mode 100644 src/main/java/seedu/address/model/role/Participant.java rename src/main/java/seedu/address/model/{camp_appointment => role}/ProjectDirector.java (90%) diff --git a/src/main/java/seedu/address/model/camp_appointment/Participant.java b/src/main/java/seedu/address/model/camp_appointment/Participant.java deleted file mode 100644 index 28ebbe24b981..000000000000 --- a/src/main/java/seedu/address/model/camp_appointment/Participant.java +++ /dev/null @@ -1,4 +0,0 @@ -package seedu.address.model.camp_appointment; - -public class Participant { -} diff --git a/src/main/java/seedu/address/model/role/Role.java b/src/main/java/seedu/address/model/privilege/Privilege.java similarity index 71% rename from src/main/java/seedu/address/model/role/Role.java rename to src/main/java/seedu/address/model/privilege/Privilege.java index 45885e6b88f4..0cf3c5f9304d 100644 --- a/src/main/java/seedu/address/model/role/Role.java +++ b/src/main/java/seedu/address/model/privilege/Privilege.java @@ -1,13 +1,13 @@ -package seedu.address.model.role; +package seedu.address.model.privilege; /** - * Determines the level of privilege of the student based on the role assigned. + * Determines the level of privilege of the student based on the privilege assigned. * Smaller number means more privilege. - * + *

* e.g. HOUSE_HEAD will have more privilege compared to OGL (1 is less than 2). */ -public enum Role { +public enum Privilege { PROJECT_DIRECTOR(0), HOUSE_HEAD(1), OGL(2), @@ -15,11 +15,11 @@ public enum Role { private final int privilegeNumber; - Role(int privilegeNumber){ + Privilege(int privilegeNumber) { this.privilegeNumber = privilegeNumber; } - public int getPrivilegeNumber(){ + public int getPrivilegeNumber() { return this.privilegeNumber; } diff --git a/src/main/java/seedu/address/model/camp_appointment/HouseHead.java b/src/main/java/seedu/address/model/role/HouseHead.java similarity index 80% rename from src/main/java/seedu/address/model/camp_appointment/HouseHead.java rename to src/main/java/seedu/address/model/role/HouseHead.java index 8fe721d0dc99..d8facecc6093 100644 --- a/src/main/java/seedu/address/model/camp_appointment/HouseHead.java +++ b/src/main/java/seedu/address/model/role/HouseHead.java @@ -1,15 +1,22 @@ -package seedu.address.model.camp_appointment; +package seedu.address.model.role; import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; import java.util.Set; +/** + * HouseHead for FOP. + */ public class HouseHead extends Person { + + private Privilege privilege; + /** * Every field must be present and not null. * @@ -21,5 +28,6 @@ public class HouseHead extends Person { */ public HouseHead(Name name, Phone phone, Email email, Address address, Set tags) { super(name, phone, email, address, tags); + } } diff --git a/src/main/java/seedu/address/model/camp_appointment/Ogl.java b/src/main/java/seedu/address/model/role/Ogl.java similarity index 91% rename from src/main/java/seedu/address/model/camp_appointment/Ogl.java rename to src/main/java/seedu/address/model/role/Ogl.java index 221b7b86cbb6..4be8424371ae 100644 --- a/src/main/java/seedu/address/model/camp_appointment/Ogl.java +++ b/src/main/java/seedu/address/model/role/Ogl.java @@ -1,4 +1,4 @@ -package seedu.address.model.camp_appointment; +package seedu.address.model.role; import seedu.address.model.person.Address; import seedu.address.model.person.Email; @@ -9,6 +9,9 @@ import java.util.Set; +/** + * OGL for FOP. + */ public class Ogl extends Person { /** * Every field must be present and not null. diff --git a/src/main/java/seedu/address/model/role/Participant.java b/src/main/java/seedu/address/model/role/Participant.java new file mode 100644 index 000000000000..3ab2680555cd --- /dev/null +++ b/src/main/java/seedu/address/model/role/Participant.java @@ -0,0 +1,7 @@ +package seedu.address.model.role; + +/** + * Participant for FOP. + */ +public class Participant { +} diff --git a/src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java b/src/main/java/seedu/address/model/role/ProjectDirector.java similarity index 90% rename from src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java rename to src/main/java/seedu/address/model/role/ProjectDirector.java index bd7acedd0cf1..4333f2f3a814 100644 --- a/src/main/java/seedu/address/model/camp_appointment/ProjectDirector.java +++ b/src/main/java/seedu/address/model/role/ProjectDirector.java @@ -1,4 +1,4 @@ -package seedu.address.model.camp_appointment; +package seedu.address.model.role; import seedu.address.model.person.Address; import seedu.address.model.person.Email; @@ -9,6 +9,9 @@ import java.util.Set; +/** + * Project Director for FOP. + */ public class ProjectDirector extends Person { /** * Every field must be present and not null. From 801580a134d8483690155c2b28444188dab3c11c Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 03:01:29 +0800 Subject: [PATCH 005/568] attempt on fixing code style --- src/main/java/seedu/address/model/role/HouseHead.java | 4 ++-- src/main/java/seedu/address/model/role/Ogl.java | 4 ++-- src/main/java/seedu/address/model/role/ProjectDirector.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/seedu/address/model/role/HouseHead.java b/src/main/java/seedu/address/model/role/HouseHead.java index d8facecc6093..52b851611d28 100644 --- a/src/main/java/seedu/address/model/role/HouseHead.java +++ b/src/main/java/seedu/address/model/role/HouseHead.java @@ -1,5 +1,7 @@ package seedu.address.model.role; +import java.util.Set; + import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; @@ -8,8 +10,6 @@ import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; -import java.util.Set; - /** * HouseHead for FOP. */ diff --git a/src/main/java/seedu/address/model/role/Ogl.java b/src/main/java/seedu/address/model/role/Ogl.java index 4be8424371ae..969e11c7dcc9 100644 --- a/src/main/java/seedu/address/model/role/Ogl.java +++ b/src/main/java/seedu/address/model/role/Ogl.java @@ -1,5 +1,7 @@ package seedu.address.model.role; +import java.util.Set; + import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; @@ -7,8 +9,6 @@ import seedu.address.model.person.Phone; import seedu.address.model.tag.Tag; -import java.util.Set; - /** * OGL for FOP. */ diff --git a/src/main/java/seedu/address/model/role/ProjectDirector.java b/src/main/java/seedu/address/model/role/ProjectDirector.java index 4333f2f3a814..da23e86c8c6c 100644 --- a/src/main/java/seedu/address/model/role/ProjectDirector.java +++ b/src/main/java/seedu/address/model/role/ProjectDirector.java @@ -1,5 +1,7 @@ package seedu.address.model.role; +import java.util.Set; + import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; @@ -7,8 +9,6 @@ import seedu.address.model.person.Phone; import seedu.address.model.tag.Tag; -import java.util.Set; - /** * Project Director for FOP. */ From 1d19035c7ac4c86f264d8f16febadf76e119b0bd Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 16:23:03 +0800 Subject: [PATCH 006/568] modified Participant class. extends on Person class. --- .../seedu/address/model/role/Participant.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/address/model/role/Participant.java b/src/main/java/seedu/address/model/role/Participant.java index 3ab2680555cd..29c6fb754835 100644 --- a/src/main/java/seedu/address/model/role/Participant.java +++ b/src/main/java/seedu/address/model/role/Participant.java @@ -1,7 +1,34 @@ package seedu.address.model.role; +import seedu.address.model.person.Address; +import seedu.address.model.person.Email; +import seedu.address.model.person.Name; +import seedu.address.model.person.Person; +import seedu.address.model.person.Phone; +import seedu.address.model.privilege.Privilege; +import seedu.address.model.tag.Tag; + +import java.util.Set; + /** * Participant for FOP. */ -public class Participant { +public class Participant extends Person { + + private Privilege privilege; + + /** + * Every field must be present and not null. + * + * @param name + * @param phone + * @param email + * @param address + * @param tags + */ + public Participant(Name name, Phone phone, Email email, Address address, Set tags) { + super(name, phone, email, address, tags); + // By default everybody is a participant + this.privilege = Privilege.PARTICIPANTS; + } } From 8e9df4639e0678ff46e50abd064454c891f4b42d Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 16:28:32 +0800 Subject: [PATCH 007/568] modified all role class to suit the model structure of the FOP app --- src/main/java/seedu/address/model/role/HouseHead.java | 5 ++--- src/main/java/seedu/address/model/role/Ogl.java | 5 ++++- src/main/java/seedu/address/model/role/Participant.java | 4 ++++ src/main/java/seedu/address/model/role/ProjectDirector.java | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/seedu/address/model/role/HouseHead.java b/src/main/java/seedu/address/model/role/HouseHead.java index 52b851611d28..3f5a3a248289 100644 --- a/src/main/java/seedu/address/model/role/HouseHead.java +++ b/src/main/java/seedu/address/model/role/HouseHead.java @@ -13,9 +13,8 @@ /** * HouseHead for FOP. */ -public class HouseHead extends Person { +public class HouseHead extends Participant { - private Privilege privilege; /** * Every field must be present and not null. @@ -28,6 +27,6 @@ public class HouseHead extends Person { */ public HouseHead(Name name, Phone phone, Email email, Address address, Set tags) { super(name, phone, email, address, tags); - + super.setPrivilege(Privilege.HOUSE_HEAD); } } diff --git a/src/main/java/seedu/address/model/role/Ogl.java b/src/main/java/seedu/address/model/role/Ogl.java index 969e11c7dcc9..00b5acc41e31 100644 --- a/src/main/java/seedu/address/model/role/Ogl.java +++ b/src/main/java/seedu/address/model/role/Ogl.java @@ -7,12 +7,14 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; /** * OGL for FOP. */ -public class Ogl extends Person { +public class Ogl extends Participant { + /** * Every field must be present and not null. * @@ -24,5 +26,6 @@ public class Ogl extends Person { */ public Ogl(Name name, Phone phone, Email email, Address address, Set tags) { super(name, phone, email, address, tags); + super.setPrivilege(Privilege.OGL); } } diff --git a/src/main/java/seedu/address/model/role/Participant.java b/src/main/java/seedu/address/model/role/Participant.java index 29c6fb754835..e696ee8c9f7f 100644 --- a/src/main/java/seedu/address/model/role/Participant.java +++ b/src/main/java/seedu/address/model/role/Participant.java @@ -31,4 +31,8 @@ public Participant(Name name, Phone phone, Email email, Address address, Set tags) { super(name, phone, email, address, tags); + super.setPrivilege(Privilege.PROJECT_DIRECTOR); } } From 82b4d7d732a97c4816d1b67482cbff29842bd0bf Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 16:30:10 +0800 Subject: [PATCH 008/568] removed unnecessary imports, added more comments and reordering of imports --- src/main/java/seedu/address/model/role/HouseHead.java | 1 - src/main/java/seedu/address/model/role/Ogl.java | 1 - src/main/java/seedu/address/model/role/Participant.java | 6 ++++-- src/main/java/seedu/address/model/role/ProjectDirector.java | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/seedu/address/model/role/HouseHead.java b/src/main/java/seedu/address/model/role/HouseHead.java index 3f5a3a248289..49a13eda9ca8 100644 --- a/src/main/java/seedu/address/model/role/HouseHead.java +++ b/src/main/java/seedu/address/model/role/HouseHead.java @@ -5,7 +5,6 @@ import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; -import seedu.address.model.person.Person; import seedu.address.model.person.Phone; import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; diff --git a/src/main/java/seedu/address/model/role/Ogl.java b/src/main/java/seedu/address/model/role/Ogl.java index 00b5acc41e31..9d9972abc070 100644 --- a/src/main/java/seedu/address/model/role/Ogl.java +++ b/src/main/java/seedu/address/model/role/Ogl.java @@ -5,7 +5,6 @@ import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; -import seedu.address.model.person.Person; import seedu.address.model.person.Phone; import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; diff --git a/src/main/java/seedu/address/model/role/Participant.java b/src/main/java/seedu/address/model/role/Participant.java index e696ee8c9f7f..7e77d5e74fca 100644 --- a/src/main/java/seedu/address/model/role/Participant.java +++ b/src/main/java/seedu/address/model/role/Participant.java @@ -1,5 +1,7 @@ package seedu.address.model.role; +import java.util.Set; + import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; @@ -8,10 +10,10 @@ import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; -import java.util.Set; - /** * Participant for FOP. + * + * By default everybody will be a participant unless assigned. */ public class Participant extends Person { diff --git a/src/main/java/seedu/address/model/role/ProjectDirector.java b/src/main/java/seedu/address/model/role/ProjectDirector.java index 629213f6aa31..85fa5c233bbb 100644 --- a/src/main/java/seedu/address/model/role/ProjectDirector.java +++ b/src/main/java/seedu/address/model/role/ProjectDirector.java @@ -5,7 +5,6 @@ import seedu.address.model.person.Address; import seedu.address.model.person.Email; import seedu.address.model.person.Name; -import seedu.address.model.person.Person; import seedu.address.model.person.Phone; import seedu.address.model.privilege.Privilege; import seedu.address.model.tag.Tag; From 9e0d40aff061c43d241e48377120af52aca5e046 Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 16:36:37 +0800 Subject: [PATCH 009/568] shifted privilege getter from Privilege class to Participant class --- src/main/java/seedu/address/model/privilege/Privilege.java | 3 --- src/main/java/seedu/address/model/role/Participant.java | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/seedu/address/model/privilege/Privilege.java b/src/main/java/seedu/address/model/privilege/Privilege.java index 0cf3c5f9304d..3d6595670550 100644 --- a/src/main/java/seedu/address/model/privilege/Privilege.java +++ b/src/main/java/seedu/address/model/privilege/Privilege.java @@ -19,8 +19,5 @@ public enum Privilege { this.privilegeNumber = privilegeNumber; } - public int getPrivilegeNumber() { - return this.privilegeNumber; - } } diff --git a/src/main/java/seedu/address/model/role/Participant.java b/src/main/java/seedu/address/model/role/Participant.java index 7e77d5e74fca..ff8d23fe9cab 100644 --- a/src/main/java/seedu/address/model/role/Participant.java +++ b/src/main/java/seedu/address/model/role/Participant.java @@ -12,7 +12,7 @@ /** * Participant for FOP. - * + *

* By default everybody will be a participant unless assigned. */ public class Participant extends Person { @@ -37,4 +37,8 @@ public Participant(Name name, Phone phone, Email email, Address address, Set Date: Sat, 2 Mar 2019 21:24:15 +0800 Subject: [PATCH 010/568] created portfolio for indivudal members (each is maintained by respective members) and modified AboutUs --- docs/AboutUs.adoc | 30 ++++++++-------- docs/team/shanseet.adoc | 72 +++++++++++++++++++++++++++++++++++++ docs/team/ssunil3232.adoc | 72 +++++++++++++++++++++++++++++++++++++ docs/team/tantantan277.adoc | 72 +++++++++++++++++++++++++++++++++++++ docs/team/weizhang05.adoc | 72 +++++++++++++++++++++++++++++++++++++ 5 files changed, 303 insertions(+), 15 deletions(-) create mode 100644 docs/team/shanseet.adoc create mode 100644 docs/team/ssunil3232.adoc create mode 100644 docs/team/tantantan277.adoc create mode 100644 docs/team/weizhang05.adoc diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc index e647ed1e715a..6942dc25cecb 100644 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -4,7 +4,7 @@ :imagesDir: images :stylesDir: stylesheets -AddressBook - Level 4 was developed by the https://se-edu.github.io/docs/Team.html[se-edu] team. + +AddressBook - Level 4 was developed by the https://cs2113-ay1819s2-t08-4.github.io/main/AboutUs.html[T08-4] team. + _{The dummy content given below serves as a placeholder to be used by future forks of the project.}_ + {empty} + We are a team based in the http://www.comp.nus.edu.sg[School of Computing, National University of Singapore]. @@ -19,38 +19,38 @@ Role: Project Advisor ''' -=== John Roe -image::lejolly.jpg[width="150", align="left"] -{empty}[http://github.com/lejolly[github]] [<>] +=== Chan Wei Zhang +image::weizhang05.jpg[width="150", align="left"] +{empty}[https://github.com/weizhang05[github]] [<>] -Role: Team Lead + -Responsibilities: UI +Role: Team Lead + Developer +Responsibilities: Integration ''' === Johnny Doe -image::yijinl.jpg[width="150", align="left"] -{empty}[http://github.com/yijinl[github]] [<>] +image::tantantan277.jpg[width="150", align="left"] +{empty}[http://github.com/tantantan277[github]] [<>] Role: Developer + -Responsibilities: Data +Responsibilities: ''' === Johnny Roe -image::m133225.jpg[width="150", align="left"] -{empty}[http://github.com/m133225[github]] [<>] +image::shanseet.jpg[width="150", align="left"] +{empty}[http://github.com/shanseet[github]] [<>] Role: Developer + -Responsibilities: Dev Ops + Threading +Responsibilities: ''' === Benson Meier -image::yl_coder.jpg[width="150", align="left"] -{empty}[http://github.com/yl-coder[github]] [<>] +image::ssunil3232.jpg[width="150", align="left"] +{empty}[http://github.com/ssunil3232[github]] [<>] Role: Developer + -Responsibilities: UI +Responsibilities: ''' diff --git a/docs/team/shanseet.adoc b/docs/team/shanseet.adoc new file mode 100644 index 000000000000..453c2152ab9d --- /dev/null +++ b/docs/team/shanseet.adoc @@ -0,0 +1,72 @@ += John Doe - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: AddressBook - Level 4 + +--- + +== Overview + +AddressBook - Level 4 is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. + +== Summary of contributions + +* *Major enhancement*: added *the ability to undo/redo previous commands* +** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. +** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. +** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. +** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ + +* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys. + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub +** Enhancements to existing features: +*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) +*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) +** Documentation: +*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] +** Community: +*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] +*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) +*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) +** Tools: +*** Integrated a third party library (Natty) to the project (https://github.com[#42]) +*** Integrated a new Github plugin (CircleCI) to the team repo + +_{you can add/remove categories in the list above}_ + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ +|=== + +include::../UserGuide.adoc[tag=undoredo] + +include::../UserGuide.adoc[tag=dataencryption] + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +include::../DeveloperGuide.adoc[tag=undoredo] + +include::../DeveloperGuide.adoc[tag=dataencryption] + + +== PROJECT: PowerPointLabs + +--- + +_{Optionally, you may include other projects in your portfolio.}_ diff --git a/docs/team/ssunil3232.adoc b/docs/team/ssunil3232.adoc new file mode 100644 index 000000000000..453c2152ab9d --- /dev/null +++ b/docs/team/ssunil3232.adoc @@ -0,0 +1,72 @@ += John Doe - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: AddressBook - Level 4 + +--- + +== Overview + +AddressBook - Level 4 is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. + +== Summary of contributions + +* *Major enhancement*: added *the ability to undo/redo previous commands* +** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. +** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. +** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. +** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ + +* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys. + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub +** Enhancements to existing features: +*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) +*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) +** Documentation: +*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] +** Community: +*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] +*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) +*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) +** Tools: +*** Integrated a third party library (Natty) to the project (https://github.com[#42]) +*** Integrated a new Github plugin (CircleCI) to the team repo + +_{you can add/remove categories in the list above}_ + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ +|=== + +include::../UserGuide.adoc[tag=undoredo] + +include::../UserGuide.adoc[tag=dataencryption] + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +include::../DeveloperGuide.adoc[tag=undoredo] + +include::../DeveloperGuide.adoc[tag=dataencryption] + + +== PROJECT: PowerPointLabs + +--- + +_{Optionally, you may include other projects in your portfolio.}_ diff --git a/docs/team/tantantan277.adoc b/docs/team/tantantan277.adoc new file mode 100644 index 000000000000..453c2152ab9d --- /dev/null +++ b/docs/team/tantantan277.adoc @@ -0,0 +1,72 @@ += John Doe - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: AddressBook - Level 4 + +--- + +== Overview + +AddressBook - Level 4 is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. + +== Summary of contributions + +* *Major enhancement*: added *the ability to undo/redo previous commands* +** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. +** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. +** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. +** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ + +* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys. + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub +** Enhancements to existing features: +*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) +*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) +** Documentation: +*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] +** Community: +*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] +*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) +*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) +** Tools: +*** Integrated a third party library (Natty) to the project (https://github.com[#42]) +*** Integrated a new Github plugin (CircleCI) to the team repo + +_{you can add/remove categories in the list above}_ + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ +|=== + +include::../UserGuide.adoc[tag=undoredo] + +include::../UserGuide.adoc[tag=dataencryption] + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +include::../DeveloperGuide.adoc[tag=undoredo] + +include::../DeveloperGuide.adoc[tag=dataencryption] + + +== PROJECT: PowerPointLabs + +--- + +_{Optionally, you may include other projects in your portfolio.}_ diff --git a/docs/team/weizhang05.adoc b/docs/team/weizhang05.adoc new file mode 100644 index 000000000000..453c2152ab9d --- /dev/null +++ b/docs/team/weizhang05.adoc @@ -0,0 +1,72 @@ += John Doe - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: AddressBook - Level 4 + +--- + +== Overview + +AddressBook - Level 4 is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. + +== Summary of contributions + +* *Major enhancement*: added *the ability to undo/redo previous commands* +** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. +** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. +** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. +** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ + +* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys. + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub +** Enhancements to existing features: +*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) +*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) +** Documentation: +*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] +** Community: +*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] +*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) +*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) +** Tools: +*** Integrated a third party library (Natty) to the project (https://github.com[#42]) +*** Integrated a new Github plugin (CircleCI) to the team repo + +_{you can add/remove categories in the list above}_ + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ +|=== + +include::../UserGuide.adoc[tag=undoredo] + +include::../UserGuide.adoc[tag=dataencryption] + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +include::../DeveloperGuide.adoc[tag=undoredo] + +include::../DeveloperGuide.adoc[tag=dataencryption] + + +== PROJECT: PowerPointLabs + +--- + +_{Optionally, you may include other projects in your portfolio.}_ From 94a04b9ae1511bd80b499436de79013494adde44 Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 21:34:49 +0800 Subject: [PATCH 011/568] fix style check on AboutUs --- docs/AboutUs.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc index 6942dc25cecb..c45fbf8a36af 100644 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -33,7 +33,7 @@ image::tantantan277.jpg[width="150", align="left"] {empty}[http://github.com/tantantan277[github]] [<>] Role: Developer + -Responsibilities: +Responsibilities: + ''' @@ -42,7 +42,7 @@ image::shanseet.jpg[width="150", align="left"] {empty}[http://github.com/shanseet[github]] [<>] Role: Developer + -Responsibilities: +Responsibilities: + ''' @@ -51,6 +51,6 @@ image::ssunil3232.jpg[width="150", align="left"] {empty}[http://github.com/ssunil3232[github]] [<>] Role: Developer + -Responsibilities: +Responsibilities: + ''' From e4baeab46fc2017b7cd2352081092c3694528b80 Mon Sep 17 00:00:00 2001 From: weizhang05 Date: Sat, 2 Mar 2019 22:10:56 +0800 Subject: [PATCH 012/568] created skeleton for randomize command --- .../logic/commands/RandomizeCommand.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/main/java/seedu/address/logic/commands/RandomizeCommand.java diff --git a/src/main/java/seedu/address/logic/commands/RandomizeCommand.java b/src/main/java/seedu/address/logic/commands/RandomizeCommand.java new file mode 100644 index 000000000000..e0c9e4636a78 --- /dev/null +++ b/src/main/java/seedu/address/logic/commands/RandomizeCommand.java @@ -0,0 +1,19 @@ +package seedu.address.logic.commands; + +import seedu.address.logic.CommandHistory; +import seedu.address.logic.commands.exceptions.CommandException; +import seedu.address.model.Model; + +/** + * Randomly assigns all participants to all available groups. + * Evenly distributes the participants (number differs from either 1 or 2). + */ +public class RandomizeCommand extends Command { + + public static final String COMMAND_WORD = "randomize"; + + @Override + public CommandResult execute(Model model, CommandHistory history) throws CommandException { + return null; + } +} From d78b8478e0278c07d5dbb909615686107715155a Mon Sep 17 00:00:00 2001 From: shanseet Date: Sun, 3 Mar 2019 21:12:32 +0800 Subject: [PATCH 013/568] Added "Group" attribute to person. UI does not display group name in PersonCard yet. --- .../address/logic/commands/AddCommand.java | 6 ++- .../address/logic/commands/EditCommand.java | 17 ++++++- .../logic/parser/AddCommandParser.java | 8 ++- .../seedu/address/logic/parser/CliSyntax.java | 1 + .../address/logic/parser/ParserUtil.java | 16 ++++++ .../seedu/address/model/person/Group.java | 50 +++++++++++++++++++ .../seedu/address/model/person/Person.java | 16 ++++-- .../address/model/util/SampleDataUtil.java | 13 ++--- .../address/storage/JsonAdaptedPerson.java | 19 ++++++- .../java/seedu/address/ui/PersonCard.java | 3 ++ .../invalidAndValidPersonAddressBook.json | 6 ++- .../invalidPersonAddressBook.json | 3 +- .../duplicatePersonAddressBook.json | 4 +- .../invalidPersonAddressBook.json | 3 +- .../typicalPersonsAddressBook.json | 7 +++ .../guitests/guihandles/PersonCardHandle.java | 8 +++ .../logic/commands/CommandTestUtil.java | 10 +++- .../storage/JsonAdaptedPersonTest.java | 32 ++++++++---- .../testutil/EditPersonDescriptorBuilder.java | 10 ++++ .../seedu/address/testutil/PersonBuilder.java | 12 ++++- .../seedu/address/testutil/PersonUtil.java | 3 ++ .../address/testutil/TypicalPersons.java | 27 +++++----- .../seedu/address/ui/PersonListPanelTest.java | 4 +- 23 files changed, 231 insertions(+), 47 deletions(-) create mode 100644 src/main/java/seedu/address/model/person/Group.java diff --git a/src/main/java/seedu/address/logic/commands/AddCommand.java b/src/main/java/seedu/address/logic/commands/AddCommand.java index d88e831ff1ce..ed65269385bf 100644 --- a/src/main/java/seedu/address/logic/commands/AddCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddCommand.java @@ -3,6 +3,7 @@ import static java.util.Objects.requireNonNull; import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; +import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; @@ -25,14 +26,15 @@ public class AddCommand extends Command { + PREFIX_PHONE + "PHONE " + PREFIX_EMAIL + "EMAIL " + PREFIX_ADDRESS + "ADDRESS " + + PREFIX_GROUP + "GROUP " + "[" + PREFIX_TAG + "TAG]...\n" + "Example: " + COMMAND_WORD + " " + PREFIX_NAME + "John Doe " + PREFIX_PHONE + "98765432 " + PREFIX_EMAIL + "johnd@example.com " + PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " - + PREFIX_TAG + "friends " - + PREFIX_TAG + "owesMoney"; + + PREFIX_GROUP + "1 " + + PREFIX_TAG + "friends "; public static final String MESSAGE_SUCCESS = "New person added: %1$s"; public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; diff --git a/src/main/java/seedu/address/logic/commands/EditCommand.java b/src/main/java/seedu/address/logic/commands/EditCommand.java index 952a9e7e7f2b..8d1178104839 100644 --- a/src/main/java/seedu/address/logic/commands/EditCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditCommand.java @@ -5,6 +5,7 @@ import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; +import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP; import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; @@ -25,6 +26,7 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Group; import seedu.address.model.tag.Tag; /** @@ -42,6 +44,7 @@ public class EditCommand extends Command { + "[" + PREFIX_PHONE + "PHONE] " + "[" + PREFIX_EMAIL + "EMAIL] " + "[" + PREFIX_ADDRESS + "ADDRESS] " + + "[" + PREFIX_GROUP + "GROUP]" + "[" + PREFIX_TAG + "TAG]...\n" + "Example: " + COMMAND_WORD + " 1 " + PREFIX_PHONE + "91234567 " @@ -99,9 +102,10 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); + Group updatedGroup = editPersonDescriptor.getGroup().orElse(personToEdit.getGroup()); Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); - return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags); + return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedGroup, updatedTags); } @Override @@ -131,6 +135,7 @@ public static class EditPersonDescriptor { private Phone phone; private Email email; private Address address; + private Group group; private Set tags; public EditPersonDescriptor() {} @@ -144,6 +149,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setPhone(toCopy.phone); setEmail(toCopy.email); setAddress(toCopy.address); + setGroup(toCopy.group); setTags(toCopy.tags); } @@ -186,6 +192,14 @@ public Optional

getAddress() { return Optional.ofNullable(address); } + public void setGroup(Group group) { + this.group = group; + } + + public Optional getGroup() { + return Optional.ofNullable(group); + } + /** * Sets {@code tags} to this object's {@code tags}. * A defensive copy of {@code tags} is used internally. @@ -222,6 +236,7 @@ public boolean equals(Object other) { && getPhone().equals(e.getPhone()) && getEmail().equals(e.getEmail()) && getAddress().equals(e.getAddress()) + && getGroup().equals(e.getGroup()) && getTags().equals(e.getTags()); } } diff --git a/src/main/java/seedu/address/logic/parser/AddCommandParser.java b/src/main/java/seedu/address/logic/parser/AddCommandParser.java index 3b8bfa035e83..63a9c2f3f7e5 100644 --- a/src/main/java/seedu/address/logic/parser/AddCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/AddCommandParser.java @@ -3,6 +3,7 @@ import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; +import static seedu.address.logic.parser.CliSyntax.PREFIX_GROUP; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; @@ -17,6 +18,7 @@ import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; +import seedu.address.model.person.Group; import seedu.address.model.tag.Tag; /** @@ -31,7 +33,8 @@ public class AddCommandParser implements Parser { */ public AddCommand parse(String args) throws ParseException { ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_GROUP, PREFIX_TAG); if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) || !argMultimap.getPreamble().isEmpty()) { @@ -42,9 +45,10 @@ public AddCommand parse(String args) throws ParseException { Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); + Group group = ParserUtil.parseGroup(argMultimap.getValue(PREFIX_GROUP).get()); Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); - Person person = new Person(name, phone, email, address, tagList); + Person person = new Person(name, phone, email, address, group, tagList); return new AddCommand(person); } diff --git a/src/main/java/seedu/address/logic/parser/CliSyntax.java b/src/main/java/seedu/address/logic/parser/CliSyntax.java index 75b1a9bf1190..91dc9ba5829f 100644 --- a/src/main/java/seedu/address/logic/parser/CliSyntax.java +++ b/src/main/java/seedu/address/logic/parser/CliSyntax.java @@ -10,6 +10,7 @@ public class CliSyntax { public static final Prefix PREFIX_PHONE = new Prefix("p/"); public static final Prefix PREFIX_EMAIL = new Prefix("e/"); public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); + public static final Prefix PREFIX_GROUP = new Prefix("g/"); public static final Prefix PREFIX_TAG = new Prefix("t/"); } diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index b117acb9c55b..16dac4a62d8f 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -11,6 +11,7 @@ import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Address; import seedu.address.model.person.Email; +import seedu.address.model.person.Group; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; import seedu.address.model.tag.Tag; @@ -95,6 +96,21 @@ public static Email parseEmail(String email) throws ParseException { return new Email(trimmedEmail); } + /** + * Parses a {@code String group} into a {@code Group}. + * Leading and trailing whitespaces will be trimmed. + * + * @throws ParseException if the given {@code group} is invalid. + */ + public static Group parseGroup(String group) throws ParseException { + requireNonNull(group); + String trimmedGroup = group.trim(); + if (!Group.isValidGroupName(trimmedGroup)) { + throw new ParseException(Group.MESSAGE_CONSTRAINTS); + } + return new Group(trimmedGroup); + } + /** * Parses a {@code String tag} into a {@code Tag}. * Leading and trailing whitespaces will be trimmed. diff --git a/src/main/java/seedu/address/model/person/Group.java b/src/main/java/seedu/address/model/person/Group.java new file mode 100644 index 000000000000..8279652402d1 --- /dev/null +++ b/src/main/java/seedu/address/model/person/Group.java @@ -0,0 +1,50 @@ +package seedu.address.model.person; + +import static java.util.Objects.requireNonNull; +import static seedu.address.commons.util.AppUtil.checkArgument; + +public class Group { + public static final String MESSAGE_CONSTRAINTS = "Group names should be alphanumeric"; + public static final String VALIDATION_REGEX = "\\p{Alnum}+"; + + public final String groupName; + + /** + * Constructs a {@code Group}. + * @param groupName A valid group name. + */ + + public Group(String groupName) { + requireNonNull(groupName); + checkArgument(isValidGroupName(groupName), MESSAGE_CONSTRAINTS); + this.groupName = groupName; + } + + /** + * Returns true if a given string is a valid tag name. + */ + public static boolean isValidGroupName(String test) { + return test.matches(VALIDATION_REGEX); + } + + @Override + public boolean equals(Object other) { + return other == this // short circuit if same object + || (other instanceof Group // instanceof handles nulls + && groupName.equals(((Group) other).groupName)); // state check + } + + @Override + public int hashCode() { + return groupName.hashCode(); + } + + /** + * Format state as text for viewing. + */ + + public String toString() { + return "Group " + groupName; + } + +} diff --git a/src/main/java/seedu/address/model/person/Person.java b/src/main/java/seedu/address/model/person/Person.java index 557a7a60cd51..070c9002a292 100644 --- a/src/main/java/seedu/address/model/person/Person.java +++ b/src/main/java/seedu/address/model/person/Person.java @@ -22,17 +22,19 @@ public class Person { // Data fields private final Address address; + private final Group group; private final Set tags = new HashSet<>(); /** * Every field must be present and not null. */ - public Person(Name name, Phone phone, Email email, Address address, Set tags) { - requireAllNonNull(name, phone, email, address, tags); + public Person(Name name, Phone phone, Email email, Address address, Group group, Set tags) { + requireAllNonNull(name, phone, email, address, group, tags); this.name = name; this.phone = phone; this.email = email; this.address = address; + this.group = group; this.tags.addAll(tags); } @@ -56,6 +58,9 @@ public Address getAddress() { * Returns an immutable tag set, which throws {@code UnsupportedOperationException} * if modification is attempted. */ + + public Group getGroup() { return group; } + public Set getTags() { return Collections.unmodifiableSet(tags); } @@ -93,13 +98,14 @@ public boolean equals(Object other) { && otherPerson.getPhone().equals(getPhone()) && otherPerson.getEmail().equals(getEmail()) && otherPerson.getAddress().equals(getAddress()) - && otherPerson.getTags().equals(getTags()); + && otherPerson.getTags().equals(getTags()) + && otherPerson.getGroup().equals(getGroup()); } @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(name, phone, email, address, tags); + return Objects.hash(name, phone, email, address, group, tags); } @Override @@ -112,6 +118,8 @@ public String toString() { .append(getEmail()) .append(" Address: ") .append(getAddress()) + .append(" Group: ") + .append(getGroup()) .append(" Tags: "); getTags().forEach(builder::append); return builder.toString(); diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 1806da4facfa..7005060f6cb5 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -8,6 +8,7 @@ import seedu.address.model.ReadOnlyAddressBook; import seedu.address.model.person.Address; import seedu.address.model.person.Email; +import seedu.address.model.person.Group; import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; @@ -20,22 +21,22 @@ public class SampleDataUtil { public static Person[] getSamplePersons() { return new Person[] { new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), + new Address("Blk 30 Geylang Street 29, #06-40"), new Group("2"), getTagSet("friends")), new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), + new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), new Group("1"), getTagSet("colleagues", "friends")), new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), + new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), new Group("3"), getTagSet("neighbours")), new Person(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), + new Address("Blk 436 Serangoon Gardens Street 26, #16-43"),new Group("1"), getTagSet("family")), new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new Address("Blk 47 Tampines Street 20, #17-35"), + new Address("Blk 47 Tampines Street 20, #17-35"), new Group("2"), getTagSet("classmates")), new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new Address("Blk 45 Aljunied Street 85, #11-31"), + new Address("Blk 45 Aljunied Street 85, #11-31"), new Group("3"), getTagSet("colleagues")) }; } diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java index a6321cec2eac..9079f28244ca 100644 --- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java +++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java @@ -12,6 +12,7 @@ import seedu.address.commons.exceptions.IllegalValueException; import seedu.address.model.person.Address; import seedu.address.model.person.Email; +import seedu.address.model.person.Group; import seedu.address.model.person.Name; import seedu.address.model.person.Person; import seedu.address.model.person.Phone; @@ -28,6 +29,7 @@ class JsonAdaptedPerson { private final String phone; private final String email; private final String address; + private final String group; private final List tagged = new ArrayList<>(); /** @@ -35,12 +37,13 @@ class JsonAdaptedPerson { */ @JsonCreator public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, + @JsonProperty("email") String email, @JsonProperty("address") String address, @JsonProperty("group") String group, @JsonProperty("tagged") List tagged) { this.name = name; this.phone = phone; this.email = email; this.address = address; + this.group = group; if (tagged != null) { this.tagged.addAll(tagged); } @@ -54,6 +57,7 @@ public JsonAdaptedPerson(Person source) { phone = source.getPhone().value; email = source.getEmail().value; address = source.getAddress().value; + group = source.getGroup().groupName; tagged.addAll(source.getTags().stream() .map(JsonAdaptedTag::new) .collect(Collectors.toList())); @@ -102,8 +106,19 @@ public Person toModelType() throws IllegalValueException { } final Address modelAddress = new Address(address); + if (group == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Group.class.getSimpleName())); + } + + if (!Group.isValidGroupName(group)) { + throw new IllegalValueException(Group.MESSAGE_CONSTRAINTS); + } + + final Group modelGroup = new Group(group); + final Set modelTags = new HashSet<>(personTags); - return new Person(modelName, modelPhone, modelEmail, modelAddress, modelTags); + + return new Person(modelName, modelPhone, modelEmail, modelAddress, modelGroup, modelTags); } } diff --git a/src/main/java/seedu/address/ui/PersonCard.java b/src/main/java/seedu/address/ui/PersonCard.java index f6727ea83abd..7a945540cf22 100644 --- a/src/main/java/seedu/address/ui/PersonCard.java +++ b/src/main/java/seedu/address/ui/PersonCard.java @@ -37,6 +37,8 @@ public class PersonCard extends UiPart { @FXML private Label email; @FXML + private Label group; + @FXML private FlowPane tags; public PersonCard(Person person, int displayedIndex) { @@ -47,6 +49,7 @@ public PersonCard(Person person, int displayedIndex) { phone.setText(person.getPhone().value); address.setText(person.getAddress().value); email.setText(person.getEmail().value); +// group.setText(person.getGroup().groupName); person.getTags().forEach(tag -> tags.getChildren().add(new Label(tag.tagName))); } diff --git a/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json b/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json index 6a4d2b7181c3..001e367a7e2c 100644 --- a/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json +++ b/src/test/data/JsonAddressBookStorageTest/invalidAndValidPersonAddressBook.json @@ -3,11 +3,13 @@ "name": "Valid Person", "phone": "9482424", "email": "hans@example.com", - "address": "4th street" + "address": "4th street", + "group": "1" }, { "name": "Person With Invalid Phone Field", "phone": "948asdf2424", "email": "hans@example.com", - "address": "4th street" + "address": "4th street", + "group": "2" } ] } diff --git a/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json b/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json index ccd21f7d1a93..3aaf4e2fd292 100644 --- a/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json +++ b/src/test/data/JsonAddressBookStorageTest/invalidPersonAddressBook.json @@ -3,6 +3,7 @@ "name": "Person with invalid name field: Ha!ns Mu@ster", "phone": "9482424", "email": "hans@example.com", - "address": "4th street" + "address": "4th street", + "group": "4" } ] } diff --git a/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json index 48831cc76744..8915bd0bb309 100644 --- a/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/duplicatePersonAddressBook.json @@ -4,11 +4,13 @@ "phone": "94351253", "email": "alice@example.com", "address": "123, Jurong West Ave 6, #08-111", + "group": "3", "tagged": [ "friends" ] }, { "name": "Alice Pauline", "phone": "94351253", "email": "pauline@example.com", - "address": "4th street" + "address": "4th street", + "group": "2" } ] } diff --git a/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json index ad3f135ae428..a2514233fcf5 100644 --- a/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/invalidPersonAddressBook.json @@ -3,6 +3,7 @@ "name": "Hans Muster", "phone": "9482424", "email": "invalid@email!3e", - "address": "4th street" + "address": "4th street", + "group": "Valid" } ] } diff --git a/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json b/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json index f10eddee12ed..d56b239563cd 100644 --- a/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json +++ b/src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json @@ -5,42 +5,49 @@ "phone" : "94351253", "email" : "alice@example.com", "address" : "123, Jurong West Ave 6, #08-111", + "group": "2", "tagged" : [ "friends" ] }, { "name" : "Benson Meier", "phone" : "98765432", "email" : "johnd@example.com", "address" : "311, Clementi Ave 2, #02-25", + "group": "1", "tagged" : [ "owesMoney", "friends" ] }, { "name" : "Carl Kurz", "phone" : "95352563", "email" : "heinz@example.com", "address" : "wall street", + "group": "1", "tagged" : [ ] }, { "name" : "Daniel Meier", "phone" : "87652533", "email" : "cornelia@example.com", "address" : "10th street", + "group": "4", "tagged" : [ "friends" ] }, { "name" : "Elle Meyer", "phone" : "9482224", "email" : "werner@example.com", "address" : "michegan ave", + "group": "3", "tagged" : [ ] }, { "name" : "Fiona Kunz", "phone" : "9482427", "email" : "lydia@example.com", "address" : "little tokyo", + "group": "2", "tagged" : [ ] }, { "name" : "George Best", "phone" : "9482442", "email" : "anna@example.com", "address" : "4th street", + "group": "5", "tagged" : [ ] } ] } diff --git a/src/test/java/guitests/guihandles/PersonCardHandle.java b/src/test/java/guitests/guihandles/PersonCardHandle.java index 1789735e49a8..eb1f15aeea62 100644 --- a/src/test/java/guitests/guihandles/PersonCardHandle.java +++ b/src/test/java/guitests/guihandles/PersonCardHandle.java @@ -19,6 +19,7 @@ public class PersonCardHandle extends NodeHandle { private static final String ADDRESS_FIELD_ID = "#address"; private static final String PHONE_FIELD_ID = "#phone"; private static final String EMAIL_FIELD_ID = "#email"; + private static final String GROUP_FIELD_ID = "#group"; private static final String TAGS_FIELD_ID = "#tags"; private final Label idLabel; @@ -26,6 +27,7 @@ public class PersonCardHandle extends NodeHandle { private final Label addressLabel; private final Label phoneLabel; private final Label emailLabel; + private final Label groupLabel; private final List