print.mvc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. Composite schedule {
  5. {Contains} Success success {}
  6. {Contains} Failure failure {}
  7. {Contains} ForAll print_states {
  8. LHS {
  9. Pre_ReachabilityGraph/State {
  10. label = "0"
  11. }
  12. }
  13. RHS {
  14. Post_ReachabilityGraph/State {
  15. label = "0"
  16. action = $
  17. Void function action(model : Element, name : String, mapping : Element):
  18. Element dict_values
  19. Element all_values
  20. String place
  21. dict_values = create_node()
  22. all_values = allAssociationDestinations(model, name, "ReachabilityGraph/Contains")
  23. while (set_len(all_values) > 0):
  24. place = set_pop(all_values)
  25. dict_add(dict_values, read_attribute(model, place, "name"), read_attribute(model, place, "tokens"))
  26. log(cast_string(read_attribute(model, name, "name")) + ": " + dict_to_string(dict_values))
  27. return!
  28. $
  29. }
  30. }
  31. }
  32. {Contains} ForAll print_transitions {
  33. LHS {
  34. Pre_ReachabilityGraph/State pre_s1 {
  35. label = "0"
  36. }
  37. Pre_ReachabilityGraph/State pre_s2 {
  38. label = "1"
  39. }
  40. Pre_ReachabilityGraph/Transition (pre_s1, pre_s2){
  41. label = "2"
  42. }
  43. }
  44. RHS {
  45. Post_ReachabilityGraph/State post_s1 {
  46. label = "0"
  47. }
  48. Post_ReachabilityGraph/State post_s2 {
  49. label = "1"
  50. }
  51. Post_ReachabilityGraph/Transition (post_s1, post_s2) {
  52. label = "2"
  53. action = $
  54. Void function action(model : Element, name : String, mapping : Element):
  55. log(cast_string(read_attribute(model, mapping["0"], "name")) + " --[" + cast_string(read_attribute(model, name, "name")) + "]--> " + cast_string(read_attribute(model, mapping["1"], "name")))
  56. return!
  57. $
  58. }
  59. }
  60. }
  61. }
  62. Initial (schedule, print_states) {}
  63. OnSuccess (print_states, print_transitions) {}
  64. OnFailure (print_states, failure) {}
  65. OnSuccess (print_transitions, success) {}
  66. OnFailure (print_transitions, success) {}