-
Notifications
You must be signed in to change notification settings - Fork 548
/
Copy pathSampleDataUtil.java
122 lines (111 loc) · 4.74 KB
/
SampleDataUtil.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package seedu.address.model.util;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import seedu.address.model.AddressBook;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.interaction.Interaction;
import seedu.address.model.person.Email;
import seedu.address.model.person.Faculty;
import seedu.address.model.person.Major;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.remark.Remark;
import seedu.address.model.skill.Framework;
import seedu.address.model.skill.Language;
import seedu.address.model.skill.Skill;
import seedu.address.model.tag.Tag;
/**
* Contains utility methods for populating {@code AddressBook} with sample data.
*/
public class SampleDataUtil {
public static Person[] getSamplePersons() {
return new Person[] {
new Person(new Name("Alex Yeoh"), new Email("[email protected]"),
new Faculty("computing"), new Major("computer science"),
getSkillSet("frontend"), getLanguageSet("java"),
getFrameworkSet("javafx"), getTagSet("friends"),
getRemarkSet("remarks1")),
new Person(new Name("Bernice Yu"), new Email("[email protected]"),
new Faculty("fass"), new Major("economics"),
getSkillSet("frontend"), getLanguageSet("java"),
getFrameworkSet("javafx"), getTagSet("colleagues", "friends"),
getRemarkSet("remarks1")),
new Person(new Name("Charlotte Oliveiro"), new Email("[email protected]"),
new Faculty("fass"), new Major("social work"),
getSkillSet("frontend"), getLanguageSet("java"),
getFrameworkSet("javafx"), getTagSet("neighbours"),
getRemarkSet("remarks1")),
new Person(new Name("David Li"), new Email("[email protected]"),
new Faculty("science"), new Major("physics"),
getSkillSet("frontend"), getLanguageSet("java"),
getFrameworkSet("javafx"), getTagSet("family"),
getRemarkSet("remarks1")),
new Person(new Name("Irfan Ibrahim"), new Email("[email protected]"),
new Faculty("computing"), new Major("business analytics"),
getSkillSet("frontend"), getLanguageSet("java"),
getFrameworkSet("javafx"), getTagSet("classmates"),
getRemarkSet("remarks1")),
new Person(new Name("Roy Balakrishnan"), new Email("[email protected]"),
new Faculty("computing"), new Major("computer science"),
getSkillSet("frontend"), getLanguageSet("java"),
getFrameworkSet("javafx"), getTagSet("colleagues"),
getRemarkSet("remarks1"))
};
}
public static ReadOnlyAddressBook getSampleAddressBook() {
AddressBook sampleAb = new AddressBook();
for (Person samplePerson : getSamplePersons()) {
sampleAb.addPerson(samplePerson);
}
return sampleAb;
}
/**
* Returns a skill set containing the list of strings given.
*/
public static Set<Skill> getSkillSet(String... strings) {
return Arrays.stream(strings)
.map(Skill::new)
.collect(Collectors.toSet());
}
/**
* Returns a language set containing the list of strings given.
*/
public static Set<Language> getLanguageSet(String... strings) {
return Arrays.stream(strings)
.map(Language::new)
.collect(Collectors.toSet());
}
/**
* Returns a tag set containing the list of strings given.
*/
public static Set<Interaction> getInteractionSet(String... description) {
return Arrays.stream(description)
.map(Interaction::new)
.collect(Collectors.toSet());
}
/**
* Returns a framework set containing the list of strings given.
*/
public static Set<Framework> getFrameworkSet(String... strings) {
return Arrays.stream(strings)
.map(Framework::new)
.collect(Collectors.toSet());
}
/**
* Returns a tag set containing the list of strings given.
*/
public static Set<Tag> getTagSet(String... strings) {
return Arrays.stream(strings)
.map(Tag::new)
.collect(Collectors.toSet());
}
/**
* Returns a remark set containing the list of strings given.
*/
public static Set<Remark> getRemarkSet(String... strings) {
return Arrays.stream(strings)
.map(Remark::new)
.collect(Collectors.toSet());
}
}