Skip to content

Iteration #3: State Machines Transitions

NoahYe123 edited this page Nov 11, 2021 · 5 revisions

COURSE NAME : ECSE 223 - Model-Based Programming

TERM : Fall 2021

TEAM NUMBER : #2

TEAM MEMBERS : Jian Long (Noah) Ye, Arturo Mory Ramirez, Karen Fu, Peini Cheng, Danny Tu, Salim Benchekroun

Assignment Status:

When an assignment is created for a member, that assignment goes to Assigned state at the beginning.

In Assigned: confirmPayment()->Paid; After the administrator calls confirmPayment() to confirm payment for this assignment, this assignment will then go to Paid state indicating that the member has paid for this assignment. cancelTrip()->Cancelled; After the administrator calls cancelTrip() to cancel this assignment, this assignment will then go to Cancelled. startTrip()/{getMember().banMember();}->Banned; When the administrator attempts to call startTrip() when the member has not paid, that member will be banned from this application by calling memberBanned() and then this assignment will go to Banned. finishTrip()/{rejectFinishDueToNotStarted();}->Assigned; When the administrator attempts to call finishTrip(), an error would be raised by rejectFinishDueToNotStarted() because a trip cannot finish before it’s started.

In Paid: cancelTrip()/{refund();}->Cancelled;
After the administrator calls cancelTrip() to cancel this assignment, this assignment will then go to Cancelled and the member will receive a 50% refund.

startTrip()->Started; After the administrator calls startTrip() after the member paid for the trip, the assignment will go to Started.

confirmPayment()/{rejectPaymentDueToPaid();} ->Paid; When the administrator attempts to call confirmPayment(), an error would be raised by rejectPaymentDueToPaid() because the member has already paid for it.

finishTrip()/{rejectFinishDueToNotStarted();}->Paid; When the administrator attempts to call finishTrip() in Paid state, an error would be raised by rejectFinishDueToNotStarted() because a trip cannot finish before it’s started.

memberBanned()->Banned; When the administrator wants to ban a member by calling memberBanned() after the member paid for the trip, the state will go from Paid to Banned.

In Started: ConfirmPayment() -> Started: is to make sure the Administrator doesn’t ask the member to pay again for the same trip (throw an error)

finishTrip() -> Finished: is for the Administrator to assign the member to the finish trip if the member has already started the trip.

cancelTrip() -> Cancel: If the member is in the Started state and wants to cancel the trip, then the administrator will move the member to the Cancel state. The member will also be refunded 10 percent of what they paid.

MemberBanned() -> Banned: When the administrator bans a member in the Started state it will transition to the Banned state.

In Finished:

startTrip()/{rejectStartDueToFinished();}-> Finished;

When the administrator attempts to call startTrip(), an error would be raised by rejectStartDueToFinished() because the trip is already finished for the member.Then the state will transition back to Finished.

cancelTrip()/{rejectCancelDueToFinished();} ->Finished;

When the administrator attempts to call cancelTrip(), an error would be raised by rejectCancelDueToFinished() because the trip is already finished for the member. Then the state will transition back to Finished.

confirmPayment()/{rejectPaymentDueToFinished();} ->Finished;

When the administrator attempts to call confirmPayment(), an error would be raised by rejectPaymentDuetoFinished() because the trip is already finished for the member. Then the state will transition back to Finished.

memberBanned()->Banned; When the administrator wants to ban a member by calling the memberBanned() in the Finished state, the state will transition from Finished to Banned.

In Banned:

startTrip()/{rejectStartDueToBanned();}->Banned; When the administrator calls startTrip() to start the trip for a banned member, the error would be raised by rejectStartDueToFinished() because the trip cannot be started for a banned member. Then the state will transition back to Banned.

comfirmPayment()/{rejectPaymentDueToBanned();}->Banned; When the administrator calls the confirmPayment() to check if a banned member has paid or not, the error would be raised by calling the rejectPaymentDueToBanned, since the payment cannot be confirmed if the member is banned. Then the state will transition back to Banned.

cancelTrip()/{rejectCancelDueToBanned();}->Banned; When the administrator calls the cancelTrip() to cancel the trip for a banned member, the error would be raised by calling the rejectCancelDueToBanned(), since the trip cannot be canceled if the member is banned. Then the state will transition back to Banned.

finishedTrip()/{rejetctFinishedDueToBanned();}->Banned; When the administrator wants to finish the trip by calling finishedTrip() to a banned member, the error would be raised by calling the rejetctFinishedDueToBanned(). Then the state transition will go back to Banned.

In Cancelled:

startTrip()/{rejectStartDueToCancelled();}->Cancelled; When the administrator calls the startTrip() to start the trip in the Cancelled state, the error would be raised by calling the rejectStartDueToCancelled(). Since the trip cannot be started if the trip has already been cancelled. Then the state will go back to Cancelled.

finishTrip()/{rejectFinishDueToCancelled();}->Cancelled; When the administrator calls the finishTrip() to finish the trip in the Cancelled state, the error would be raised by calling the rejectFinishDueToCancelled(). Since the trip cannot be finished if the trip has already been cancelled.Then the state will go back to Cancelled.

confirmPayment()/{rejectPaymentDueToCancelled();}->Cancelled; When the administrator calls the confirmPayment() to check if the member has paid or not in the Cancelled state, the error would be raised by calling the rejectPaymentDueToCancelled(). Since the payment can not be confirmed if the trip is cancelled. Then the state will go back to Cancelled.

memberBanned()->Banned; When the administrator wants to ban a member by calling the memberBanned() in the Cancelled state, the state will transition from Cancelled to Banned .

Member Status

When a member is created, that member goes to Regular state at the beginning.

In Regular Regular -> Banned: When a member is banned, the function banMember() is called by the administrator, and the member is forbidden from registering in the future, until unbanned.

Clone this wiki locally