pkg core LettingCoord - yshehab/SchoolRoomBooking GitHub Wiki
Core
LettingCoord
The coordinating class
private collection <School>
schools
References a collection of all linked School objects
private collection <Organization>
organizations
References a collection of all linked Organization objects
Use case 1
___public collection<Range>
createPermit(Organization anOrg, Member aMember, Room aRoom, Range dateRange, Range timeslots, String display) ___
Pre condition: aMember should be linked via isMemberOf to anOrg. If not an exception is thrown.
Post condition: a collection of two Range objects is returned, one containing intersecting days and one intersecting timeslots. If there are no intersections two empty Range objects are returned and a new Booking object is created with the supplied attributes, and a new Permit object is created with the supplied attributes.
Use case 2
public collection<Range>
addBooking(Member aMember, Room aRoom, Range aDateRange, Range timeslots, String display)
Pre condition: aMember should be linked via worksAt to the School object in aRooms school attribute. If not an exception is thrown.
Post condition: a collection of two Range objects is returned, one containing intersecting days and one intersecting timeslots. If there are no intersections two empty Range objects are returned and a new Booking object is created with the supplied attributes.
Use case 3
public collection<Range>
addBooking(Permit aPermit, Room aRoom, Range aDateRange, Range timeslots, String display)
Pre condition: aPermit should be linked via hasPermits to the School object in aRooms school attribute. If not an exception is thrown.
Post condition: a collection of two Range objects is returned, one containing intersecting days and one intersecting timeslots. If there are no intersections two empty Range objects are returned and a new Booking object is created with the supplied attributes.
Use case 4
___public void cancel(Booking aBooking) ___
Precondition: Precondition: one or more of the Date objects referenced by aBooking_s date attribute should be today or in the future. If not an exception is thrown.
Post-Condition: Post-Condition: If some of the Date objects linked to the dateRange object aDateRange linked to aBooking are today or in the future, those Date objects are removed from aDateRange.
If all the Date objects linked to the dateRange object aDateRange linked to aBooking are today or in the future then aBooking and its linked Charge, DateRange and Date objects are removed from the system.
Use case 5
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.
Use case 6
___public Collection <Booking>
getBookings(Organization anOrganization) ___
Post condition: returns a collection of Booking objects which are linked to the Permit objects linked to anOrganization
Use case 7
public Collection<Room>
getRooms(School aSchool, Date startDate, Date endDate, TimeSlot timeslot, RoomType roomtype)
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 Timeslots
Use case 8
___public Collection<Booking>
getBookings(Room aRoom) ___
Post condition: returns a collection of Booking objects for the current day and the future which are linked to aRoom
Use case 9
public void createAccount(Permit aPermit)
Post condition: a new Account object is created with it_s cost attribute the sum of the cost attributes of all the Booking objects linked to aPermit.
If the aPermit has a linked Account object then an exception is thrown.
If the sum of the cost attributes of aPermits linked Booking objects # 0, then an exception is thrown.
Use case 11
___public Collection<Member>
getMembers(Organization anOrganization) ___
Post-Condition: returns a collection of all Member objects linked to anOrganazation
Use case 12
___public Collection<Permit>
getPermits(Organization anOrganization) ___
Postcondition: returns a collection of all Permit objects linked to anOrganization
Use case 13
___public Collection<Booking>
getBookings(Permit aPermit) ___
Postcondition: returns a collection of all Booking objects linked to aPermit
Use case 14
public Collection <Account>
getAccounts(Organization anOrganization)
Postcondition: returns a collection of all Account objects linked to all permit objects linked to anOrganization.
Use case 15
___public void addOrganization( String name, Address address, Member aMember) ___
Precondition: an Organization object with name attribute aName should not be linked to anAddress, if it is an exception is thrown.
Postcondition: a new instance of Organization is created with the supplied attributes. The receiver records a reference to anOrganization .
Use case 16
___public void addMemberToOrganization(Member aMember, Organization anOrganization) ___
Postcondition: anOrganization records a reference to aMember .
Use case 17
___public void addMember(Name aName, Address anAddress, Email anEmail, School aSchool) ___
Postcondition: If a Member object exists in the system with the supplied attributes an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes. aSchool records a reference to aMember
Use case 18
___public void addSchool(String aName, Address anAddress, Room aRoom) ___
Postcondition: a new school object aSchool is created, with the supplied attributes, the receiver records a reference to aSchool .
Use case 19
___public void addRoom(School aSchool, String aName, Collection<Assets>
assets, int capacity, Roomtype roomtype) ___
Precondition: A Room object with the same type and name should not be linked to the aSchool.
Postcondition: a new room object aRoom is created, with the supplied attributes, aSchool records a reference to aRoom .
Use case 20
___public void addMemberToSchool(Member aMember, School aSchool) ___
Postcondition: aSchool records reference to aMember.
Use case 21
___public void addMember(Name aName, Address anAddress, Email anEmail, Organization anOrganization) ___
Postcondition: If a Member object exists in the system with the supplied attributes an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes. anOrganization records a reference to aMember
Use case 22
___public void addMember(Name aName, Address anAddress, Email anEmail, School aSchool, Organization anOrganization)
___
Postcondition: If a Member obect exists in the system with the supplied attributes an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes. aSchool records a reference to aMember and anOrganization records a reference to aMember
Use case 23
public void addMemberAndOrganization(Name memberName, Address memberAddress, Email anEmail, String orgName, Address orgAddress)
Postcondition: If a Member object exists in the system with the supplied attributes or if anOrganization with the same name is linked to the same address object, an exception is thrown, otherwise a new Member object, aMember, is created with the supplied attributes, and a new Organization object anObject is created with the supplied attributes. anOrganization records a reference to aMember.. The receiver records a reference to anOrganization