Changeset df7f390 for backend/GlobeGuru-backend/src/main/java/Option.java
Legend:
- Unmodified
- Added
- Removed
-
backend/GlobeGuru-backend/src/main/java/Option.java
r0a7426e rdf7f390 1 import java.util.ArrayList; 2 import java.util.List; 1 3 import java.util.Objects; 2 4 … … 12 14 private String board; 13 15 private String amenities; 16 private int numPeople; 17 private String dateRange; 18 private List<Change> changes = new ArrayList<>(); 14 19 15 private int numPeople; 16 //Price changing 17 private float newPrice = 0; 18 private boolean isPriceChanged = false; 19 private String dateRange; 20 // Constructor 21 public Option(){ 22 price = 0; 20 public String getDateRange() { 21 return dateRange; 23 22 } 24 23 … … 31 30 } 32 31 32 public int getId() { 33 return id; 34 } 35 36 public void setId(int id) { 37 this.id = id; 38 } 39 33 40 public void setDetail_id(int detail_id) { 34 41 this.detail_id = detail_id; 35 }36 37 public String getDateRange() {38 return dateRange;39 42 } 40 43 … … 63 66 } 64 67 65 public boolean isEmpty(){66 return (hotelName == null || country == null || link == null || imgSrc == null);68 public int getNumPeople() { 69 return numPeople; 67 70 } 71 72 public void setNumPeople(int numPeople) { 73 this.numPeople = numPeople; 74 } 75 68 76 public String getHotelName() { 69 77 return hotelName; … … 98 106 } 99 107 108 public String getImgSrc() { 109 return imgSrc; 110 } 111 100 112 public void setImgSrc(String imgSrc) { 101 113 this.imgSrc = imgSrc; 102 114 } 103 115 104 public String getImgSrc() {105 return imgSrc;116 public void addChange(String attribute, String oldValue, String newValue) { 117 this.changes.add(new Change(attribute, oldValue, newValue)); 106 118 } 107 119 108 public int getNumPeople() { 109 return numPeople; 110 } 111 112 public void setNumPeople(int numPeople) { 113 this.numPeople = numPeople; 120 public List<Change> getChanges() { 121 return changes; 114 122 } 115 123 116 124 @Override 117 125 public boolean equals(Object obj) { 118 if (this==obj) return true;119 if (obj == null || getClass() != obj.getClass()) return false;126 if (this == obj) return true; 127 if (obj == null || getClass() != obj.getClass()) return false; 120 128 Option option = (Option) obj; 121 129 return Float.compare(option.price, price) == 0 … … 127 135 @Override 128 136 public int hashCode() { 129 return Objects.hash(hotelName, country,price,link);137 return Objects.hash(hotelName, country, price, link); 130 138 } 131 139 132 public int getId() {133 return id;134 }135 136 public void setId(int id) {137 this.id = id;138 }139 140 //debug141 140 @Override 142 141 public String toString() { 143 142 return "Option{" + 144 "id= '" + id + '\''+145 " dateRange='" + dateRange + '\'' +146 " hotelName='" + hotelName + '\'' +143 "id=" + id + 144 ", dateRange='" + dateRange + '\'' + 145 ", hotelName='" + hotelName + '\'' + 147 146 ", country='" + country + '\'' + 148 ", price= '" + price + '\''+147 ", price=" + price + 149 148 ", link='" + link + '\'' + 150 ", image='" + imgSrc + 149 ", imgSrc='" + imgSrc + '\'' + 150 ", type='" + type + '\'' + 151 ", board='" + board + '\'' + 152 ", amenities='" + amenities + '\'' + 153 ", numPeople=" + numPeople + 154 ", changes=" + changes + 151 155 '}'; 152 156 } 153 157 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; 158 public boolean isEmpty() { 159 return (link.isEmpty() || country.isEmpty() || hotelName.isEmpty()); 167 160 } 168 161 } 162
Note:
See TracChangeset
for help on using the changeset viewer.