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][W09-B4] Chua Li Qun Shawn #961

Open
wants to merge 9 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
Empty file modified doc/DeveloperGuide.md
100644 → 100755
Empty file.
Empty file modified doc/Diagrams.pptx
100644 → 100755
Empty file.
Empty file modified doc/LearningOutcomes.md
100644 → 100755
Empty file.
Empty file modified doc/UserGuide.md
100644 → 100755
Empty file.
Empty file modified doc/images/AddressClasses.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/images/ContactClassHierarchy.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/images/PrintableInterface.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/images/ReadOnlyPersonUsage.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/images/TaggingClass.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/images/TaggingsInTagging.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/images/mainClassDiagram.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified src/seedu/addressbook/Main.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/AddCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/ClearCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/Command.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/CommandResult.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/DeleteCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/ExitCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/FindCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/HelpCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/IncorrectCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/ListCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/ViewAllCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/commands/ViewCommand.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/common/Messages.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/common/Utils.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/AddressBook.java
100644 → 100755
Empty file.
Empty file.
Empty file modified src/seedu/addressbook/data/exception/IllegalValueException.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/Address.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/Email.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/Name.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/Person.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/Phone.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/ReadOnlyPerson.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/person/UniquePersonList.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/data/tag/Tag.java
100644 → 100755
Empty file.
93 changes: 93 additions & 0 deletions src/seedu/addressbook/data/tag/Tagging.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package seedu.addressbook.data.tag;

import seedu.addressbook.data.person.Person;

import java.util.ArrayList;
import java.util.Objects;

/**
* Represents addition or deletion of tag for a person during a session
*
* Used for displaying tags changed at the end of a session
*/

public class Tagging {
private static ArrayList<Tagging> taggings;

public enum Action {
ADD, DELETE
}

private static final String ADD_TAG_SIGN = "+";
private static final String DELETE_TAG_SIGN = "-";

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 executed
*/
public Tagging(Person person, Tag tag, Action action) {
this.person = person;
this.tag = tag;
this.action = action;
}

/**
* Adds tagging to class-level variable that stores all taggings
*/
public static void addTagging(Tagging tagging) {

Choose a reason for hiding this comment

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

This forces the caller to manually call addTagging after creating a new Tagging. If he doesn't, the doc comment for getTaggings will be incorrect. One way to solve this would be to move this method into the constructor. Alternatively, a new singleton TaggingList class can be created.

taggings.add(tagging);
}

/**
* Accessor method for obtaining taggings.
* @return all Taggings, representing all changes made to tags since start of session
*/
public static ArrayList<Tagging> getTaggings() {
return taggings;
}

public Person getPerson() {
return person;
}

public Tag getTag() {
return tag;
}

public Action getAction() {
return action;
}

@Override
public boolean equals(Object obj) {
return obj == this // short circuit if same object
|| obj instanceof Tagging // instanceof handles null
&& ((Tagging) obj).getPerson().equals(this.person)
&& ((Tagging) obj).getTag().equals(this.tag)
&& ((Tagging) obj).getAction().equals(this.getAction());
}

@Override
public int hashCode() {
return Objects.hash(person, tag, action);
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();

if (this.action == Action.ADD) {
builder.append(ADD_TAG_SIGN);
} else {
builder.append(DELETE_TAG_SIGN);
}

builder.append(" " + person.getName() + " " + tag);
return builder.toString();
}
}
Empty file modified src/seedu/addressbook/data/tag/UniqueTagList.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/parser/Parser.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/storage/StorageFile.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/storage/jaxb/AdaptedAddressBook.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/storage/jaxb/AdaptedPerson.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/storage/jaxb/AdaptedTag.java
100644 → 100755
Empty file.
Empty file modified src/seedu/addressbook/ui/TextUi.java
100644 → 100755
Empty file.
Empty file modified test/data/StorageFileTest/InvalidData.xml
100644 → 100755
Empty file.
Empty file modified test/data/StorageFileTest/ValidData.xml
100644 → 100755
Empty file.
Empty file modified test/expected.txt
100644 → 100755
Empty file.
Empty file modified test/input.txt
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/commands/AddCommandTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/commands/DeleteCommandTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/commands/FindCommandTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/commands/ViewAllCommandTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/commands/ViewCommandTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/common/UtilsTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/data/AddressBookTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/parser/ParserTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/storage/StorageFileTest.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/util/TestUtil.java
100644 → 100755
Empty file.
Empty file modified test/java/seedu/addressbook/util/TypicalPersons.java
100644 → 100755
Empty file.
Empty file modified test/runtests.bat
100644 → 100755
Empty file.