X-Git-Url: https://xp-dev.com/git/RRRRHHHH_Code/blobdiff_plain/c92b616b1406bb5ff52624836f0608e8c5062451..d30bcc8a3c13bbf5144b03a644c1345865aed708:/ruralHouses/src/domain/RuralHouse.java diff --git a/ruralHouses/src/domain/RuralHouse.java b/ruralHouses/src/domain/RuralHouse.java index 07259c8..27f8d7f 100644 --- a/ruralHouses/src/domain/RuralHouse.java +++ b/ruralHouses/src/domain/RuralHouse.java @@ -98,59 +98,7 @@ public class RuralHouse implements Serializable { return true; } - /** - * This method obtains available offers for a concrete house in a certain - * period - * - * @param houseName - * , the house number where the offers must be obtained - * @param firstDay - * , first day in a period range - * @param lastDay - * , last day in a period range - * @return a vector of offers(Offer class) available in this period - */ - public Vector getOffers(Date firstDay, Date lastDay) { - Vector availableOffers = new Vector(); - Iterator e = offers.iterator(); - Offer offer; - while (e.hasNext()) { - offer = e.next(); - if ((offer.getFirstDay().compareTo(firstDay) >= 0) - && (offer.getLastDay().compareTo(lastDay) <= 0) - && (!offer.isBooked())) - availableOffers.add(offer); - } - return availableOffers; - } - - public Vector getAllOffers() { - 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 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) { @@ -165,5 +113,11 @@ public class RuralHouse implements Serializable { return null; } + + + public Vector getAllOffers() { + + return this.offers; + } }