petrinets_constraints.mvc 538 B

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