uc 05 - yshehab/SchoolRoomBooking GitHub Wiki
Collection <Booking> getBookings(Date aDate)
Given: The Date object, 22/11/2013
- Create a new empty collection, results.
- Access the School object in schools, which in this case is {school3, school4}.
For each School object accessed in step 2: - Access it's collection of Booking objects.
For each Booking object accessed in step 3: - Check if it's dateRange Range object contains 22/11/2013
- If it does, add the Booking object to results
- Return results
If there are no bookings for the given date return an empty collection.
private collection<Range> dates
public Boolean hasDate(Date aDate)
Post condition: returns true if the receiver's date Range object contains aDate, returns False otherwise
private collection<Room, Booking> bookings
public collection<Booking> getBookings(Date aDate)
Post condition: returns a collection of all Booking objects linked to the receiver whose date attribute contains a Date object matching aDate.
Collection <Booking> getBookings(Date aDate)
Post condition: returns a collection of Booking objects which are linked to all the receivers linked School objects and whose date attribute contains a Date object matching aDate.
has from School to Booking
isIn from School to Room