[c164f8f] | 1 | import java.util.Objects;
|
---|
| 2 |
|
---|
[d4d8f61] | 3 | public 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;
|
---|
[1c51912] | 10 | private String type;
|
---|
| 11 | private String board;
|
---|
| 12 | private String amenities;
|
---|
| 13 |
|
---|
[53bad7e] | 14 | private int numPeople;
|
---|
[c164f8f] | 15 | //Price changing
|
---|
| 16 | private float newPrice = 0;
|
---|
| 17 | private boolean isPriceChanged = false;
|
---|
| 18 | private String dateRange;
|
---|
[d4d8f61] | 19 | // Constructor
|
---|
[c164f8f] | 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 | }
|
---|
[d4d8f61] | 31 |
|
---|
[1c51912] | 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 |
|
---|
[d4d8f61] | 56 | public boolean isEmpty(){
|
---|
[1c51912] | 57 | return (hotelName == null || country == null || link == null || imgSrc == null);
|
---|
[d4d8f61] | 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 |
|
---|
[c164f8f] | 75 | public float getPrice() {
|
---|
[d4d8f61] | 76 | return price;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
[c164f8f] | 79 | public void setPrice(float price) {
|
---|
[d4d8f61] | 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 |
|
---|
[53bad7e] | 99 | public int getNumPeople() {
|
---|
| 100 | return numPeople;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | public void setNumPeople(int numPeople) {
|
---|
| 104 | this.numPeople = numPeople;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
[c164f8f] | 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
|
---|
[d4d8f61] | 132 | @Override
|
---|
| 133 | public String toString() {
|
---|
| 134 | return "Option{" +
|
---|
[c164f8f] | 135 | "id='" + id + '\'' +
|
---|
| 136 | "dateRange='" + dateRange + '\'' +
|
---|
[d4d8f61] | 137 | "hotelName='" + hotelName + '\'' +
|
---|
| 138 | ", country='" + country + '\'' +
|
---|
| 139 | ", price='" + price + '\'' +
|
---|
| 140 | ", link='" + link + '\'' +
|
---|
[c164f8f] | 141 | ", image='" + imgSrc +
|
---|
[d4d8f61] | 142 | '}';
|
---|
| 143 | }
|
---|
[c164f8f] | 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 | }
|
---|
[d4d8f61] | 159 | }
|
---|