petrinets_constraints.mvc 721 B

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