forked from nus-cs2103-AY2122S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from MontyPython28/add-Priority-To-Tag
Add priority to tag
- Loading branch information
Showing
23 changed files
with
237 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package seedu.address.model.tag; | ||
|
||
public enum Priority { | ||
PRIORITY_1, | ||
PRIORITY_2, | ||
PRIORITY_3, | ||
PRIORITY_4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
import javafx.util.Pair; | ||
import seedu.address.model.AddressBook; | ||
import seedu.address.model.ReadOnlyAddressBook; | ||
import seedu.address.model.person.Address; | ||
|
@@ -12,6 +13,7 @@ | |
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.tag.Priority; | ||
import seedu.address.model.tag.Tag; | ||
|
||
/** | ||
|
@@ -22,22 +24,23 @@ public static Person[] getSamplePersons() { | |
return new Person[] { | ||
new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("[email protected]"), | ||
new InsurancePackage("Golden Package"), new Address("Blk 30 Geylang Street 29, #06-40"), | ||
getTagSet("friends")), | ||
getTagSet(new Pair<>("introduce to friends", null))), | ||
new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("[email protected]"), | ||
new InsurancePackage("Silver Package"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), | ||
getTagSet("colleagues", "friends")), | ||
getTagSet(new Pair<>("update insurance package", Priority.PRIORITY_1), | ||
new Pair<>("going to move abroad soon", null))), | ||
new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("[email protected]"), | ||
new InsurancePackage("Undecided"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), | ||
getTagSet("neighbours")), | ||
getTagSet(new Pair<>("tell about Car insurance updates", Priority.PRIORITY_3))), | ||
new Person(new Name("David Li"), new Phone("91031282"), new Email("[email protected]"), | ||
new InsurancePackage("Undecided"), new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), | ||
getTagSet("family")), | ||
getTagSet(new Pair<>("contact wife if not available", null))), | ||
new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("[email protected]"), | ||
new InsurancePackage("Basic Family Package"), new Address("Blk 47 Tampines Street 20, #17-35"), | ||
getTagSet("classmates")), | ||
getTagSet()), | ||
new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("[email protected]"), | ||
new InsurancePackage("Car Theft Insurance"), new Address("Blk 45 Aljunied Street 85, #11-31"), | ||
getTagSet("colleagues")) | ||
getTagSet(new Pair<>("update insurance package", Priority.PRIORITY_1))) | ||
}; | ||
} | ||
|
||
|
@@ -52,9 +55,9 @@ public static ReadOnlyAddressBook getSampleAddressBook() { | |
/** | ||
* Returns a tag set containing the list of strings given. | ||
*/ | ||
public static Set<Tag> getTagSet(String... strings) { | ||
return Arrays.stream(strings) | ||
.map(Tag::new) | ||
public static Set<Tag> getTagSet(Pair<String, Priority>... tagPairs) { | ||
return Arrays.stream(tagPairs) | ||
.map(x -> new Tag(x.getKey(), x.getValue())) | ||
.collect(Collectors.toSet()); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.