source: backend/GlobeGuru-backend/src/main/java/Option.java@ 53bad7e

Last change on this file since 53bad7e was 53bad7e, checked in by Kristijan <kristijanzafirovski26@…>, 6 days ago

dodadeno informacii za broj na lugje

  • Property mode set to 100644
File size: 2.9 KB
Line 
1import java.util.Objects;
2
3public 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 int numPeople;
11 //Price changing
12 private float newPrice = 0;
13 private boolean isPriceChanged = false;
14 private String dateRange;
15 // Constructor
16 public Option(){
17 price = 0;
18 }
19
20 public void setDateRange(String dateRange) {
21 this.dateRange = dateRange;
22 }
23
24 public String getDateRange() {
25 return dateRange;
26 }
27
28 public boolean isEmpty(){
29 return (hotelName == null || country == null || price == 0 || link == null || imgSrc == null);
30 }
31 public String getHotelName() {
32 return hotelName;
33 }
34
35 public void setHotelName(String hotelName) {
36 this.hotelName = hotelName;
37 }
38
39 public String getCountry() {
40 return country;
41 }
42
43 public void setCountry(String country) {
44 this.country = country;
45 }
46
47 public float getPrice() {
48 return price;
49 }
50
51 public void setPrice(float price) {
52 this.price = price;
53 }
54
55 public String getLink() {
56 return link;
57 }
58
59 public void setLink(String link) {
60 this.link = link;
61 }
62
63 public void setImgSrc(String imgSrc) {
64 this.imgSrc = imgSrc;
65 }
66
67 public String getImgSrc() {
68 return imgSrc;
69 }
70
71 public int getNumPeople() {
72 return numPeople;
73 }
74
75 public void setNumPeople(int numPeople) {
76 this.numPeople = numPeople;
77 }
78
79 @Override
80 public boolean equals(Object obj) {
81 if(this==obj) return true;
82 if(obj == null || getClass() != obj.getClass()) return false;
83 Option option = (Option) obj;
84 return Float.compare(option.price, price) == 0
85 && Objects.equals(hotelName, option.hotelName)
86 && Objects.equals(country, option.country)
87 && Objects.equals(link, option.link);
88 }
89
90 @Override
91 public int hashCode() {
92 return Objects.hash(hotelName,country,price,link);
93 }
94
95 public int getId() {
96 return id;
97 }
98
99 public void setId(int id) {
100 this.id = id;
101 }
102
103 //debug
104 @Override
105 public String toString() {
106 return "Option{" +
107 "id='" + id + '\'' +
108 "dateRange='" + dateRange + '\'' +
109 "hotelName='" + hotelName + '\'' +
110 ", country='" + country + '\'' +
111 ", price='" + price + '\'' +
112 ", link='" + link + '\'' +
113 ", image='" + imgSrc +
114 '}';
115 }
116
117 public void setPriceChanged(boolean a){
118 isPriceChanged = a;
119 }
120 public void setNewPrice(float a){
121 newPrice = a;
122 }
123
124 public boolean isPriceChanged() {
125 return isPriceChanged;
126 }
127
128 public float getNewPrice() {
129 return newPrice;
130 }
131}
Note: See TracBrowser for help on using the repository browser.