RRRRHHHH_Code
Diff Revisions
c92b61 ...
vs
d30bcc ...
for ruralHouses client/src/domain/RuralHouse.java
|
@@ -15,7 +15,6 @@ |
15 |
15 |
|
private String district; |
16 |
16 |
|
private HouseFeatures features; |
17 |
17 |
|
public Vector<Offer> offers; |
18 |
|
- |
public boolean isAccepted; |
19 |
18 |
|
|
20 |
19 |
|
public RuralHouse() { |
21 |
20 |
|
super(); |
|
@@ -99,59 +98,7 @@ |
99 |
98 |
|
return true; |
100 |
99 |
|
} |
101 |
100 |
|
|
102 |
|
- |
/** |
103 |
|
- |
* This method obtains available offers for a concrete house in a certain |
104 |
|
- |
* period |
105 |
|
- |
* |
106 |
|
- |
* @param houseName |
107 |
|
- |
* , the house number where the offers must be obtained |
108 |
|
- |
* @param firstDay |
109 |
|
- |
* , first day in a period range |
110 |
|
- |
* @param lastDay |
111 |
|
- |
* , last day in a period range |
112 |
|
- |
* @return a vector of offers(Offer class) available in this period |
113 |
|
- |
*/ |
114 |
|
- |
public Vector<Offer> getOffers(Date firstDay, Date lastDay) { |
115 |
|
- |
Vector<Offer> availableOffers = new Vector<Offer>(); |
116 |
|
- |
Iterator<Offer> e = offers.iterator(); |
117 |
|
- |
Offer offer; |
118 |
|
- |
while (e.hasNext()) { |
119 |
|
- |
offer = e.next(); |
120 |
|
- |
if ((offer.getFirstDay().compareTo(firstDay) >= 0) |
121 |
|
- |
&& (offer.getLastDay().compareTo(lastDay) <= 0) |
122 |
|
- |
&& (!offer.isBooked())) |
123 |
|
- |
availableOffers.add(offer); |
124 |
|
- |
} |
125 |
|
- |
return availableOffers; |
126 |
|
- |
} |
127 |
|
- |
|
128 |
|
- |
public Vector<Offer> getAllOffers() { |
129 |
101 |
|
|
130 |
|
- |
return this.offers; |
131 |
|
- |
} |
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.isBooked())) |
151 |
|
- |
return offer; |
152 |
|
- |
} |
153 |
|
- |
return null; |
154 |
|
- |
} |
155 |
102 |
|
|
156 |
103 |
|
public Offer overlapsWith(Date firstDay, Date lastDay) { |
157 |
104 |
|
|
|
@@ -166,5 +113,11 @@ |
166 |
113 |
|
return null; |
167 |
114 |
|
|
168 |
115 |
|
} |
|
116 |
+ |
|
|
117 |
+ |
|
|
118 |
+ |
public Vector<Offer> getAllOffers() { |
|
119 |
+ |
|
|
120 |
+ |
return this.offers; |
|
121 |
+ |
} |
169 |
122 |
|
|
170 |
123 |
|
} |