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][W15-B4]Muhammad Nur Kamal #962

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/seedu/addressbook/data/AddressBook.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package seedu.addressbook.data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -11,6 +12,7 @@
import seedu.addressbook.data.person.UniquePersonList.DuplicatePersonException;
import seedu.addressbook.data.person.UniquePersonList.PersonNotFoundException;
import seedu.addressbook.data.tag.Tag;
import seedu.addressbook.data.tag.Tagging;
import seedu.addressbook.data.tag.UniqueTagList;

/**
Expand All @@ -24,13 +26,15 @@ public class AddressBook {

private final UniquePersonList allPersons;
private final UniqueTagList allTags; // can contain tags not attached to any person
private final ArrayList<Tagging> taggings;

/**
* Creates an empty address book.
*/
public AddressBook() {
allPersons = new UniquePersonList();
allTags = new UniqueTagList();
taggings = new ArrayList<>();
}

/**
Expand All @@ -46,6 +50,7 @@ public AddressBook(UniquePersonList persons, UniqueTagList tags) {
for (Person p : allPersons) {
syncTagsWithMasterList(p);
}
taggings = new ArrayList<>();
}

/**
Expand Down
30 changes: 30 additions & 0 deletions src/seedu/addressbook/data/tag/Tagging.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package seedu.addressbook.data.tag;

import seedu.addressbook.data.person.Person;

/**
* Represents an addition or removal of tag in the address book.
*/
public class Tagging {
private Person person;
private Tag tag;
private boolean isAddition;

public Tagging(Person person, Tag tag, boolean isAddition) {
this.person = person;
this.tag = tag;
this.isAddition = isAddition;
}

public Person getPerson() {
return person;
}

public Tag getTag() {
return tag;
}

public boolean isAddition() {
return isAddition;
}
}