petrinet_ports.mvc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. SimpleClassDiagrams PetriNetsPorts {
  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 String{
  11. constraint = $
  12. String function constraint(model : Element, name : String):
  13. if (is_physical_string(model["model"][name])):
  14. return "OK"!
  15. else:
  16. return "String has non-string value"!
  17. $
  18. }
  19. SimpleAttribute PlaceOrTransition{
  20. constraint = $
  21. String function constraint(model : Element, name : String):
  22. if (is_physical_string(model["model"][name])):
  23. if (boolean_or(value_eq(model["model"][name], "transition"), value_eq(model["model"][name], "place"))):
  24. return "OK"!
  25. else:
  26. return "PlaceOrTransition does not contain either 'place' or 'transition'"!
  27. else:
  28. return "PlaceOrTransition has non-string value"!
  29. $
  30. }
  31. Class Positionable {
  32. x : Integer
  33. y : Integer
  34. }
  35. Class Named {
  36. name : String
  37. }
  38. Class Boundary : Named, Positionable {}
  39. Class Place : Positionable, Named {
  40. nbTokens : Integer
  41. }
  42. Class Transition : Positionable, Named {}
  43. Class Port : Named, Positionable {
  44. sourceType : PlaceOrTransition
  45. targetType : PlaceOrTransition
  46. }
  47. Association Has1 (Boundary, Place) {}
  48. Association Has2 (Boundary, Transition) {}
  49. Association Has3 (Boundary, Port) {}
  50. Association P2T (Place, Transition) {}
  51. Association T2P (Transition, Place) {}
  52. Association PortTransition (Port, Transition) {}
  53. Association PortPlace (Port, Place) {}
  54. }