Skip to content

Instantly share code, notes, and snippets.

@sfentress
Created June 27, 2011 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfentress/1049523 to your computer and use it in GitHub Desktop.
Save sfentress/1049523 to your computer and use it in GitHub Desktop.
// STATES
//
// loggedOut
// loggedIn
// showingBlogButton <------------|- concurrent
// atLocation <------------|
// inHomePage
// inActivity
//
// atLocation contains two methods, gotoActivity and gotoHomePage, which simply
// run "this.gotoState('inActivity')" or "this.gotoState('inHomePage')"
// Correctly enter loggedIn, atLocation.EMPTY and showingBlogButton
BEGIN gotoState: Ki.State<loggedIn>
starting from current state: Ki.State<loggedOut>
current states before: Ki.State<loggedOut>
pivot state = Ki.State<__ROOT_STATE__>
exiting state: Ki.State<loggedOut>
entering state: Ki.State<loggedIn>
entering state: Ki.State<loggedIn.atLocation>
entering state: Ki.EmptyState<loggedIn.atLocation.__EMPTY_STATE__>
No initial substate was defined for state Ki.State<loggedIn.atLocation>. Entering default empty state
entering state: Ki.State<loggedIn.showingBlogButton>
END gotoState: Ki.State<loggedIn>
// Correctly go from atLocation.EMPTY to atLocation.inActivity
BEGIN gotoState: Ki.State<loggedIn.atLocation.inActivity>
starting from current state: Ki.EmptyState<loggedIn.atLocation.__EMPTY_STATE__>
current states before: Ki.EmptyState<loggedIn.atLocation.__EMPTY_STATE__>,Ki.State<loggedIn.showingBlogButton>
pivot state = Ki.State<loggedIn.atLocation>
exiting state: Ki.EmptyState<loggedIn.atLocation.__EMPTY_STATE__>
entering state: Ki.State<loggedIn.atLocation.inActivity>
entering state: Ki.EmptyState<loggedIn.atLocation.inActivity.__EMPTY_STATE__>
current states after: Ki.State<loggedIn.showingBlogButton>,Ki.EmptyState<loggedIn.atLocation.inActivity.__EMPTY_STATE__>
END gotoState: Ki.State<loggedIn.atLocation.inActivity>
// Trying to go from atLocation.inActivity to atLocation.inHomePage
BEGIN sendEvent: event<gotoHomePage>
Ki.State<loggedIn.atLocation>: will handle event gotoHomePage // seems good...
BEGIN gotoState: Ki.State<loggedIn.atLocation.inHomePage>
starting from current state: Ki.State<loggedIn.showingBlogButton> // huh? why?
current states before: Ki.State<loggedIn.showingBlogButton>,Ki.EmptyState<loggedIn.atLocation.inActivity.__EMPTY_STATE__>
pivot state = Ki.State<loggedIn>
ERROR Ki.Statechart: Can not go to state Ki.State<loggedIn.atLocation.inHomePage> from Ki.State<loggedIn.showingBlogButton>. Pivot state Ki.State<loggedIn> has concurrent substates.
END sendEvent: event<gotoHomePage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment