Created
March 6, 2011 10:40
-
-
Save neilmanuell/857194 to your computer and use it in GitHub Desktop.
Pseudocode examples of Locked State transition phases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////// | |
// exiting guard | |
if( !lock.isKeyValid( user ) ){ | |
fsm.cancel( Reasons.KEY_INVALID ); | |
} | |
//////////////////////////////////////////// | |
//////////////////////////////////////////// | |
// cancelled | |
if( reason == Reasons.KEY_INVALID ){ | |
Alert( "You do not have the correct privilege to open this door" ); | |
} else { | |
Alert( "Cancelled for unknown reason: " + reason ); | |
} | |
//////////////////////////////////////////// | |
//////////////////////////////////////////// | |
// entering | |
lock.insertKey( user ).disengage(); | |
//////////////////////////////////////////// | |
//////////////////////////////////////////// | |
// teardown | |
lock.insertKey( user ).engage(); | |
//////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment