uc 07 - yshehab/SchoolRoomBooking GitHub Wiki

7. View available rooms in a school for a given date [range] and timeslot by room type

Coordinating method

public Collection<Room>  getRooms(School aSchool, RoomType type, Range<Date> dates, Range times)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: The School object school2, the dateRange Range134, the timeslotRange Range135 and the RoomType CLASSROOM)

  1. Access the collection of Room objects linked to school2, which in this case is {room3, room5}.
  2. Create a new empty collection, results.
    For each Room object accessed in step 1:
  3. Find out its RoomType
  4. If CLASSROOM add to results
    For each Room object in results, in this case is {room3, room5}:
  5. Access the pairs of Range objects linked to its linked Booking objects, in this case range56, range45 and range78, range103
    For each pair of Range object accessed in step 5:
  6. Check if it intersects with range134, range135.
    As the pair linked to booking3, which is linked to room5 does, room5 is removed from results
  7. Return results

Sequence diagram for this scenario

Notes on alternative scenarios

If there are no suitable rooms return an empty collection

Updates to implementation model

Class LettingCoord

Links

None

Methods

public Collection<Room>  getRooms(School aSchool, RoomType type, Range<Date> dates, Range times)

Post condition:

  returns a collection of Room objects linked to aSchool which do not have linked Booking objects which intersect with the   supplied Date and Time ranges

Class School

Links

Collection<Room> rooms

References a collection of all linked Room objects

Methods

Collection<Room> getRooms()

Post condition: returns a collection of Room objects linked to the receiver

Class Room

Links

None

Methods
RoomType  getType()

Post condition: returns the RoomType of the receiver

Class Booking

Links

None

Methods
public collection <Range> intersectsWith(Range aDaterange, Range timeslots)

Post condition: a collection of two Range objects is returned, one containing intersecting days and one intersecting timeslots.
If there are no intersections, or no dates intersect, two empty Range objects are returned.
If dates intersects but timeslots don_t, then a Range of intersecting days and an empty Range of TimeSlots is returned.

Navigations

isIn from School to Room

Discussion

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