123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- import models/SimpleClassDiagrams as SCD
- include "primitives.alh"
- SCD PetriNets{
- SimpleAttribute Natural {
- constraint =
- $
- include "primitives.alh"
- 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 does not have a positive or zero value at " + name)!
- else:
- return ("Natural has no integer value at " + name)!
- $
- }
- Class Place{
- tokens : Natural
- }
- Class Transition{}
- Association P2T (Place, Transition) {
- weight : Natural
- }
- Association T2P (Transition, Place) {
- weight : Natural
- }
- }
- PetriNets valid_petrinet {
- Place p1 {
- tokens = 1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T (p1, t1) {
- weight = 1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_1 {
- Place p1 {
- tokens = -1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T (p1, t1) {
- weight = 1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_2 {
- Place p1 {
- tokens = 1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T p2t(p1, t1) {
- weight = -1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_3 {
- Place p1 {
- tokens = 1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T wrong_p2t (p1, p2) {
- weight = 1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_4 {
- Place p1 {
- tokens = 1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T (p1, t1) {
- weight = 1
- }
- T2P wrong_t2p(p1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_5 {
- Place p1 {}
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T (p1, t1) {
- weight = 1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_6 {
- Place p1 {
- tokens = 1
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T p2t (p1, t1) {}
- T2P (t1, p2) {
- weight = 2
- }
- }
- PetriNets invalid_petrinet_7 {
- Place p1 {
- tokens = "abc"
- }
- Place p2 {
- tokens = 3
- }
- Transition t1 {}
- P2T (p1, t1) {
- weight = 1
- }
- T2P (t1, p2) {
- weight = 2
- }
- }
- export PetriNets to models/PetriNets
- export valid_petrinet to models/valid_petrinet
- export invalid_petrinet_1 to models/invalid_petrinet_1
- export invalid_petrinet_2 to models/invalid_petrinet_2
- export invalid_petrinet_3 to models/invalid_petrinet_3
- export invalid_petrinet_4 to models/invalid_petrinet_4
- export invalid_petrinet_5 to models/invalid_petrinet_5
- export invalid_petrinet_6 to models/invalid_petrinet_6
- export invalid_petrinet_7 to models/invalid_petrinet_7
|