reachabilitygraph_print.mvc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 = dict_create()
  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_value(read_attribute(model, name, "name")) + ": ") + dict_to_string(dict_values))
  27. output((cast_value(read_attribute(model, name, "name")) + ": ") + dict_to_string(dict_values))
  28. return!
  29. $
  30. }
  31. }
  32. }
  33. {Contains} ForAll print_transitions {
  34. LHS {
  35. Pre_ReachabilityGraph/State pre_s1 {
  36. label = "0"
  37. }
  38. Pre_ReachabilityGraph/State pre_s2 {
  39. label = "1"
  40. }
  41. Pre_ReachabilityGraph/Transition (pre_s1, pre_s2){
  42. label = "2"
  43. }
  44. }
  45. RHS {
  46. Post_ReachabilityGraph/State post_s1 {
  47. label = "0"
  48. }
  49. Post_ReachabilityGraph/State post_s2 {
  50. label = "1"
  51. }
  52. Post_ReachabilityGraph/Transition (post_s1, post_s2) {
  53. label = "2"
  54. action = $
  55. Void function action(model : Element, name : String, mapping : Element):
  56. log((((cast_value(read_attribute(model, mapping["0"], "name")) + " --[") + cast_value(read_attribute(model, name, "name"))) + "]--> ") + cast_value(read_attribute(model, mapping["1"], "name")))
  57. output((((cast_value(read_attribute(model, mapping["0"], "name")) + " --[") + cast_value(read_attribute(model, name, "name"))) + "]--> ") + cast_value(read_attribute(model, mapping["1"], "name")))
  58. return!
  59. $
  60. }
  61. }
  62. }
  63. }
  64. Initial (schedule, print_states) {}
  65. OnSuccess (print_states, print_transitions) {}
  66. OnFailure (print_states, failure) {}
  67. OnSuccess (print_transitions, success) {}
  68. OnFailure (print_transitions, success) {}