offer = e.next();
if ((offer.getFirstDay().compareTo(firstDay) >= 0)
&& (offer.getLastDay().compareTo(lastDay) <= 0)
- && (offer.getBooking() == null))
+ && (!offer.isBooked()))
availableOffers.add(offer);
}
return availableOffers;
return this.offers;
}
-// /**
-// * This method obtains the offer that match exactly with a given dates that
-// * has not been booked
-// *
-// * @param firstDay
-// * , first day in a period range
-// * @param lastDay
-// * , last day in a period range
-// * @return the offer(Offer class) available for a this period
-// */
-// public Offer findOffer(Date firstDay, Date lastDay) {
-// Iterator<Offer> e = offers.iterator();
-// Offer offer = null;
-// while (e.hasNext()) {
-// offer = e.next();
-// if ((offer.getFirstDay().compareTo(firstDay) == 0)
-// && (offer.getLastDay().compareTo(lastDay) == 0)
-// && (offer.getBooking() == null))
-// return offer;
-// }
-// return null;
-// }
+ /**
+ * This method obtains the offer that match exactly with a given dates that
+ * has not been booked
+ *
+ * @param firstDay
+ * , first day in a period range
+ * @param lastDay
+ * , last day in a period range
+ * @return the offer(Offer class) available for a this period
+ */
+ public Offer findOffer(Date firstDay, Date lastDay) {
+ Iterator<Offer> e = offers.iterator();
+ Offer offer = null;
+ while (e.hasNext()) {
+ offer = e.next();
+ if ((offer.getFirstDay().compareTo(firstDay) == 0)
+ && (offer.getLastDay().compareTo(lastDay) == 0)
+ && (!offer.isBooked()))
+ return offer;
+ }
+ return null;
+ }
public Offer overlapsWith(Date firstDay, Date lastDay) {