3 import java.io.Serializable;
5 import java.util.Vector;
8 @SuppressWarnings("serial")
9 public class Offer implements Serializable {
12 private int offerNumber;
13 private Date firstDay; // Dates are stored as java.util.Date objects instead of java.sql.Date objects
14 private Date lastDay; // because, they are not well stored in db4o as java.util.Date objects
15 private float price; // This is coherent because objects of java.sql.Date are objects of java.util.Date รง
16 private boolean isBooked;
17 private Vector<Booking> bookings = new Vector<Booking>(); // That is: java.sql.Date is a subclass (or extends) java.util.Date
18 private RuralHouse ruralHouse;
21 public Offer(int offerNumber,RuralHouse ruralHouse, Date firstDay, Date lastDay, float price){
22 this.firstDay=firstDay;
25 this.ruralHouse=ruralHouse;
26 this.offerNumber=offerNumber;
29 * Get the house number of the offer
31 * @return the house number
33 public RuralHouse getRuralHouse() {
34 return this.ruralHouse;
38 * Set the house number to a offer
42 public void setRuralHouse(RuralHouse ruralHouse) {
43 this.ruralHouse = ruralHouse;
48 * Get the offer number
50 * @return offer number
52 public int getOfferNumber() {
53 return this.offerNumber;
59 * Get the first day of the offer
61 * @return the first day
63 public Date getFirstDay() {
68 * Set the first day of the offer
73 public void setFirstDay(Date firstDay) {
74 this.firstDay = firstDay;
78 * Get the last day of the offer
80 * @return the last day
82 public Date getLastDay() {
87 * Set the last day of the offer
92 public void setLastDay(Date lastDay) {
93 this.lastDay = lastDay;
101 public float getPrice() {
110 public void setPrice(float price) {
116 * This method creates a book with a corresponding parameters
118 * @param First day, last day, house number and telephone
121 public Vector<Booking> createBooking(int numBooking,Client client) {
122 Booking b = new Booking(numBooking,this,client);
123 this.bookings.add(b);
124 return this.bookings;
128 public String toString(){
129 return firstDay.toString()+", "+lastDay.toString()+", "+price;
131 public Vector<Booking> getBookings() {
134 public void setBookings(Vector<Booking> bookings) {
135 this.bookings = bookings;
137 public boolean isBooked() {
140 public void setBooked(boolean isBooked) {
141 this.isBooked = isBooked;