getTags() {
+ return tags;
+ }
+
+}
diff --git a/src/main/java/seedu/address/model/person/UniquePersonList.java b/src/main/java/seedu/address/model/person/UniquePersonList.java
index 0fee4fe57e6..c742473809e 100644
--- a/src/main/java/seedu/address/model/person/UniquePersonList.java
+++ b/src/main/java/seedu/address/model/person/UniquePersonList.java
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@@ -17,7 +18,7 @@
* persons uses Person#isSamePerson(Person) for equality so as to ensure that the person being added or updated is
* unique in terms of identity in the UniquePersonList. However, the removal of a person uses Person#equals(Object) so
* as to ensure that the person with exactly the same fields will be removed.
- *
+ *
* Supports a minimal set of list operations.
*
* @see Person#isSamePerson(Person)
@@ -113,12 +114,12 @@ public Iterator iterator() {
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof UniquePersonList // instanceof handles nulls
- && internalList.equals(((UniquePersonList) other).internalList));
+ && internalList.equals(((UniquePersonList) other).internalList));
}
@Override
public int hashCode() {
- return internalList.hashCode();
+ return Objects.hash(internalList, internalUnmodifiableList);
}
/**
diff --git a/src/main/java/seedu/address/model/tag/Tag.java b/src/main/java/seedu/address/model/tag/Tag.java
index 11ca11e5461..40021410c30 100644
--- a/src/main/java/seedu/address/model/tag/Tag.java
+++ b/src/main/java/seedu/address/model/tag/Tag.java
@@ -13,6 +13,7 @@
* Guarantees: immutable; name is valid as declared in {@link #isValidTagName(String)}
*/
public class Tag {
+
public static final String MESSAGE_CONSTRAINTS = "Tags names should be alphanumeric";
public static final String VALIDATION_REGEX = "^[\\w\\-\\s]+$";
diff --git a/src/main/java/seedu/address/model/tag/UniqueTagList.java b/src/main/java/seedu/address/model/tag/UniqueTagList.java
index 35f6f0e9288..d2b5e6c9ac0 100644
--- a/src/main/java/seedu/address/model/tag/UniqueTagList.java
+++ b/src/main/java/seedu/address/model/tag/UniqueTagList.java
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@@ -111,7 +112,7 @@ public boolean equals(Object other) {
@Override
public int hashCode() {
- return internalList.hashCode();
+ return Objects.hash(internalList, internalUnmodifiableList);
}
/**
diff --git a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java
index 8625f6a4cee..7ceaa976e8c 100644
--- a/src/main/java/seedu/address/storage/JsonAdaptedPerson.java
+++ b/src/main/java/seedu/address/storage/JsonAdaptedPerson.java
@@ -1,68 +1,68 @@
-package seedu.address.storage;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import seedu.address.commons.exceptions.IllegalValueException;
-import seedu.address.model.person.Person;
-
-/**
- * Jackson-friendly version of {@link Person}.
- */
-abstract class JsonAdaptedPerson {
-
- public static final String MISSING_FIELD_MESSAGE_FORMAT = "Person's %s field is missing!";
-
- private final String name;
- private final String email;
- private final List tagged = new ArrayList<>();
-
- /**
- * Constructs a {@code JsonAdaptedPerson} with the given person details.
- */
- @JsonCreator
- public JsonAdaptedPerson(@JsonProperty("name") String name,
- @JsonProperty("email") String email,
- @JsonProperty("tagged") List tagged) {
- this.name = name;
- this.email = email;
- if (tagged != null) {
- this.tagged.addAll(tagged);
- }
- }
-
- /**
- * Converts a given {@code Person} into this class for Jackson use.
- */
- public JsonAdaptedPerson(Person source) {
- name = source.getName().fullName;
- email = source.getEmail().value;
- tagged.addAll(source.getTags().stream()
- .map(JsonAdaptedTag::new)
- .collect(Collectors.toList()));
- }
-
- public String getName() {
- return name;
- }
-
- public String getEmail() {
- return email;
- }
-
- public List getTags() {
- return tagged;
- }
-
- /**
- * Converts this Jackson-friendly adapted person object into the model's {@code Person} object.
- *
- * @throws IllegalValueException if there were any data constraints violated in the adapted person.
- */
- public abstract Person toModelType() throws IllegalValueException;
-
-}
+//package seedu.address.storage;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//import java.util.stream.Collectors;
+//
+//import com.fasterxml.jackson.annotation.JsonCreator;
+//import com.fasterxml.jackson.annotation.JsonProperty;
+//
+//import seedu.address.commons.exceptions.IllegalValueException;
+//import seedu.address.model.person.Person;
+//
+///**
+// * Jackson-friendly version of {@link Person}.
+// */
+//abstract class JsonAdaptedPerson {
+//
+// public static final String MISSING_FIELD_MESSAGE_FORMAT = "Person's %s field is missing!";
+//
+// private final String name;
+// private final String email;
+// private final List tagged = new ArrayList<>();
+//
+// /**
+// * Constructs a {@code JsonAdaptedPerson} with the given person details.
+// */
+// @JsonCreator
+// public JsonAdaptedPerson(@JsonProperty("name") String name,
+// @JsonProperty("email") String email,
+// @JsonProperty("tagged") List tagged) {
+// this.name = name;
+// this.email = email;
+// if (tagged != null) {
+// this.tagged.addAll(tagged);
+// }
+// }
+//
+// /**
+// * Converts a given {@code Person} into this class for Jackson use.
+// */
+// public JsonAdaptedPerson(Person source) {
+// name = source.getName().fullName;
+// email = source.getEmail().value;
+// tagged.addAll(source.getTags().stream()
+// .map(JsonAdaptedTag::new)
+// .collect(Collectors.toList()));
+// }
+//
+// public String getName() {
+// return name;
+// }
+//
+// public String getEmail() {
+// return email;
+// }
+//
+// public List getTags() {
+// return tagged;
+// }
+//
+// /**
+// * Converts this Jackson-friendly adapted person object into the model's {@code Person} object.
+// *
+// * @throws IllegalValueException if there were any data constraints violated in the adapted person.
+// */
+// public abstract Person toModelType() throws IllegalValueException;
+//
+//}
diff --git a/src/main/java/seedu/address/storage/JsonAdaptedTag.java b/src/main/java/seedu/address/storage/JsonAdaptedTag.java
index 0df22bdb754..a958d3347e1 100644
--- a/src/main/java/seedu/address/storage/JsonAdaptedTag.java
+++ b/src/main/java/seedu/address/storage/JsonAdaptedTag.java
@@ -1,5 +1,7 @@
package seedu.address.storage;
+import java.util.Objects;
+
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
@@ -33,6 +35,18 @@ public String getTagName() {
return tagName;
}
+ @Override
+ public boolean equals(Object other) {
+ return other == this // short circuit if same object
+ || (other instanceof JsonAdaptedTag // instanceof handles nulls
+ && tagName.equals(((JsonAdaptedTag) other).getTagName())); // state check
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(tagName);
+ }
+
/**
* Converts this Jackson-friendly adapted tag object into the model's {@code Tag} object.
*
diff --git a/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java b/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java
index 710bd967764..cf63f30704e 100644
--- a/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java
+++ b/src/main/java/seedu/address/storage/JsonSerializableAddressBook.java
@@ -3,8 +3,10 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -42,13 +44,14 @@ class JsonSerializableAddressBook {
public JsonSerializableAddressBook(@JsonProperty("persons") List