petrinets_constraints.mvc 805 B

1234567891011121314151617181920212223242526272829
  1. import models/SimpleClassDiagrams as SCD
  2. include "primitives.alh"
  3. SCD PetriNets{
  4. SimpleAttribute Natural {
  5. constraint = $
  6. String function constraint(model : Element, name : String):
  7. if (bool_not(is_physical_int(model["model"][name]))):
  8. return "Natural has no integer value"!
  9. elif (integer_lt(model["model"][name], 0)):
  10. return "Natural does not have a positive or zero value"!
  11. else:
  12. return "OK"!
  13. $
  14. }
  15. Class Place{
  16. tokens : Natural
  17. }
  18. Class Transition{}
  19. Association P2T (Place, Transition) {
  20. weight : Natural
  21. }
  22. Association T2P (Transition, Place) {
  23. weight : Natural
  24. }
  25. }
  26. export PetriNets to models/PetriNets