Guest User

Untitled

a guest
Jun 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class GotoFsm extends Actor with FSM[Int, Null] {
  2.  
  3. notifying {
  4. case Transition(_, 10) => println("Goto 10 ftw!")
  5. }
  6.  
  7. when(0) {
  8. case _ => goto(10) until 5000
  9. }
  10.  
  11. when(10) {
  12. case _ => stop
  13. }
  14.  
  15. startWith(0, null)
  16.  
  17. onTermination {
  18. case _ => println("Bye bye :-)")
  19. }
  20. }
  21.  
  22. case object Go
  23. object GotoFsm {
  24. def main(args: Array[String]) {
  25.  
  26. val gotoFsm = Actor.actorOf[GotoFsm].start
  27.  
  28. gotoFsm !! Go
  29. }
  30. }
Add Comment
Please, Sign In to add comment