environment_PW.mvc 1.9 KB

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