[df7f390] | 1 | import java.util.ArrayList;
|
---|
| 2 | import java.util.List;
|
---|
[c164f8f] | 3 | import java.util.Objects;
|
---|
| 4 |
|
---|
[d4d8f61] | 5 | public class Option {
|
---|
[c164f8f] | 6 | private int id;
|
---|
[0a7426e] | 7 | private int detail_id;
|
---|
[d4d8f61] | 8 | private String hotelName;
|
---|
| 9 | private String country;
|
---|
[c164f8f] | 10 | private float price;
|
---|
| 11 | private String link;
|
---|
[d4d8f61] | 12 | private String imgSrc;
|
---|
[1c51912] | 13 | private String type;
|
---|
| 14 | private String board;
|
---|
| 15 | private String amenities;
|
---|
[53bad7e] | 16 | private int numPeople;
|
---|
[c164f8f] | 17 | private String dateRange;
|
---|
[df7f390] | 18 | private List<Change> changes = new ArrayList<>();
|
---|
| 19 |
|
---|
| 20 | public String getDateRange() {
|
---|
| 21 | return dateRange;
|
---|
[c164f8f] | 22 | }
|
---|
| 23 |
|
---|
| 24 | public void setDateRange(String dateRange) {
|
---|
| 25 | this.dateRange = dateRange;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
[0a7426e] | 28 | public int getDetail_id() {
|
---|
| 29 | return detail_id;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
[df7f390] | 32 | public int getId() {
|
---|
| 33 | return id;
|
---|
[0a7426e] | 34 | }
|
---|
| 35 |
|
---|
[df7f390] | 36 | public void setId(int id) {
|
---|
| 37 | this.id = id;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public void setDetail_id(int detail_id) {
|
---|
| 41 | this.detail_id = detail_id;
|
---|
[c164f8f] | 42 | }
|
---|
[d4d8f61] | 43 |
|
---|
[1c51912] | 44 | public String getType() {
|
---|
| 45 | return type;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | public void setType(String type) {
|
---|
| 49 | this.type = type;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | public String getBoard() {
|
---|
| 53 | return board;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public void setBoard(String board) {
|
---|
| 57 | this.board = board;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | public String getAmenities() {
|
---|
| 61 | return amenities;
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | public void setAmenities(String amenities) {
|
---|
| 65 | this.amenities = amenities;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[df7f390] | 68 | public int getNumPeople() {
|
---|
| 69 | return numPeople;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public void setNumPeople(int numPeople) {
|
---|
| 73 | this.numPeople = numPeople;
|
---|
[d4d8f61] | 74 | }
|
---|
[df7f390] | 75 |
|
---|
[d4d8f61] | 76 | public String getHotelName() {
|
---|
| 77 | return hotelName;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | public void setHotelName(String hotelName) {
|
---|
| 81 | this.hotelName = hotelName;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | public String getCountry() {
|
---|
| 85 | return country;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | public void setCountry(String country) {
|
---|
| 89 | this.country = country;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
[c164f8f] | 92 | public float getPrice() {
|
---|
[d4d8f61] | 93 | return price;
|
---|
| 94 | }
|
---|
| 95 |
|
---|
[c164f8f] | 96 | public void setPrice(float price) {
|
---|
[d4d8f61] | 97 | this.price = price;
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | public String getLink() {
|
---|
| 101 | return link;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | public void setLink(String link) {
|
---|
| 105 | this.link = link;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | public String getImgSrc() {
|
---|
| 109 | return imgSrc;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
[df7f390] | 112 | public void setImgSrc(String imgSrc) {
|
---|
| 113 | this.imgSrc = imgSrc;
|
---|
[53bad7e] | 114 | }
|
---|
| 115 |
|
---|
[df7f390] | 116 | public void addChange(String attribute, String oldValue, String newValue) {
|
---|
| 117 | this.changes.add(new Change(attribute, oldValue, newValue));
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | public List<Change> getChanges() {
|
---|
| 121 | return changes;
|
---|
[53bad7e] | 122 | }
|
---|
| 123 |
|
---|
[c164f8f] | 124 | @Override
|
---|
| 125 | public boolean equals(Object obj) {
|
---|
[df7f390] | 126 | if (this == obj) return true;
|
---|
| 127 | if (obj == null || getClass() != obj.getClass()) return false;
|
---|
[c164f8f] | 128 | Option option = (Option) obj;
|
---|
| 129 | return Float.compare(option.price, price) == 0
|
---|
| 130 | && Objects.equals(hotelName, option.hotelName)
|
---|
| 131 | && Objects.equals(country, option.country)
|
---|
| 132 | && Objects.equals(link, option.link);
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | @Override
|
---|
| 136 | public int hashCode() {
|
---|
[df7f390] | 137 | return Objects.hash(hotelName, country, price, link);
|
---|
[c164f8f] | 138 | }
|
---|
| 139 |
|
---|
[d4d8f61] | 140 | @Override
|
---|
| 141 | public String toString() {
|
---|
| 142 | return "Option{" +
|
---|
[df7f390] | 143 | "id=" + id +
|
---|
| 144 | ", dateRange='" + dateRange + '\'' +
|
---|
| 145 | ", hotelName='" + hotelName + '\'' +
|
---|
[d4d8f61] | 146 | ", country='" + country + '\'' +
|
---|
[df7f390] | 147 | ", price=" + price +
|
---|
[d4d8f61] | 148 | ", link='" + link + '\'' +
|
---|
[df7f390] | 149 | ", imgSrc='" + imgSrc + '\'' +
|
---|
| 150 | ", type='" + type + '\'' +
|
---|
| 151 | ", board='" + board + '\'' +
|
---|
| 152 | ", amenities='" + amenities + '\'' +
|
---|
| 153 | ", numPeople=" + numPeople +
|
---|
| 154 | ", changes=" + changes +
|
---|
[d4d8f61] | 155 | '}';
|
---|
| 156 | }
|
---|
[c164f8f] | 157 |
|
---|
[df7f390] | 158 | public boolean isEmpty() {
|
---|
| 159 | return (link.isEmpty() || country.isEmpty() || hotelName.isEmpty());
|
---|
[c164f8f] | 160 | }
|
---|
[d4d8f61] | 161 | }
|
---|
[df7f390] | 162 |
|
---|