environment_PW.mvc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. include "primitives.alh"
  2. SimpleClassDiagrams Environment_PW{
  3. SimpleAttribute Natural{
  4. constraint = $
  5. String function constraint_Natural(model : Element, name : String):
  6. if (is_physical_int(model["model"][name])):
  7. if (integer_gte(model["model"][name], 0)):
  8. return "OK"!
  9. else:
  10. return "Natural has negative value"!
  11. else:
  12. return "Natural has non-integer value"!
  13. $
  14. }
  15. SimpleAttribute String{
  16. constraint = $
  17. String function constraint_String(model : Element, name : String):
  18. if (is_physical_string(model["model"][name])):
  19. return "OK"!
  20. else:
  21. return "String has non-string value"!
  22. $
  23. }
  24. Class Named {
  25. name : String
  26. }
  27. Class Positionable {
  28. }
  29. Class Port : Named, Positionable {}
  30. Class Boundary : Named, Positionable {}
  31. Class Activity : Named, Positionable {}
  32. Class CommunicationSequence : Activity {
  33. actor : String
  34. }
  35. Class TopActivity : Activity {}
  36. Class Parallel : TopActivity {}
  37. Class Sequence : TopActivity {}
  38. Class Alternative : TopActivity {}
  39. Class Event : Named {}
  40. Class Input : Event {}
  41. Class Output : Event {
  42. duration : Natural
  43. }
  44. Association Has1 (Boundary, TopActivity) {}
  45. Association Has2 (Boundary, Event) {}
  46. Association Has3 (Boundary, Port) {}
  47. Association HasActivity (TopActivity, Activity) {}
  48. Association HasEventSequence (CommunicationSequence, Event) {}
  49. Association NextEvent (Event, Event) {}
  50. Association NextActivity (Activity, Activity) {}
  51. Association PortEvent (Port, Event) {}
  52. }