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

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

pred-finalna

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[c164f8f]1import java.util.Objects;
2
[d4d8f61]3public class Option {
[c164f8f]4 private int id;
[d4d8f61]5 private String hotelName;
6 private String country;
[c164f8f]7 private float price;
8 private String link;
[d4d8f61]9 private String imgSrc;
[c164f8f]10
11 //Price changing
12 private float newPrice = 0;
13 private boolean isPriceChanged = false;
14 private String dateRange;
[d4d8f61]15 // Constructor
[c164f8f]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 }
[d4d8f61]27
28 public boolean isEmpty(){
[c164f8f]29 return (hotelName == null || country == null || price == 0 || link == null || imgSrc == null);
[d4d8f61]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
[c164f8f]47 public float getPrice() {
[d4d8f61]48 return price;
49 }
50
[c164f8f]51 public void setPrice(float price) {
[d4d8f61]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
[c164f8f]71 @Override
72 public boolean equals(Object obj) {
73 if(this==obj) return true;
74 if(obj == null || getClass() != obj.getClass()) return false;
75 Option option = (Option) obj;
76 return Float.compare(option.price, price) == 0
77 && Objects.equals(hotelName, option.hotelName)
78 && Objects.equals(country, option.country)
79 && Objects.equals(link, option.link);
80 }
81
82 @Override
83 public int hashCode() {
84 return Objects.hash(hotelName,country,price,link);
85 }
86
87 public int getId() {
88 return id;
89 }
90
91 public void setId(int id) {
92 this.id = id;
93 }
94
95 //debug
[d4d8f61]96 @Override
97 public String toString() {
98 return "Option{" +
[c164f8f]99 "id='" + id + '\'' +
100 "dateRange='" + dateRange + '\'' +
[d4d8f61]101 "hotelName='" + hotelName + '\'' +
102 ", country='" + country + '\'' +
103 ", price='" + price + '\'' +
104 ", link='" + link + '\'' +
[c164f8f]105 ", image='" + imgSrc +
[d4d8f61]106 '}';
107 }
[c164f8f]108
109 public void setPriceChanged(boolean a){
110 isPriceChanged = a;
111 }
112 public void setNewPrice(float a){
113 newPrice = a;
114 }
115
116 public boolean isPriceChanged() {
117 return isPriceChanged;
118 }
119
120 public float getNewPrice() {
121 return newPrice;
122 }
[d4d8f61]123}
Note: See TracBrowser for help on using the repository browser.