Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions a92725 ... vs 06a849 ... for ruralHouses/src/domain/RuralHouse.java

Diff revisions: vs.
  @@ -73,12 +73,13 @@
73 73 return this.houseNumber + ": " + this.town;
74 74 }
75 75
76 - public Offer createOffer(Date firstDay, Date lastDay, float price) {
77 - Offer off=new Offer(this, firstDay, lastDay, price);
76 + public Offer createOffer(int offerNumber,Date firstDay, Date lastDay, float price) {
77 + Offer off=new Offer(offerNumber,this,firstDay,lastDay,price);
78 78 offers.add(off);
79 79 return off;
80 80 }
81 81
82 +
82 83 @Override
83 84 public int hashCode() {
84 85 final int prime = 31;
  @@ -152,6 +153,17 @@
152 153 return null;
153 154 }
154 155
155 -
156 + public Offer overlapsWith( Date firstDay, Date lastDay) {
157 +
158 + Iterator<Offer> e=offers.iterator();
159 + Offer offer=null;
160 + while (e.hasNext()){
161 + offer=e.next();
162 + if ( (offer.getFirstDay().compareTo(lastDay)<0) && (offer.getLastDay().compareTo(firstDay)>0))
163 + return offer;
164 + }
165 + return null;
166 +
167 + }
156 168
157 169 }