environment_PW.mvc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. duration : Natural
  33. }
  34. Class CommunicationSequence : Activity {
  35. actor : String
  36. }
  37. Class Parallel : Activity {}
  38. Class Sequence : Activity {}
  39. Class Alternative : Activity {}
  40. Class Event : Activity {}
  41. Association Contains (Activity, Activity) {}
  42. Association HasActivity (Boundary, Activity) {
  43. target_lower_cardinality = 1
  44. target_upper_cardinality = 1
  45. }
  46. Association HasPort (Boundary, Port) {}
  47. Association HasActivity (TopActivity, Activity) {}
  48. Association HasEventSequence (CommunicationSequence, Event) {}
  49. Association Next (Activity, Activity) {}
  50. Association PortEvent (Port, Event) {}
  51. }