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