Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 7bf57b ... vs 6a5d4d ... for ruralHouses/src/domain/RuralHouse.java

Diff revisions: vs.
  @@ -119,7 +119,7 @@
119 119 offer = e.next();
120 120 if ((offer.getFirstDay().compareTo(firstDay) >= 0)
121 121 && (offer.getLastDay().compareTo(lastDay) <= 0)
122 - && (offer.getBooking() == null))
122 + && (!offer.isBooked()))
123 123 availableOffers.add(offer);
124 124 }
125 125 return availableOffers;
  @@ -130,28 +130,28 @@
130 130 return this.offers;
131 131 }
132 132
133 - // /**
134 - // * This method obtains the offer that match exactly with a given dates that
135 - // * has not been booked
136 - // *
137 - // * @param firstDay
138 - // * , first day in a period range
139 - // * @param lastDay
140 - // * , last day in a period range
141 - // * @return the offer(Offer class) available for a this period
142 - // */
143 - // public Offer findOffer(Date firstDay, Date lastDay) {
144 - // Iterator<Offer> e = offers.iterator();
145 - // Offer offer = null;
146 - // while (e.hasNext()) {
147 - // offer = e.next();
148 - // if ((offer.getFirstDay().compareTo(firstDay) == 0)
149 - // && (offer.getLastDay().compareTo(lastDay) == 0)
150 - // && (offer.getBooking() == null))
151 - // return offer;
152 - // }
153 - // return null;
154 - // }
133 + /**
134 + * This method obtains the offer that match exactly with a given dates that
135 + * has not been booked
136 + *
137 + * @param firstDay
138 + * , first day in a period range
139 + * @param lastDay
140 + * , last day in a period range
141 + * @return the offer(Offer class) available for a this period
142 + */
143 + public Offer findOffer(Date firstDay, Date lastDay) {
144 + Iterator<Offer> e = offers.iterator();
145 + Offer offer = null;
146 + while (e.hasNext()) {
147 + offer = e.next();
148 + if ((offer.getFirstDay().compareTo(firstDay) == 0)
149 + && (offer.getLastDay().compareTo(lastDay) == 0)
150 + && (!offer.isBooked()))
151 + return offer;
152 + }
153 + return null;
154 + }
155 155
156 156 public Offer overlapsWith(Date firstDay, Date lastDay) {
157 157