Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[W8.6b][W11-B4] Loh Cai Jun #976

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions src/seedu/addressbook/data/tag/Tagging.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package seedu.addressbook.data.tag;

import seedu.addressbook.data.person.Person;

import java.util.ArrayList;

/**
* Represents an adding or deleting of a tag for a specific {@code Person} that happened during a session
*/
public class Tagging {

private static ArrayList<Tagging> taggings;

public enum ACTION {
ADDED, DELETED
}

private final Person person;
private final Tag tag;
private final ACTION action;

/**
* @param person person whose tag was changed
* @param tag tag that was changed
* @param action type of action
*/
public Tagging(Person person, Tag tag, ACTION action) {
this.person = person;
this.tag = tag;
this.action = action;
addTagging(this);
}

/**
* Adds tagging to class-level variable that stores all taggings during a session
*/
public static void addTagging(Tagging tagging) {
taggings.add(tagging);
}

/**
* Returns all Taggings which represent all changes made to tags during a session
*/
public static ArrayList<Tagging> getTaggings() {
return taggings;
}

public Person getPerson() {
return person;
}

public Tag getTag() {
return tag;
}

public ACTION getAction() {
return action;
}
}