-
Notifications
You must be signed in to change notification settings - Fork 153
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][T09-B3] Kang Anmin #966
base: master
Are you sure you want to change the base?
Changes from all commits
d34e230
62ae8f4
c7ba597
94cb559
517190f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||
|
@@ -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; | ||
|
||
/** | ||
|
@@ -24,13 +26,15 @@ public class AddressBook { | |
|
||
private final UniquePersonList allPersons; | ||
private final UniqueTagList allTags; // can contain tags not attached to any person | ||
public ArrayList<Tagging> tagLog; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good, this is a correct place to put the list based on the UML.. May be tagList is a better name. |
||
|
||
/** | ||
* Creates an empty address book. | ||
*/ | ||
public AddressBook() { | ||
allPersons = new UniquePersonList(); | ||
allTags = new UniqueTagList(); | ||
tagLog = new ArrayList<Tagging>(); | ||
} | ||
|
||
/** | ||
|
@@ -46,6 +50,7 @@ public AddressBook(UniquePersonList persons, UniqueTagList tags) { | |
for (Person p : allPersons) { | ||
syncTagsWithMasterList(p); | ||
} | ||
tagLog = new ArrayList<Tagging>(); | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package seedu.addressbook.data.tag; | ||
|
||
import seedu.addressbook.data.person.Person; | ||
|
||
/** | ||
* It records a transaction of a tag addition/deletion | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can start with |
||
*/ | ||
public class Tagging { | ||
private Person person; | ||
private Tag tag; | ||
private boolean addition; // true means it is an addition, false means deletion | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coding standard violation for boolean. |
||
|
||
/** | ||
* Constructs a tagging with the given data. | ||
* | ||
* @param person the person whose tag was added/deleted in the last transaction | ||
* @param tag the tag added/deleted in the last transaction | ||
*/ | ||
public Tagging(Person person, Tag tag, boolean addition) { | ||
this.person = person; | ||
this.tag = tag; | ||
this.addition = addition; | ||
} | ||
|
||
public String toString() { | ||
return (addition?"+ ":"- ") + person.getName() + " " + tag.toString(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this ternary operator violates our coding standard. Missing empty spaces? |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding standard violation. Missing an empty space.