From 20d697de7a8cc867e60c2665b80b8d8bca5e2de4 Mon Sep 17 00:00:00 2001 From: Alaru Date: Thu, 15 Mar 2018 23:28:42 +0800 Subject: [PATCH 1/2] Add Tagging.java --- src/seedu/addressbook/data/tag/Tagging.java | 45 +++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/seedu/addressbook/data/tag/Tagging.java diff --git a/src/seedu/addressbook/data/tag/Tagging.java b/src/seedu/addressbook/data/tag/Tagging.java new file mode 100644 index 000000000..2c947c7ea --- /dev/null +++ b/src/seedu/addressbook/data/tag/Tagging.java @@ -0,0 +1,45 @@ +package seedu.addressbook.data.tag; + +import seedu.addressbook.data.person.Person; + +/** + * Represents a Tagging in the address book. + * Each tagging is an addition or removal of a Person's tag. + */ +public class Tagging { + + private static final String ADDED_SYMBOL = "+"; + private static final String REMOVED_SYMBOL = "-"; + + public enum Status { + ADD, REMOVE + } + + private Person person; + private Tag tag; + private Status status; + + /** + * Creates a tagging based on the tag being added/removed from a Person + * + */ + public Tagging(Person person, Tag tag, Status status) { + this.person = person; + this.tag = tag; + this.status = status; + } + + @Override + public String toString() { + String change = ""; + switch (status) { + case ADD: + change = ADDED_SYMBOL; + break; + case REMOVE: + change = REMOVED_SYMBOL; + } + return change + " " + person.getName() + " [" + tag.toString() + "]"; + } + +} From 31df64db1e133246116b5c35f03a7191635420a5 Mon Sep 17 00:00:00 2001 From: Alaru Date: Thu, 15 Mar 2018 23:29:09 +0800 Subject: [PATCH 2/2] Update Tagging.java --- src/seedu/addressbook/data/tag/Tagging.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/seedu/addressbook/data/tag/Tagging.java b/src/seedu/addressbook/data/tag/Tagging.java index 2c947c7ea..52babee5c 100644 --- a/src/seedu/addressbook/data/tag/Tagging.java +++ b/src/seedu/addressbook/data/tag/Tagging.java @@ -39,7 +39,7 @@ public String toString() { case REMOVE: change = REMOVED_SYMBOL; } - return change + " " + person.getName() + " [" + tag.toString() + "]"; + return change + " " + person.getName() + " " + tag.toString(); } }