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