uc 07 v2 - yshehab/SchoolRoomBooking GitHub Wiki
TO DO - revise
public Collection <Room> getRooms(School aSchool, RoomType type, Range<Date> dates, Range times)
Given: The School object school2, the dateRange Range134, the timeslotRange Range135 and the RoomType CLASSROOM)
- Access the collection of Room objects linked to school2, which in this case is {room3, room5}.
- Create a new empty collection, results.
For each Room object accessed in step 1:
- Find out its RoomType
- If CLASSROOM add to results
For each Room object in results, in this case is {room3, room5}:
- 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:
- Check if it intersects with range134, range135.
As the pair linked to booking3, which is linked to room5 does, room5 is removed from results - Return results
If there are no suitable rooms return an empty collection
None
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
Collection <Room> rooms
References a collection of all linked Room objects
Collection <Room> getRooms()
Post condition: returns a collection of Room objects linked to the receiver
None
RoomType getType()
Post condition: returns the RoomType of the receiver
None
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.
isIn from School to Room