-
Notifications
You must be signed in to change notification settings - Fork 0
Project Report Deliverable 3
The following diagram describes our state machines.
To meet the specifications of Deliverable 3, we developed two state machines: one for Guide and one for Member.


In the Guide state machine, a guide starts at the Available state. A guide remains in the Available state when they still have available slots in their schedule.
There is a transition from Available to Available. This transition is invoked for every guide to allow the guide to be assigned to members when we initiate the assignment process. The transition executes the action doBookGuide() to assign all possible members to the guide.
If a guide's available period is less than or equal to 0 days (checked with the availableForPeriod() <= 0 guard), the guide's schedule is completely booked, and we transition to the Taken state.

A member first starts in the Unassigned state. After we initiate the assignment process, the transition bookGuide() will trigger the assign(Guide guide) event and transition the member to the Assigned state if the member is successfully assigned to a schedule (check with the doAssign(guide) guard).
Usage: State for members who are assigned a schedule or a guide if booked
When a member is in the Assigned state and decides to:
- cancel their trip, we trigger the
cancelTripevent and transition to the Cancelled state for the member. - when a member is still in the Assigned state on their scheduled start day, we trigger the
startTripevent, and the member transition's to the Banned state as they did not pay on the deadline. - pay for their trip, we trigger the
confirmPaymentevent, and transition to the Paid state if the payment is approved.
Usage: State for members that have fully paid for their trip.
When a member is in the Paid state:
- decides to cancel their trip, we trigger the
cancelTripevent and transition to the Cancelled state. - we trigger the
startTrip(int day)event if the current diving day corresponds to the member's scheduled start day and transition to the Started state.
Usage: State for members who have started their trip
When a member is in the Started state:
- decides to cancel their trip, we trigger the
cancelTripevent and the member goes to the Cancelled state. - when the member has finished their trip, we trigger the
finishTripevent and transition to the Finished state.
Usage: State for members who have finished their trip
Usage: State for members who decide to cancel their trip
*Note: The percentage refunded to members who cancel their trip is handled during the cancelTrip event and enforced in the Assignment controller.
Usage: State for members who are banned for not paying their trip on time.
*Note: The toggle for ban is handled by the transition from Assigned state to Banned state.
-
doAssign(Guide guide): Assign a member to a guide if needed and to a schedule. Returns a boolean to determine if member has been assigned a schedule. -
doBookGuide(): Method for the guides to be booked and be assigned to members. It will call the transitionassign(guide)on every member until the guide is taken or no more association is possible. -
availableForPeriod(): Counts the number of days in which the guides still have availability.