-
-
Save jezinka/447285403b573fdcb7a876f7cffb5b99 to your computer and use it in GitHub Desktop.
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
static Cell transition(event, Cell cell) { | |
List states = state_machine_definition[cell.state] | |
def transition = states.find { it.event == event } | |
if (!transition) { | |
throw new Exception("invalid event $event for state ${cell.state}") | |
} | |
Cell tempCell = new Cell(transition.to, cell.lifeLong) | |
if (transition.afterAction) { | |
tempCell."${transition.afterAction}"() | |
} | |
return tempCell | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment