-
Notifications
You must be signed in to change notification settings - Fork 10
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][T1-04]Dao Han #114
base: master
Are you sure you want to change the base?
[T4A2][T1-04]Dao Han #114
Changes from 1 commit
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package seedu.addressbook.data.tag; | ||
|
||
import java.util.ArrayList; | ||
|
||
import seedu.addressbook.data.person.Person; | ||
|
||
/** Association class to support the following functionality: | ||
* When the AddressBook program exits, it should print out a list of all the tags added/deleted during that session. | ||
*/ | ||
|
||
public class Tagging { | ||
private ArrayList<String> allTheTags = new ArrayList<>(); | ||
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. |
||
private final String ADD_COMMAND = "add"; | ||
private final String DELETE_COMMAND = "remove"; | ||
|
||
// Record tags added/deleted during that session. | ||
public void trackTagging(String command, Person person, Tag tag) { | ||
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. So |
||
if (command == ADD_COMMAND) { | ||
allTheTags.add("+ " + person.getName().toString() + " " + tag.toString()); | ||
} | ||
else if (command == DELETE_COMMAND) { | ||
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? |
||
allTheTags.add("- " + person.getName().toString() + " " + tag.toString()); | ||
} | ||
} | ||
|
||
// To print out a list of all the tags added/deleted during the session, when the AddressBook program exits. | ||
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.
|
||
public String getAllTags(){ | ||
StringBuilder allActions = new StringBuilder(); | ||
for(String tag: allTheTags){ | ||
allActions.append(tag + "\n"); | ||
} | ||
return allActions.toString(); | ||
} | ||
|
||
} |
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.
A more precise description is
Represents an adding or removing a Tag to/from a Person
.