source: backend/GlobeGuru-backend/src/main/java/Option.java

Last change on this file was df7f390, checked in by Kristijan <kristijanzafirovski26@…>, 2 days ago

Added frontend functionality for changes and refactored code

  • Property mode set to 100644
File size: 3.6 KB
Line 
1import java.util.ArrayList;
2import java.util.List;
3import java.util.Objects;
4
5public class Option {
6 private int id;
7 private int detail_id;
8 private String hotelName;
9 private String country;
10 private float price;
11 private String link;
12 private String imgSrc;
13 private String type;
14 private String board;
15 private String amenities;
16 private int numPeople;
17 private String dateRange;
18 private List<Change> changes = new ArrayList<>();
19
20 public String getDateRange() {
21 return dateRange;
22 }
23
24 public void setDateRange(String dateRange) {
25 this.dateRange = dateRange;
26 }
27
28 public int getDetail_id() {
29 return detail_id;
30 }
31
32 public int getId() {
33 return id;
34 }
35
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;
42 }
43
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
68 public int getNumPeople() {
69 return numPeople;
70 }
71
72 public void setNumPeople(int numPeople) {
73 this.numPeople = numPeople;
74 }
75
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
92 public float getPrice() {
93 return price;
94 }
95
96 public void setPrice(float price) {
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
112 public void setImgSrc(String imgSrc) {
113 this.imgSrc = imgSrc;
114 }
115
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;
122 }
123
124 @Override
125 public boolean equals(Object obj) {
126 if (this == obj) return true;
127 if (obj == null || getClass() != obj.getClass()) return false;
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() {
137 return Objects.hash(hotelName, country, price, link);
138 }
139
140 @Override
141 public String toString() {
142 return "Option{" +
143 "id=" + id +
144 ", dateRange='" + dateRange + '\'' +
145 ", hotelName='" + hotelName + '\'' +
146 ", country='" + country + '\'' +
147 ", price=" + price +
148 ", link='" + link + '\'' +
149 ", imgSrc='" + imgSrc + '\'' +
150 ", type='" + type + '\'' +
151 ", board='" + board + '\'' +
152 ", amenities='" + amenities + '\'' +
153 ", numPeople=" + numPeople +
154 ", changes=" + changes +
155 '}';
156 }
157
158 public boolean isEmpty() {
159 return (link.isEmpty() || country.isEmpty() || hotelName.isEmpty());
160 }
161}
162
Note: See TracBrowser for help on using the repository browser.