forked from nus-cs2103-AY1819S1/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 5
/
SampleDataUtil.java
96 lines (84 loc) · 4.39 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
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.restaurant.Address;
import seedu.address.model.restaurant.Name;
import seedu.address.model.restaurant.Phone;
import seedu.address.model.restaurant.Rating;
import seedu.address.model.restaurant.Restaurant;
import seedu.address.model.restaurant.Reviews;
import seedu.address.model.restaurant.UserReview;
import seedu.address.model.restaurant.WrittenReview;
import seedu.address.model.tag.Tag;
import seedu.address.model.user.Username;
/**
* Contains utility methods for populating {@code AddressBook} with sample data.
*/
public class SampleDataUtil {
public static final Reviews WAA_COW_REVIEWS = new Reviews()
.addUserReview(new UserReview(new Username("navekom"), new Rating(3),
new WrittenReview("I tried the Ultimate Beef Sushi and they were delicious.")))
.addUserReview(new UserReview(new Username("chelchia"), new Rating(2),
new WrittenReview("I tried the Udon Cirashi and they were so-so.")))
.addUserReview(new UserReview(new Username("meena567"), new Rating(2),
new WrittenReview("Definitely coming back.")))
.addUserReview(new UserReview(new Username("katespade"), new Rating(2),
new WrittenReview("The maki was fantastic.")));
public static final Reviews SUBWAY_REVIEWS = new Reviews()
.addUserReview(new UserReview(new Username("themyth"), new Rating(5),
new WrittenReview("Subway eat fresh.")))
.addUserReview(new UserReview(new Username("chelchia"), new Rating(5),
new WrittenReview("Namaste. Subway nice nice. Good food.")))
.addUserReview(new UserReview(new Username("meena567"), new Rating(4),
new WrittenReview("Subway give fresh food.")))
.addUserReview(new UserReview(new Username("katespade"), new Rating(5),
new WrittenReview("5 stars sub.")));
public static final Reviews ROYAL_BISTRO_REVIEWS = new Reviews()
.addUserReview(new UserReview(new Username("brotherLoong"), new Rating(5),
new WrittenReview("The food here is 5 stars. Just like the Singapore flag.")))
.addUserReview(new UserReview(new Username("themyth"), new Rating(5),
new WrittenReview("I stalked LHL here.")));
public static Restaurant[] getSampleRestaurants() {
return new Restaurant[] {
new Restaurant(new Name("Waa Cow"), new Phone("63421111"),
new Address("Stephen Riady Centre"),
getTagSet("Western"), WAA_COW_REVIEWS),
new Restaurant(new Name("The Royals Bistro"), new Phone("61221218"),
new Address("Town Plaza"),
getTagSet("Italian", "Halal"), ROYAL_BISTRO_REVIEWS),
new Restaurant(new Name("Subway"), new Phone("66596109"),
new Address("Town Plaza"),
getTagSet("Halal", "FastFood"), SUBWAY_REVIEWS),
new Restaurant(new Name("Starbucks"), new Phone("66596081"),
new Address("Education Resource Centre"),
getTagSet("Cafe"), new Reviews()),
new Restaurant(new Name("Spice Table by Pines"), new Phone("63399912"),
new Address("Town Plaza"),
getTagSet("Asian"), new Reviews()),
new Restaurant(new Name("Sapore Italian Restaurant"), new Phone("62620287"),
new Address("Town Plaza"),
getTagSet("Italian"), new Reviews()),
new Restaurant(new Name("Pizza Hut"), new Phone("62353535"),
new Address("Stephen Riady Centre"),
getTagSet("FastFood", "Halal"), new Reviews())
};
}
public static ReadOnlyAddressBook getSampleAddressBook() {
AddressBook sampleAb = new AddressBook();
for (Restaurant sampleRestaurant : getSampleRestaurants()) {
sampleAb.addRestaurant(sampleRestaurant);
}
return sampleAb;
}
/**
* 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());
}
}