uc 05 - yshehab/SchoolRoomBooking GitHub Wiki

5. View all bookings and their details for a given date

Coordinating method

Collection <Booking> getBookings(Date aDate)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: The Date object, 22/11/2013

  1. Create a new empty collection, results.
  2. Access the School object in schools, which in this case is {school3, school4}.
    For each School object accessed in step 2:
  3. Access it's collection of Booking objects.
    For each Booking object accessed in step 3:
  4. Check if it's dateRange Range object contains 22/11/2013
  5. If it does, add the Booking object to results
  6. Return results

Sequence diagram for this scenario

Notes on alternative scenarios

If there are no bookings for the given date return an empty collection.

Updates to implementation model

Classes

Class Booking

Links
 private collection<Range> dates 
Methods
 public Boolean hasDate(Date aDate)

Post condition: returns true if the receiver's date Range object contains aDate, returns False otherwise

Class School

Links
 private collection<Room, Booking> bookings 
Methods
 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.

Class LettingCoord

Links
Methods
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.

Navigations

has from School to Booking
isIn from School to Room

Discussion

⚠️ **GitHub.com Fallback** ⚠️