unification with the actual initial project. Some things are new now, but there has...
[RRRRHHHH_Code] / ruralHouses / src / domain / RuralHouse.java
index 7087a66..2ab7ac9 100644 (file)
@@ -73,12 +73,13 @@ public class RuralHouse implements Serializable {
                return this.houseNumber + ": " + this.town;
        }
        
-       public Offer createOffer(Date firstDay, Date lastDay, float price) {
-        Offer off=new Offer(this, firstDay, lastDay, price);
+       public Offer createOffer(int offerNumber,Date firstDay, Date lastDay, float price)  {
+        Offer off=new Offer(offerNumber,this,firstDay,lastDay,price);
         offers.add(off);
         return off;
        }
 
+
        @Override
        public int hashCode() {
                final int prime = 31;
@@ -152,6 +153,17 @@ public class RuralHouse implements Serializable {
                return null;            
        }
        
-       
+public Offer overlapsWith( Date firstDay,  Date lastDay) {
+               
+               Iterator<Offer> e=offers.iterator();
+               Offer offer=null;
+               while (e.hasNext()){
+                       offer=e.next();
+                       if ( (offer.getFirstDay().compareTo(lastDay)<0) && (offer.getLastDay().compareTo(firstDay)>0))
+                               return offer;
+               }
+               return null;
+               
+       }
 
 }