petrinets_constraints.mvc 955 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import models/SimpleClassDiagrams as SCD
  2. include "primitives.alh"
  3. SCD PetriNets{
  4. SimpleAttribute Natural {
  5. constraint =
  6. $
  7. include "primitives.alh"
  8. String function constraint_Natural(model : Element, name : String):
  9. Element self
  10. self = model["model"][name]
  11. if (is_physical_int(self)):
  12. if (integer_gte(self, 0)):
  13. return "OK"!
  14. else:
  15. return "Natural number not larger than or equal to zero"!
  16. else:
  17. return "Natural number not larger than or equal to zero"!
  18. $
  19. }
  20. Class Place{
  21. tokens : Natural
  22. }
  23. Class Transition{}
  24. Association P2T (Place, Transition) {
  25. weight : Natural
  26. }
  27. Association T2P (Transition, Place) {
  28. weight : Natural
  29. }
  30. }
  31. export PetriNets to models/PetriNets