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