reachabilitygraph_print.mvc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. include "primitives.alh"
  2. include "modelling.alh"
  3. include "object_operations.alh"
  4. ReachabilityGraph_RAM reachabilitygraph_print {
  5. Composite schedule {
  6. {Contains} Success success {}
  7. {Contains} Failure failure {}
  8. {Contains} ForAll print_states {
  9. LHS {
  10. Pre_ReachabilityGraph/State {
  11. label = "0"
  12. }
  13. }
  14. RHS {
  15. Post_ReachabilityGraph/State {
  16. label = "0"
  17. action = $
  18. Void function action(model : Element, name : String, mapping : Element):
  19. Element dict_values
  20. Element all_values
  21. String place
  22. dict_values = create_node()
  23. all_values = allAssociationDestinations(model, name, "ReachabilityGraph/Contains")
  24. while (read_nr_out(all_values) > 0):
  25. place = set_pop(all_values)
  26. dict_add(dict_values, read_attribute(model, place, "name"), read_attribute(model, place, "tokens"))
  27. log((cast_v2s(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_v2s(read_attribute(model, mapping["0"], "name")) + " --[") + cast_v2s(read_attribute(model, name, "name"))) + "]--> ") + cast_v2s(read_attribute(model, mapping["1"], "name")))
  57. return!
  58. $
  59. }
  60. }
  61. }
  62. }
  63. Initial (schedule, print_states) {}
  64. OnSuccess (print_states, print_transitions) {}
  65. OnFailure (print_states, failure) {}
  66. OnSuccess (print_transitions, success) {}
  67. OnFailure (print_transitions, success) {}
  68. }