| 1 |
# |
| 2 |
# librarybookstate.pystate |
| 3 |
# |
| 4 |
# This state machine models the state of books in a library. |
| 5 |
# |
| 6 |
|
| 7 |
statemachine BookState: |
| 8 |
New -(shelve)-> Available |
| 9 |
Available -(reserve)-> OnHold |
| 10 |
OnHold -(release)-> Available |
| 11 |
Available -(checkout)-> CheckedOut |
| 12 |
CheckedOut -(checkin)-> Available |
| 13 |
|
| 14 |
# add states for restricted books |
| 15 |
New -(restrict)-> Restricted |
| 16 |
Available -(restrict)-> Restricted |
| 17 |
Restricted -(release)-> Available |
| 18 |
Restricted -(checkout)-> CheckedOutRestricted |
| 19 |
CheckedOutRestricted -(checkin)-> Restricted |