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
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;
[53bad7e]10 private int numPeople;
[c164f8f]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
[53bad7e]71 public int getNumPeople() {
72 return numPeople;
73 }
74
75 public void setNumPeople(int numPeople) {
76 this.numPeople = numPeople;
77 }
78
[c164f8f]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
[d4d8f61]104 @Override
105 public String toString() {
106 return "Option{" +
[c164f8f]107 "id='" + id + '\'' +
108 "dateRange='" + dateRange + '\'' +
[d4d8f61]109 "hotelName='" + hotelName + '\'' +
110 ", country='" + country + '\'' +
111 ", price='" + price + '\'' +
112 ", link='" + link + '\'' +
[c164f8f]113 ", image='" + imgSrc +
[d4d8f61]114 '}';
115 }
[c164f8f]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 }
[d4d8f61]131}
Note: See TracBrowser for help on using the repository browser.