1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import models/SimpleClassDiagrams as SCD
- include "primitives.alh"
- SCD PetriNets{
- Class Natural {
- $
- if (bool_not(is_physical_int(self))):
- return "Natural has no integer value"!
- elif (integer_lt(self, 0)):
- return "Natural does not have a positive or zero value"!
- else:
- return "OK"!
- $
- }
- 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
|