environment_PW.mvc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 Activity : Named {
  28. duration : Natural
  29. }
  30. Class CommunicationSequence : Activity {}
  31. Class Parallel : Activity {}
  32. Class Sequence : Activity {}
  33. Class Alternative : Activity {}
  34. Class Event : Activity {}
  35. Association Contains (Activity, Activity) {}
  36. Association Next (Activity, Activity) {}
  37. }