12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import models/SimpleClassDiagrams as SCD
- include "primitives.alh"
- SCD PetriNets{
- SimpleAttribute Natural {
- constraint =
- $
- String function constraint_Natural(model : Element, name : String):
- Element self
- self = model["model"][name]
- if (is_physical_int(self)):
- if (integer_gte(self, 0)):
- return "OK"!
- else:
- return "Natural number not larger than or equal to zero"!
- else:
- return "Natural number not larger than or equal to zero"!
- $
- }
- Class Place{
- tokens : Natural
- }
- Class Transition{}
- Association P2T (Place, Transition) {
- weight : Natural
- }
- Association T2P (Transition, Place) {
- weight : Natural
- }
- }
- PetriNets my_petrinet {
- Place p1 {
- tokens = 1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T (p1, t1) {
- weight = 1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- export my_petrinet to models/my_petrinet
|