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

[T4A2][T01-T04] Aung Swumm #116

Open
wants to merge 2 commits 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
27 changes: 27 additions & 0 deletions src/seedu/addressbook/data/Tagging.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package seedu.addressbook.data;

import java.util.ArrayList;
/*
* Association class that records all addition and deletion of tags during a session

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more precise description is Represents an adding or removing a Tag to/from a Person.

*/
public class Tagging {
private static final String ADD_COMMAND = "add";
private static final String DEL_COMMAND = "delete";
private ArrayList<String> allTagHistory;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the class diagram given in the exercise, the list of Tagging objects should not be in this class. If it was in this class, the diagram would be like this:
image


public void recordTagHistory(String command, String name, String tag) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No header comment.

if (command.equals(ADD_COMMAND)) {
allTagHistory.add("+ " + name + " " + tag);
} else if (command.equals(DEL_COMMAND)) {
allTagHistory.add("- " + name + " " + tag);
}
}

public String getTagHistory() {
StringBuilder history = new StringBuilder();
for (String tag : allTagHistory) {
history.append(tag + "\n");
}
return history.toString();
}
}