Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 0f75b2 ... vs 7bf57b ... for ruralHouses/src/domain/Offer.java

Diff revisions: vs.
  @@ -2,6 +2,8 @@
2 2
3 3 import java.io.Serializable;
4 4 import java.util.Date;
5 + import java.util.LinkedList;
6 + import java.util.Vector;
5 7
6 8
7 9 @SuppressWarnings("serial")
  @@ -12,7 +14,7 @@
12 14 private Date firstDay; // Dates are stored as java.util.Date objects instead of java.sql.Date objects
13 15 private Date lastDay; // because, they are not well stored in db4o as java.util.Date objects
14 16 private float price; // This is coherent because objects of java.sql.Date are objects of java.util.Date
15 - private Booking booking; // That is: java.sql.Date is a subclass (or extends) java.util.Date
17 + private Vector<Booking> bookings; // That is: java.sql.Date is a subclass (or extends) java.util.Date
16 18 private RuralHouse ruralHouse;
17 19
18 20
  @@ -109,25 +111,6 @@
109 111 this.price = price;
110 112 }
111 113
112 - /**
113 - * Get the book number
114 - *
115 - * @return book object
116 - */
117 - public Booking getBooking() {
118 - return this.booking;
119 - }
120 -
121 - /**
122 - * Set the book object
123 - *
124 - * @param book
125 - * Book object
126 - * @return None
127 - */
128 - public void setBooking(Booking booking) {
129 - this.booking = booking;
130 - }
131 114
132 115 /**
133 116 * This method creates a book with a corresponding parameters
  @@ -135,12 +118,21 @@
135 118 * @param First day, last day, house number and telephone
136 119 * @return a book
137 120 */
138 - public Booking createBooking(int numBooking,String bookTelephoneNumber) {
139 - return booking=new Booking(numBooking,bookTelephoneNumber,this);
121 + public Booking createBooking(int numBooking,String bookTelephoneNumber,String name , String mail) {
122 + Client client = new Client(name,mail,bookTelephoneNumber);
123 + Booking b = new Booking(numBooking,this,client);
124 + this.bookings.add(b);
125 + return b;
140 126
141 127 }
142 128
143 129 public String toString(){
144 130 return firstDay.toString()+", "+lastDay.toString()+", "+price;
145 131 }
132 + public Vector<Booking> getBookings() {
133 + return bookings;
134 + }
135 + public void setBookings(Vector<Booking> bookings) {
136 + this.bookings = bookings;
137 + }
146 138 }